Thank you for your interest in contributing! This guide will help you get started.
We use a feature-branch workflow:
main ← production-ready code
└── dev ← integration branch (all features merge here)
├── feature/upload ← feature branches
├── feature/chunking
└── fix/login-bug ← bug fix branches
- ❌ Never commit directly to
mainordev - ✅ Always create a feature branch from
dev - ✅ Always create a Pull Request to merge into
dev - ✅
devis merged intomainonly when stable
git checkout dev
git pull origin dev
git checkout -b feature/your-feature-name# Make your changes, then:
git add .
git status # ⚠️ CHECK: .env must NOT appear here
git commit -m "feat: your descriptive commit message"
git push origin feature/your-feature-name- Go to the repository on GitHub
- Click "Compare & pull request"
- Set base branch to
dev - Write a clear title and description
- Request a review
- After approval, merge and delete the branch
We follow Conventional Commits:
<type>: <short description>
| Type | When to use | Example |
|---|---|---|
feat |
New feature | feat: add file upload endpoint |
fix |
Bug fix | fix: handle null email in login |
docs |
Documentation only | docs: update API examples in README |
refactor |
Code change (no new feature, no bug fix) | refactor: extract validation to middleware |
test |
Adding or updating tests | test: add unit tests for User model |
chore |
Maintenance tasks | chore: update dependencies |
style |
Formatting (no code logic changes) | style: fix indentation in authRoutes |
feat: implement file chunking with configurable chunk size
fix: prevent duplicate chunk index on concurrent uploads
docs: add database schema diagram to architecture docs
refactor: move JWT generation to shared utility
test: add integration tests for auth endpoints
These are mandatory. Violations will block your PR.
- Never commit
.env— it contains real passwords and secrets - Never hardcode secrets — use
process.envvia the config loader - Use parameterized queries — always
pool.execute('SELECT * FROM users WHERE id = ?', [id]), never string concatenation - Hash passwords — use
bcrypt, never store plain text - Validate input — use
express-validatoron all route inputs - Same error for wrong email/password — prevents user enumeration
-
.envnot ingit status? - No hardcoded passwords or API keys?
- Used
pool.execute()with?placeholders (not string concatenation)? - Validated all user input?
- Use
constby default,letwhen reassignment is needed, nevervar - Use
async/awaitover callbacks or.then()chains - Add comments for complex logic (not obvious code)
- Use meaningful variable names (
userIdnotx)
- Models:
PascalCase—User.js,FileMetadata.js - Everything else:
camelCase—authController.js,errorHandler.js - SQL files:
lowercase—schema.sql,seed.sql
controllers/ → Handle HTTP requests, call models, send responses
models/ → Database operations (queries, inserts, updates)
middleware/ → Request processing (auth, validation, error handling)
routes/ → Route definitions and validation rules
services/ → Business logic (chunking, replication, etc.)
utils/ → Shared utilities (logger, helpers)
config/ → Configuration and database connection
- Check if the issue already exists
- Create a new issue with:
- Clear title
- Steps to reproduce
- Expected behavior
- Actual behavior
- Environment (OS, Node version, MySQL version)
If you're unsure about anything, open an issue or reach out. Don't waste time guessing — ask!