Appearance
Writing Documentation
This guide explains how to write and maintain documentation for the Jubiloop project.
Documentation Philosophy
Our documentation should enable developers to:
- Understand any specific component without reading everything
- Bridge the gap between "I need to work on X" and "I can modify the code"
- Quickly refresh their memory on patterns and conventions
Documentation Structure
docs/
├── product/ # Product vision and roadmap
├── features/ # Feature-centric documentation
│ ├── authentication/ # Auth overview, backend, frontend
│ ├── organizations/ # Multi-tenant workspaces
│ └── ... # Other features
├── api-reference/ # API endpoint documentation
├── architecture/ # System design and philosophy
├── backend/ # Backend technical guides
├── frontend/ # Frontend technical guides
├── infrastructure/ # Infrastructure and DevOps
│ └── deployment/ # CI/CD and environments
├── product/ # Product features and data models
│ └── data-models/ # Database schema
├── getting-started/ # Setup and installation
├── packages/ # Shared package documentation
└── team-onboarding/ # Team processes and guidesWhen to Write Documentation
Write documentation when:
- Adding a new feature or component
- Changing existing patterns or conventions
- Discovering something non-obvious
- Answering the same question multiple times
- Onboarding process
Documentation Standards
1. Context Over Exhaustiveness
Each documentation page should provide:
- What: Brief description of the component/feature
- Why: The reasoning behind decisions
- Where: Code locations and file structure
- How: Patterns and conventions to follow
- When: When to use/not use this approach
2. Code Location Hints
Always include where to find the relevant code:
markdown
## Authentication Flow
The authentication system is implemented in:
- `apps/server/app/middleware/auth.ts` - Authentication middleware
- `apps/webapp/src/hooks/use-auth.ts` - Frontend auth hook
- `apps/server/app/controllers/AuthController.ts` - Auth endpoints3. Practical Examples
Show real examples from the codebase:
markdown
## Adding a New API Endpoint
1. Create controller in `apps/server/app/controllers/`:
```typescript
// Example from EventsController.ts
export default class EventsController {
public async index({ response }: HttpContext) {
const events = await Event.all()
return response.json(events)
}
}
```- Add route in
apps/server/start/routes.ts:typescriptrouter.get('/events', [EventsController, 'index'])
### 4. Cross-References
Link related documentation:
```markdown
## Database Migrations
For migration basics, see [Database Setup](../backend/database.md).
If you're adding a new model, also check:
- [Data Models](../product/data-models/overview.md) for naming conventions
- [AdonisJS Commands](../backend/cli.md) for CLI usageWriting Style Guide
Be Direct and Practical
❌ Don't: "The authentication system has been designed with security in mind, utilizing industry best practices..."
✅ Do: "Authentication uses JWT tokens stored in HTTP-only cookies. Tokens expire after 24 hours."
Use Active Voice
❌ Don't: "Environment variables are managed by the env.deploy.yml file"
✅ Do: "env.deploy.yml manages all environment variables"
Include the "Why"
❌ Don't: "We use Cloudflare Pages for frontend hosting"
✅ Do: "We use Cloudflare Pages because it offers unlimited free sites, allowing us to create separate projects per environment without extra cost"
Show Don't Tell
❌ Don't: "Add your environment variable to the configuration file"
✅ Do:
yaml
# In env.deploy.yml
DEV:
server:
MY_NEW_VAR: 'value' # This becomes DEV_SERVER_MY_NEW_VAR in GitHub SecretsDocumentation Tools
VitePress Features
We use VitePress for documentation. Key features:
Custom Containers
markdown
::: tip
Useful tips and best practices
:::
::: warning
Important warnings or gotchas
:::
::: danger
Critical security or data loss warnings
:::
::: details Click to expand
Hidden content for advanced topics
:::Code Highlighting
```typescript // TypeScript with syntax highlighting const example = "highlighted" ```
```bash
Shell commands
npm run dev ```
Mermaid Diagrams
Adding New Documentation
1. Create the File
bash
# Create new doc in appropriate section
touch docs/backend/new-feature.md2. Add Front Matter (Optional)
markdown
---
title: New Feature Guide
description: How to work with the new feature
---3. Update Navigation
Edit docs/.vitepress/config.mjs:
javascript
// For feature documentation
{
text: 'Features',
items: [
{
text: 'New Feature',
items: [
{ text: 'Overview', link: '/product/features/new-feature/overview' },
{ text: 'Backend Implementation', link: '/product/features/new-feature/backend' },
{ text: 'Frontend Implementation', link: '/product/features/new-feature/frontend' }
]
}
]
}
// For technical guides
{
text: 'Backend Technical Guides',
items: [
// ... existing items
{ text: 'New Guide', link: '/backend/new-guide' }
]
}4. Test Locally
bash
npm run docs:dev
# Visit http://localhost:5173Documentation Checklist
Before submitting documentation:
- [ ] Provides enough context for the specific area
- [ ] Includes code locations and examples
- [ ] Links to related documentation
- [ ] Uses clear, direct language
- [ ] Explains the "why" behind decisions
- [ ] Tested locally with VitePress
- [ ] Navigation updated if new page
- [ ] No typos or broken links
Common Patterns
Environment Variables
When documenting environment variables:
- Show where to add them in
env.deploy.yml - Explain the naming convention
- Show where they're used in code
- Note any validation or format requirements
API Endpoints
When documenting API endpoints:
- Show the route definition
- Include request/response examples
- List required middleware
- Note any authentication requirements
- Link to the controller implementation
Frontend Components
When documenting frontend components:
- Show basic usage example
- List all props with types
- Include common patterns
- Note any performance considerations
- Link to the component file
Maintenance
Regular Reviews
- Review documentation regularly
- Update docs when changing code
- Remove outdated information
- Add missing context based on questions
Documentation Debt
Track documentation needs in Shortcut with the documentation label. Common needs:
- Missing "how-to" guides
- Outdated examples
- Unclear explanations
- Missing cross-references
Getting Help
- Review existing docs for examples
- Use VitePress documentation for syntax help
- Check with your teammate for guidance