|
| 1 | +--- |
| 2 | +title: "Project Structure" |
| 3 | +summary: "Understanding the template organization" |
| 4 | +description: "Learn about the folder structure and key files in the documentation template." |
| 5 | +--- |
| 6 | + |
| 7 | +## Folder Overview |
| 8 | + |
| 9 | +``` |
| 10 | +docs/ |
| 11 | +├── .content-collections/ # Auto-generated (dev mode) |
| 12 | +├── .github/ # GitHub Actions workflows |
| 13 | +├── app/ # React Router application |
| 14 | +│ ├── components/ # UI components |
| 15 | +│ ├── hooks/ # React hooks |
| 16 | +│ ├── routes/ # Route definitions |
| 17 | +│ ├── utils/ # Utility functions |
| 18 | +│ ├── routes.ts # Route configuration |
| 19 | +│ └── tailwind.css # Tailwind styles |
| 20 | +├── content/ # Your documentation (MDX/MD) |
| 21 | +├── generated-docs/ # Generated docs (production) |
| 22 | +├── public/ # Static assets |
| 23 | +├── resources/ # Icons, fonts, assets |
| 24 | +├── content-collections.ts # Content config |
| 25 | +├── generate-docs.ts # Docs generation script |
| 26 | +├── Dockerfile # Docker configuration |
| 27 | +├── fly.toml # Fly.io deployment config |
| 28 | +├── .env.example # Environment variables template |
| 29 | +└── package.json # Dependencies and scripts |
| 30 | +``` |
| 31 | + |
| 32 | +## Core Folders |
| 33 | + |
| 34 | +### `app/` |
| 35 | + |
| 36 | +The React Router v7 application that powers your documentation site. |
| 37 | + |
| 38 | +**Key folders:** |
| 39 | +- **`components/`** - Reusable UI components (Command K, Code blocks, Sidebar, MDXWrapper, etc.) |
| 40 | +- **`hooks/`** - Custom React hooks for documentation features |
| 41 | +- **`routes/`** - Route components (homepage, documentation layout, documentation pages) |
| 42 | +- **`utils/`** - Helper functions and utilities |
| 43 | +- **`tailwind.css`** - Global styles and Tailwind configuration |
| 44 | + |
| 45 | +### `resources/` |
| 46 | + |
| 47 | +Static resources used throughout the site: |
| 48 | +- SVG icons |
| 49 | +- Custom fonts |
| 50 | +- Other design assets |
| 51 | + |
| 52 | +Feel free to add your own assets here. |
| 53 | + |
| 54 | +### `content/` |
| 55 | + |
| 56 | +**This is where your documentation lives.** All `.md` and `.mdx` files should be placed here following the content organization structure (see Content Guide). |
| 57 | + |
| 58 | +### `generated-docs/` |
| 59 | + |
| 60 | +**Production-only folder.** Contains processed documentation organized by version: |
| 61 | +- `main/` - Latest docs from main branch (no tags) |
| 62 | +- `v1.0.0/`, `v2.0.0/` - Versioned documentation |
| 63 | + |
| 64 | +This folder is created by the `generate-docs.ts` script and used during production builds. |
| 65 | + |
| 66 | +### `.content-collections/` |
| 67 | + |
| 68 | +**Development-only folder (auto-generated).** Contains processed content for hot reloading. Don't edit this folder manually—it's regenerated automatically. |
| 69 | + |
| 70 | +## Key Files |
| 71 | + |
| 72 | +### `package.json` |
| 73 | + |
| 74 | +Contains important scripts: |
| 75 | + |
| 76 | +```json |
| 77 | +{ |
| 78 | + "scripts": { |
| 79 | + ... |
| 80 | + "generate:docs": "tsx generate-docs.ts", |
| 81 | + "content-collections:build": "content-collections build" |
| 82 | + } |
| 83 | +} |
| 84 | +``` |
| 85 | + |
| 86 | +### `content-collections.ts` |
| 87 | + |
| 88 | +Configures how MDX/MD files are processed. Defines: |
| 89 | +- Document schema (frontmatter fields) |
| 90 | +- File patterns to match |
| 91 | +- Content transformations |
| 92 | + |
| 93 | +### `generate-docs.ts` |
| 94 | + |
| 95 | +Script that generates versioned documentation from your git releases. Uses: |
| 96 | +- Git commands to fetch releases/tags |
| 97 | +- Processes and organizes docs by version |
| 98 | + |
| 99 | +### `fly.toml` |
| 100 | + |
| 101 | +Fly.io deployment configuration. Defines: |
| 102 | +- App name |
| 103 | +- Region |
| 104 | +- Build settings |
| 105 | +- Health checks |
| 106 | +- Environment variables |
| 107 | + |
| 108 | +### `Dockerfile` |
| 109 | + |
| 110 | +Docker configuration for building and running the app in production. |
| 111 | + |
| 112 | +### `.env.example` |
| 113 | + |
| 114 | +Template for environment variables: |
| 115 | + |
| 116 | +```env |
| 117 | +GITHUB_REPO_URL=https://github.com/your-org/your-repo |
| 118 | +``` |
| 119 | + |
| 120 | +Copy this to `.env` and fill in your values. |
| 121 | + |
| 122 | +### `routes.ts` |
| 123 | + |
| 124 | +React Router configuration file that defines: |
| 125 | +- Route patterns |
| 126 | +- Layout hierarchy |
| 127 | +- Route metadata |
| 128 | + |
| 129 | +## Components You'll Use |
| 130 | + |
| 131 | +### `MDXWrapper` |
| 132 | + |
| 133 | +Wraps your MDX content with styling. Located in `app/components/`. |
| 134 | + |
| 135 | +### Custom MDX Components |
| 136 | + |
| 137 | +Pre-built components you can use in your MDX: |
| 138 | +- `<InfoAlert>` - Information callouts |
| 139 | +- `<WarningAlert>` - Warning messages |
| 140 | + |
| 141 | +To use custom components in MDX, pass them to the `components` prop in `MDXContent`. |
| 142 | + |
| 143 | +### Command K |
| 144 | + |
| 145 | +Built-in search component that indexes your documentation automatically. |
| 146 | + |
| 147 | +### Sidebar |
| 148 | + |
| 149 | +Auto-generated from your content structure. Respects the ordering prefixes in your filenames. |
| 150 | + |
| 151 | +## Customization Points |
| 152 | + |
| 153 | +All FIXME comments mark places you'll want to customize: |
| 154 | +- Brand colors in `tailwind.css` |
| 155 | +- Package name references |
| 156 | +- GitHub repository links |
| 157 | +- Site metadata |
| 158 | + |
| 159 | +Find them with: |
| 160 | + |
| 161 | +```bash |
| 162 | +grep -r "FIXME" --include="*.ts" --include="*.tsx" --include="*.css" |
| 163 | +``` |
0 commit comments