scientific-skills/markdown-mermaid-writing/templates/project_documentation.md
Back to Markdown Style Guide โ Read the style guide first for formatting, citation, and emoji rules.
Use this template for: Software projects, open-source libraries, internal tools, APIs, platforms, or any product that needs documentation for users and contributors. Designed to take someone from "what is this?" to "I'm contributing" in a single read.
Key features: Quick start that gets people running in under 5 minutes, architecture overview with Mermaid diagrams, API reference structure, troubleshooting section that addresses real problems, and contribution guidelines.
Philosophy: The best project docs eliminate the need to read the source code to understand the system. A new team member should be productive in hours, not weeks. Every "how does this work?" question should have an answer in this document or be one click away.
README.md or docs/index.md[bracketed placeholders] with your contentEverything below the line is the template. Copy from here:
[One sentence: what this does and why someone would use it.]
[One sentence: the key differentiator or value proposition.]
| Requirement | Version | Check command |
|---|---|---|
| [Runtime/Language] | โฅ [version] | [command] --version |
| [Database/Service] | โฅ [version] | [command] --version |
| [Tool] | โฅ [version] | [command] --version |
# Clone the repository
git clone https://github.com/[org]/[repo].git
cd [repo]
# Install dependencies
[package-manager] install
# Configure environment
cp .env.example .env
# Edit .env with your values
# Start the application
[package-manager] run dev
Verify it works:
curl http://localhost:[port]/health
# Expected: {"status": "ok", "version": "[version]"}
๐ก First-time setup issues? See Troubleshooting for common problems.
[2โ3 sentences explaining the high-level architecture โ what the major components are and how they interact.]
flowchart TB
accTitle: System Architecture Overview
accDescr: High-level architecture showing client, API, services, and data layers with primary data flow paths
client([๐ค Client]) --> api[๐ API Gateway]
subgraph services ["โ๏ธ Services"]
svc_a[๐ Service A]
svc_b[๐ฆ Service B]
svc_c[๐ Auth Service]
end
subgraph data ["๐พ Data"]
db[(๐พ Primary DB)]
cache[โก Cache]
queue[๐ฅ Message Queue]
end
api --> svc_c
api --> svc_a
api --> svc_b
svc_a --> db
svc_a --> cache
svc_b --> queue
svc_b --> db
classDef svc fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e3a5f
classDef data fill:#dcfce7,stroke:#16a34a,stroke-width:2px,color:#14532d
class svc_a,svc_b,svc_c svc
class db,cache,queue data
| Component | Purpose | Technology |
|---|---|---|
| [Component 1] | [What it does] | [Tech stack] |
| [Component 2] | [What it does] | [Tech stack] |
| [Component 3] | [What it does] | [Tech stack] |
[Describe the primary request lifecycle โ what happens when a user makes a typical request.]
sequenceDiagram
accTitle: Primary Request Lifecycle
accDescr: Sequence showing how a typical request flows through the API gateway, service layer, and data stores
participant C as ๐ค Client
participant A as ๐ API Gateway
participant S as โ๏ธ Service
participant D as ๐พ Database
C->>A: ๐ค Request
A->>A: ๐ Authenticate
A->>S: โ๏ธ Process
S->>D: ๐ Query
D-->>S: ๐ฅ Results
S-->>A: ๐ค Response
A-->>C: โ
200 OK
[repo]/
โโโ src/
โ โโโ api/ # Route handlers and middleware
โ โโโ services/ # Business logic
โ โโโ models/ # Data models and schemas
โ โโโ config/ # Configuration and environment
โ โโโ utils/ # Shared utilities
โโโ tests/
โ โโโ unit/
โ โโโ integration/
โโโ docs/ # Additional documentation
โโโ scripts/ # Build, deploy, and maintenance scripts
| Variable | Required | Default | Description |
|---|---|---|---|
DATABASE_URL | Yes | โ | PostgreSQL connection string |
REDIS_URL | No | localhost:6379 | Redis cache connection |
LOG_LEVEL | No | info | Logging verbosity: debug, info, warn, error |
PORT | No | 3000 | HTTP server port |
[VAR_NAME] | [Yes/No] | [default] | [Description] |
| File | Purpose |
|---|---|
.env | Local environment variables (never committed) |
config/default.json | Default settings for all environments |
config/production.json | Production overrides |
All API requests require a bearer token in the Authorization header:
Authorization: Bearer <token>
Obtain a token via POST /auth/login. Tokens expire after [duration].
GET /api/[resource]Description: [What this endpoint returns]
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | integer | No | Max results (default: 20, max: 100) |
offset | integer | No | Pagination offset |
[param] | [type] | [Yes/No] | [Description] |
Response:
{
"data": [
{
"id": "uuid",
"name": "Example",
"created_at": "2026-01-15T10:30:00Z"
}
],
"meta": {
"total": 42,
"limit": 20,
"offset": 0
}
}
Error responses:
| Status | Meaning | When |
|---|---|---|
401 | Unauthorized | Missing or invalid token |
403 | Forbidden | Insufficient permissions |
404 | Not found | Resource doesn't exist |
429 | Rate limited | Exceeded [N] requests/minute |
POST /api/[resource][Request body, parameters, response format]
PUT /api/[resource]/:id[Request body, parameters, response format]
DELETE /api/[resource]/:id[Parameters, response format]
</details># Build
[package-manager] run build
# Run database migrations
[package-manager] run migrate
# Start production server
[package-manager] run start
| Requirement | Production | Staging |
|---|---|---|
| CPU | [spec] | [spec] |
| Memory | [spec] | [spec] |
| Storage | [spec] | [spec] |
| Database | [spec] | [spec] |
| Endpoint | Expected | Purpose |
|---|---|---|
GET /health | 200 OK | Basic liveness |
GET /health/ready | 200 OK | Full readiness (DB, cache, dependencies) |
[Describe the deployment pipeline โ build steps, test stages, deployment targets, rollback procedures.]
</details>Cause: Database is not running or connection string is incorrect.
Fix:
[check-command]DATABASE_URL in .env[test-command]Cause: [What triggers this error]
Fix:
Cause: [Common causes โ missing indexes, cache cold start, etc.]
Fix:
[command][command]# Fork and clone
git clone https://github.com/[your-fork]/[repo].git
# Install with dev dependencies
[package-manager] install --dev
# Run tests
[package-manager] test
# Run linter
[package-manager] run lint
main: git checkout -b feature/your-feature[package-manager] testLast updated: [Date] ยท Maintained by [Team/Owner]