Template Structure
Every Gymlium template follows a strict directory structure. The platform relies on this structure to discover and render your components correctly.
Required directory layout
templates/your-template-name/
├── template.manifest.json # Template metadata
├── template.css # Global CSS custom properties
├── index.ts # Barrel file — all exports
├── Header/
│ ├── Header.tsx # Named export: Header
│ └── Header.module.css
├── Footer/
│ ├── Footer.tsx # Named export: Footer
│ └── Footer.module.css
├── Loading/
│ ├── Loading.tsx # Default export
│ └── Loading.module.css
├── pages/
│ ├── home/
│ │ ├── HomeContent.tsx # Default export
│ │ └── HomeContent.module.css
│ ├── about/
│ │ ├── AboutContent.tsx # Default export
│ │ └── AboutContent.module.css
│ └── login/
│ ├── LoginContent.tsx # Default export
│ └── LoginContent.module.css
└── preview/
└── thumbnail.png # Marketplace listing imageRequired files
| File | Purpose | Export pattern |
|---|---|---|
template.manifest.json | Template metadata and configuration | N/A (JSON) |
template.css | Global CSS custom properties for theming | N/A (CSS) |
index.ts | Barrel file — single point of entry for all exports | See below |
Header/Header.tsx | Navigation header component | Named export: export function Header() |
Footer/Footer.tsx | Site footer component | Named export: export function Footer() |
Loading/Loading.tsx | Loading indicator component | Default export: export default function Loading() |
pages/home/HomeContent.tsx | Home page content | Default export |
pages/about/AboutContent.tsx | About page content | Default export |
pages/login/LoginContent.tsx | Login page content | Default export |
preview/thumbnail.png | Marketplace preview image (path set in preview.thumbnail) | N/A (image) |
The barrel file (index.ts)
The barrel file is how the Gymlium platform discovers your components. It must follow this exact pattern:
// Layout components — named exports
export { Header } from './Header/Header'
export { Footer } from './Footer/Footer'
// Loading — default re-export
export { default as Loading } from './Loading/Loading'
// Pages — default re-exports
export { default as HomeContent } from './pages/home/HomeContent'
export { default as AboutContent } from './pages/about/AboutContent'
export { default as LoginContent } from './pages/login/LoginContent'
// Optional pages (include only if you've built them)
export { default as ServicesContent } from './pages/services/ServicesContent'
export { default as BlogContent } from './pages/blog/BlogContent'
export { default as ContactContent } from './pages/contact/ContactContent'The barrel file export names must match exactly. Header and Footer are named exports. All page components and Loading are re-exported as named exports from default exports using the export { default as Name } pattern.
Component requirements
Header (named export)
// ✅ Correct — named export
export function Header() {
return <header>...</header>
}
// ❌ Incorrect — default export
export default function Header() {
return <header>...</header>
}The Header component receives no props. Use the useApp() and useAuth() hooks to access data.
Footer (named export)
// ✅ Correct — named export
export function Footer() {
return <footer>...</footer>
}Same rules as Header — named export, no props, use hooks for data.
Loading (default export)
// ✅ Correct — default export
export default function Loading() {
return <div className={styles.spinner}>...</div>
}The Loading component is shown while page content loads. It should be lightweight and visually consistent with your template’s design.
Page components (default export)
// ✅ Correct — default export
export default function HomeContent() {
return <main>...</main>
}Every page component must use a default export. The component name should match the pattern {PageName}Content (e.g. HomeContent, AboutContent, ServicesContent).
Optional page directories
Beyond the three required pages (home, about, login), you can include any of these optional pages:
| Directory | Component name | Description |
|---|---|---|
pages/services/ | ServicesContent | Services listing |
pages/blog/ | BlogContent | Blog post listing |
pages/testimonials/ | TestimonialsContent | Client testimonials |
pages/pricing/ | PricingContent | Pricing plans |
pages/schedule/ | ScheduleContent | Session scheduling |
pages/events/ | EventsContent | Events calendar |
pages/contact/ | ContactContent | Contact form |
pages/privacy/ | PrivacyContent | Privacy policy |
pages/terms/ | TermsContent | Terms of service |
pages/transformations/ | TransformationsContent | Before/after gallery |
pages/account/ | AccountContent | User account dashboard |
pages/join/ | JoinContent | Registration page |
pages/forgotPassword/ | ForgotPasswordContent | Password reset request |
pages/verifyEmail/ | VerifyEmailContent | Email verification |
pages/resetPassword/ | ResetPasswordContent | Password reset form |
Each optional page follows the same pattern: a directory with a component file (default export) and its CSS module. Don’t forget to add the export to your barrel file.
Preview and assets directories
The preview/ directory holds your marketplace images:
thumbnail.png(required) — 1200×900px marketplace listing image, referenced in your manifest’spreview.thumbnail- Screenshots (at least one) — referenced in your manifest’s
preview.screenshotsarray
Any other static assets your template needs (SVGs, decorative images, etc.) can live in an assets/ directory.
Keep asset file sizes reasonable. The total template package should be under 10 MB. Optimise images before including them.