Skip to content

Commit eb6a946

Browse files
authored
Merge pull request #3987 from Northeastern-Electric-Racing/docs-site
setup docs site with docs as source of truth
2 parents d45ede3 + 7c2e818 commit eb6a946

33 files changed

Lines changed: 8089 additions & 2704 deletions

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
*.env
2929
.agent
3030

31+
# Generated Claude skills (source is src/docs-site/docs/)
32+
.claude/skills/
33+
3134
npm-debug.log*
3235
yarn-debug.log*
3336
yarn-error.log*

package.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
"workspaces": [
77
"src/backend",
88
"src/frontend",
9-
"src/shared"
9+
"src/shared",
10+
"src/docs-site"
1011
],
1112
"scripts": {
1213
"prettier-check": "yarn prettier --check .",
1314
"frontend": "yarn workspace frontend start",
1415
"backend": "yarn workspace backend start",
1516
"backend:dev": "yarn workspace backend dev",
16-
"start": "yarn workspace shared build; concurrently --kill-others-on-fail \"yarn backend:dev\" \"yarn frontend\"",
17+
"start": "yarn workspace shared build; concurrently --kill-others-on-fail --hide 2 \"yarn backend:dev\" \"yarn frontend\" \"yarn docs:dev\"",
1718
"prisma:seed": "cd src/backend; npx prisma db seed",
1819
"prisma:reset:force": "yarn workspace shared build; cd src/backend; npx prisma migrate reset --force",
1920
"prisma:reset": "yarn workspace shared build; cd src/backend; npx prisma migrate reset",
@@ -59,7 +60,11 @@
5960
"docker:i": "cd devContainerization && docker compose -f docker-compose.dev.yml exec -T backend sh -c \"yarn install && cd src/backend && npx prisma generate\" && docker compose -f docker-compose.dev.yml exec -T frontend sh -c \"yarn install\"",
6061
"docker:test": "yarn test:setup && cd devContainerization && docker compose -f docker-compose.dev.yml exec backend bash -c \"yarn test:backend\" && docker compose -f docker-compose.dev.yml exec frontend sh -c \"yarn test:frontend\" && yarn test:teardown",
6162
"docker:rebuild": "docker compose -f devContainerization/docker-compose.dev.yml rm -f -s && yarn docker:start",
62-
"db:pull": "node scripts/db-pull.mjs"
63+
"db:pull": "node scripts/db-pull.mjs",
64+
"docs:dev": "yarn workspace finishline-docs docs:dev",
65+
"docs:build": "yarn workspace finishline-docs docs:build",
66+
"docs:serve": "yarn workspace finishline-docs serve",
67+
"skills:sync": "yarn workspace finishline-docs sync-skills"
6368
},
6469
"resolutions": {
6570
"@types/react": "17.0.1",
@@ -153,6 +158,8 @@
153158
"build",
154159
"coverage",
155160
"docs",
161+
"src/docs-site/.docusaurus",
162+
"src/docs-site/build",
156163
"lambda",
157164
"node_modules",
158165
"public",

src/docs-site/.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Dependencies
2+
node_modules/
3+
/.pnp
4+
.pnp.js
5+
6+
# Production
7+
/build
8+
9+
# Generated files
10+
.docusaurus
11+
.cache-loader
12+
sidebars.js
13+
14+
# Misc
15+
.DS_Store
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*

src/docs-site/README.md

Lines changed: 284 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,284 @@
1+
# FinishLine Documentation Site
2+
3+
This directory contains the Docusaurus-based documentation site for FinishLine developers.
4+
5+
## Architecture
6+
7+
**Source of Truth:** `docs-site/docs/` contains all developer documentation in standard Docusaurus markdown format.
8+
9+
**Claude AI Integration:** Documentation files flagged with `skill: true` in their frontmatter are automatically synced to `.claude/skills/` for Claude AI to use as context when helping with development.
10+
11+
### Workflow
12+
13+
1. **Developers edit**: `docs-site/docs/` (tracked in Git)
14+
2. **Run sync**: `yarn skills:sync` generates `.claude/skills/` (gitignored)
15+
3. **Claude reads**: `.claude/skills/` to understand the codebase
16+
17+
This approach allows us to:
18+
19+
- Maintain comprehensive documentation for developers
20+
- Selectively sync relevant docs to Claude's skills
21+
- Have docs-only content (deployment, architecture) that Claude doesn't need
22+
23+
## Prerequisites
24+
25+
- Node.js 18 or higher
26+
- Yarn package manager (this project uses Yarn workspaces)
27+
28+
## Setup
29+
30+
The docs-site is part of the FinishLine monorepo workspace. Dependencies are managed from the root:
31+
32+
```bash
33+
# From the FinishLine root directory
34+
yarn install
35+
```
36+
37+
This will install all dependencies for docs-site along with the rest of the project.
38+
39+
## Development
40+
41+
### Running the documentation site locally:
42+
43+
**From the root directory:**
44+
45+
```bash
46+
yarn docs:dev
47+
```
48+
49+
**Or from within docs-site:**
50+
51+
```bash
52+
cd docs-site
53+
yarn start
54+
```
55+
56+
The Docusaurus development server will start at `http://localhost:3002`.
57+
58+
The site will automatically reload when you edit files in `docs/`.
59+
60+
## Building for Production
61+
62+
To create a production build:
63+
64+
**From root:**
65+
66+
```bash
67+
yarn docs:build
68+
```
69+
70+
**Or from docs-site:**
71+
72+
```bash
73+
cd docs-site
74+
yarn build
75+
```
76+
77+
The static site will be generated in the `build/` directory.
78+
79+
To test the production build locally:
80+
81+
```bash
82+
yarn docs:serve
83+
```
84+
85+
## Syncing Skills for Claude
86+
87+
After editing documentation that should be available to Claude:
88+
89+
```bash
90+
yarn skills:sync
91+
```
92+
93+
This command:
94+
95+
1. Scans all files in `docs/` for `skill: true` in frontmatter
96+
2. Transforms them to Claude's SKILL.md format
97+
3. Writes them to `.claude/skills/` (gitignored)
98+
99+
**When to sync:**
100+
101+
- After adding or editing documentation flagged as a skill
102+
- Before using Claude for development (to ensure it has latest context)
103+
- Can be automated in a pre-commit hook if desired
104+
105+
## Project Structure
106+
107+
```
108+
docs-site/
109+
├── docs/ # Source of truth - developer documentation
110+
│ ├── intro.md
111+
│ └── general-practices/
112+
│ ├── backend-endpoints.md
113+
│ └── ...
114+
├── scripts/
115+
│ ├── sync-skills.js # Generate .claude/skills/ from docs/
116+
│ └── generate-sidebar.js # Auto-generate sidebars.js from docs/ structure
117+
├── src/
118+
│ ├── css/
119+
│ │ └── custom.css # Custom styling
120+
│ └── pages/
121+
│ └── index.js # Homepage redirect
122+
├── static/
123+
│ └── img/ # Static assets (logos, favicon)
124+
├── docusaurus.config.js # Docusaurus configuration
125+
├── sidebars.js # Auto-generated sidebar (gitignored)
126+
└── package.json # Dependencies and scripts
127+
```
128+
129+
## Adding New Documentation
130+
131+
### For All Documentation (Developers):
132+
133+
1. **Create a new markdown file** in `docs/`:
134+
135+
```bash
136+
docs/deployment/github-actions.md
137+
```
138+
139+
2. **Add frontmatter:**
140+
141+
```yaml
142+
---
143+
title: GitHub Actions Deployment
144+
description: Guide for deploying FinishLine using GitHub Actions
145+
skill: false # This is docs-only, not a Claude skill
146+
---
147+
```
148+
149+
3. **Test it:**
150+
```bash
151+
yarn docs:dev
152+
```
153+
154+
The sidebar will be automatically generated from the folder structure!
155+
156+
### For Documentation That Should Be a Claude Skill:
157+
158+
1. **Create the markdown file** as above
159+
160+
2. **Use `skill: true` in frontmatter:**
161+
162+
```yaml
163+
---
164+
title: Backend Endpoints
165+
description: Guide for creating API endpoints
166+
skill: true
167+
skill_name: backend-endpoints # Maps to folder name in .claude/skills/
168+
---
169+
```
170+
171+
3. **Sync to Claude:**
172+
```bash
173+
yarn skills:sync
174+
```
175+
176+
The sidebar will be automatically generated!
177+
178+
### Organizing Documentation
179+
180+
The sidebar navigation is **automatically generated** from the `docs/` folder structure:
181+
182+
- **Reorder pages**: Rename files (alphabetical order is used)
183+
- **Create categories**: Create nested folders in `docs/`
184+
- **Change labels**: Folder names become category labels (use hyphens: `my-category`)
185+
186+
The sidebar regenerates automatically when you run `yarn docs:dev` or `yarn docs:build`.
187+
188+
You can also manually regenerate it:
189+
190+
```bash
191+
yarn generate-sidebar
192+
```
193+
194+
## Frontmatter Fields
195+
196+
All documentation files should have frontmatter:
197+
198+
| Field | Required | Purpose | Example |
199+
| ------------- | ------------- | ------------------------------ | ---------------------------------- |
200+
| `title` | Yes | Page title | `Backend Endpoints` |
201+
| `description` | Yes | Page description | `Guide for creating API endpoints` |
202+
| `skill` | Yes | Should sync to Claude? | `true` or `false` |
203+
| `skill_name` | If skill:true | Folder name in .claude/skills/ | `backend-endpoints` |
204+
205+
## Customization
206+
207+
### Navbar and Footer
208+
209+
Edit `docusaurus.config.js` to customize:
210+
211+
- Site title and tagline
212+
- Navbar links
213+
- GitHub repository links
214+
- Production URL
215+
216+
### Styling
217+
218+
Edit `src/css/custom.css` to customize:
219+
220+
- Primary colors (currently set to NER red: #ef4345)
221+
- Dark mode colors
222+
- Font sizes and spacing
223+
- Custom component styles
224+
225+
### Sidebar Navigation
226+
227+
The sidebar is **automatically generated** from the `docs/` folder structure. To customize it:
228+
229+
- **Reorder pages**: Rename files (alphabetical sorting)
230+
- **Create categories**: Create nested folders in `docs/`
231+
- **Change labels**: Folder names become category labels (use hyphens: `my-category`)
232+
233+
The sidebar regenerates each time you run `yarn docs:dev` or `yarn docs:build`.
234+
235+
## Troubleshooting
236+
237+
### Documentation not updating
238+
239+
If your changes aren't appearing:
240+
241+
1. Stop the dev server (Ctrl+C)
242+
2. Clear the cache: `yarn clear`
243+
3. Run `yarn docs:dev` again
244+
245+
### Build errors
246+
247+
Common issues:
248+
249+
- **Node version**: Ensure you're running Node.js 18 or higher
250+
- **Dependencies**: From the root directory, try `rm -rf docs-site/node_modules && yarn install`
251+
- **Port conflict**: Docs run on port 3002. If it's in use, Docusaurus will try another port or you can stop the conflicting process
252+
253+
### Skills not syncing
254+
255+
If `yarn skills:sync` doesn't generate expected skills:
256+
257+
- Verify the doc has `skill: true` in frontmatter
258+
- Verify `skill_name` is set for all docs with `skill: true`
259+
- Check the console output for warnings
260+
- Ensure `.claude/skills/` is gitignored (it will be regenerated)
261+
262+
## Future Enhancements
263+
264+
Potential improvements for future iterations:
265+
266+
- **Public deployment**: Deploy to GitHub Pages or Vercel
267+
- **Search functionality**: Add DocSearch or local search plugin
268+
- **Versioning**: Support documentation for multiple FinishLine versions
269+
- **Interactive components**: Add live code examples or API explorers
270+
- **Automated sync**: Pre-commit hook to run skills:sync automatically
271+
272+
## Contributing
273+
274+
When contributing to the documentation:
275+
276+
1. Edit markdown files in `docs-site/docs/`
277+
2. Test your changes locally with `yarn docs:dev` (sidebar auto-generates)
278+
3. If you edited a skill doc (`skill: true`), run `yarn skills:sync`
279+
4. Ensure the site builds successfully with `yarn docs:build`
280+
5. Submit a PR with your documentation changes
281+
282+
## License
283+
284+
This documentation is part of the FinishLine project, licensed under GNU AGPLv3.

src/docs-site/babel.config.cjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: [require.resolve('@docusaurus/core/lib/babel/preset')]
3+
};

.claude/skills/general-practices/backend-endpoints/SKILL.md renamed to src/docs-site/docs/general-practices/backend-endpoints.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
2-
name: backend-endpoints
2+
title: Backend Endpoints
33
description: Guide for creating backend API endpoints in FinishLine following the Route → Controller → Service pattern with multi-tenant security. Use when creating new endpoints, adding API routes, implementing controllers or services, building backend request handlers, or when asked how the backend works.
4+
skill: true
5+
skill_name: backend-endpoints
46
---
57

68
# Backend Endpoints
@@ -264,7 +266,7 @@ export default class CalendarService {
264266
- ALWAYS filter `dateDeleted: null` on queries at both the top level and within nested includes/selects.
265267
- Deleting an entity MUST be a soft delete (`dateDeleted: new Date()`), never `prisma.*.delete()`.
266268

267-
For query args and transformer patterns, see the [query-args-and-transformers](../query-args-and-transformers/SKILL.md) document.
269+
For query args and transformer patterns, see the [query-args-and-transformers](./query-args-and-transformers) document.
268270

269271
### Step 5: Deciding the Access Level
270272

@@ -373,7 +375,7 @@ For complex reusable validators, spread them: `...descriptionBulletsValidators`.
373375
- [ ] Entity name added to `ExceptionObjectNames` if needed
374376
- [ ] All queries filter `dateDeleted: null` at every level
375377
- [ ] Delete operations are soft deletes
376-
- [ ] Service returns transformed shared types (see [query-args-and-transformers](../query-args-and-transformers/SKILL.md))
378+
- [ ] Service returns transformed shared types (see [query-args-and-transformers](./query-args-and-transformers))
377379
- [ ] Multiple writes wrapped in `prisma.$transaction()`
378380
- [ ] All imports use `.js` extensions
379381
- [ ] Router registered in `index.ts` (if new feature)

0 commit comments

Comments
 (0)