Understanding Your Template Files
Letβs look at the common file structure used across Capricorn Next.js templates.
Standard Project Structure
All Capricorn templates follow a consistent, organized structure:
- globals.css
- layout.tsx
- page.tsx
- package.json
- next.config.ts
Core Folders Explained
π app/ β Your Pages
This is where all your website pages live using Next.js App Router.
| File/Folder | Purpose |
|---|---|
globals.css | Global styles, theme colors, CSS variables |
layout.tsx | Root layout (header, footer, providers) |
page.tsx | Homepage |
(routes)/ | Route groups containing your pages |
Note: Folders in parentheses like (marketing) are βroute groupsβ β they organize files but donβt appear in URLs.
π components/ β Building Blocks
Reusable React components organized by purpose:
| Folder | Contains |
|---|---|
forms/ | Form components (contact, booking, newsletter) |
layout/ | Site structure (Header, Footer) |
sections/ | Page-specific sections organized by page |
shared/ | Reusable components (cards, heroes, etc.) |
ui/ | Base UI elements (Button, Input, Accordion, etc.) |
π config/ β Site Settings
Centralized configuration files:
| File | Purpose |
|---|---|
site.config.ts | Business info (name, contact, social links) |
navigation.config.ts | Menu structure and links |
seo.config.ts | Default SEO settings |
π‘ Tip: Edit site.config.ts first β itβs the quickest way to personalize your template.
π content/ β Your Content
Where your actual content lives. This may include:
- MDX files (
.mdx) β For pages with rich content (blog posts, services, etc.) - TypeScript files (
.ts) β For structured data (team, testimonials, pricing, etc.)
See your specific template documentation for exact content structure.
π lib/ β Utilities
Helper functions and utilities:
| File | Purpose |
|---|---|
utils.ts | Common helper functions (className merging, formatting) |
types/ | Shared TypeScript type definitions |
Some templates may include additional utilities for content loading (like MDX processing).
π public/ β Static Files
Static assets served directly:
public/
βββ images/ # Your images
β βββ blog/
β βββ team/
β βββ ...
βββ fonts/ # Custom fonts (if any)
βββ favicon.ico # Site faviconReference these files with absolute paths: /images/your-image.jpg
What to Edit vs. What Not to Touch
β Edit Often
| Location | What to Change |
|---|---|
config/site.config.ts | Your business info |
content/ | All your content |
public/images/ | Your images |
app/globals.css | Colors and theme |
β Edit Sometimes
| Location | What to Change |
|---|---|
config/navigation.config.ts | Menu items |
components/ | Component customizations |
app/layout.tsx | Site-wide changes |
β οΈ Edit Carefully
| Location | Why Be Careful |
|---|---|
lib/ | Core utilities β may break functionality |
next.config.ts | Build configuration |
β Donβt Touch
| Location | Why |
|---|---|
node_modules/ | Auto-generated dependencies |
.next/ | Build cache (auto-generated) |
package-lock.json | Dependency lock file |
Understanding Dynamic Routes
Folders with [slug] or [id] are dynamic routes:
app/
βββ blog/
β βββ page.tsx β /blog (listing)
β βββ [slug]/
β βββ page.tsx β /blog/any-post-name (dynamic)The bracketed part gets replaced with actual values from your content.
Hot Module Replacement
When you save a file:
- Next.js detects the change automatically
- Your browser updates without full reload
- You see changes instantly
This makes development fast and iterative!
Quick Reference
| I want to⦠| Look in⦠|
|---|---|
| Change business info | config/site.config.ts |
| Change colors/theme | app/globals.css |
| Change navigation | config/navigation.config.ts |
| Add/edit content | content/ |
| Add images | public/images/ |
| Modify a component | components/ |
Template-Specific Structure
Each template may have additional folders or different content organization. See your specific template documentation: