|
| 1 | +# Contributing to this project |
| 2 | + |
| 3 | +Thanks for taking the time to contribute. Please read this guide before opening a PR or issue. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## Table of Contents |
| 8 | + |
| 9 | +- [Code of Conduct](#code-of-conduct) |
| 10 | +- [Getting Started](#getting-started) |
| 11 | +- [Development Workflow](#development-workflow) |
| 12 | +- [Branching and Commits](#branching-and-commits) |
| 13 | +- [Pull Requests](#pull-requests) |
| 14 | +- [Testing](#testing) |
| 15 | +- [Reporting Bugs](#reporting-bugs) |
| 16 | +- [Requesting Features](#requesting-features) |
| 17 | + |
| 18 | +--- |
| 19 | + |
| 20 | +## Code of Conduct |
| 21 | + |
| 22 | +This project follows the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md). By participating, you agree to uphold it. |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +## Getting Started |
| 27 | + |
| 28 | +### Prerequisites |
| 29 | + |
| 30 | +- Node.js 20+ |
| 31 | +- MongoDB 7+ (or Docker) |
| 32 | +- npm 10+ |
| 33 | + |
| 34 | +### Setup |
| 35 | + |
| 36 | +```bash |
| 37 | +git clone https://github.com/<owner>/this project.git |
| 38 | +cd this project |
| 39 | +npm install |
| 40 | +cp .env.example apps/api/.env |
| 41 | +cp .env.example apps/web/.env.local |
| 42 | +# Fill in required values in both .env files |
| 43 | +npm run dev |
| 44 | +``` |
| 45 | + |
| 46 | +The API runs on `http://localhost:4000` and the web app on `http://localhost:3000`. |
| 47 | + |
| 48 | +--- |
| 49 | + |
| 50 | +## Development Workflow |
| 51 | + |
| 52 | +The repo is a **Turborepo monorepo** with three packages: |
| 53 | + |
| 54 | +| Package | Path | Description | |
| 55 | +| ---------------------------- | ----------------------- | ---------------------- | |
| 56 | +| `@this project/api` | `apps/api` | Express 4 REST API | |
| 57 | +| `@this project/web` | `apps/web` | Next.js 14 frontend | |
| 58 | +| `@this project/shared-types` | `packages/shared-types` | Zod schemas + TS types | |
| 59 | + |
| 60 | +**Adding a new API endpoint:** |
| 61 | + |
| 62 | +1. Add Zod schema to `packages/shared-types/src/schemas/` |
| 63 | +2. Add route in `apps/api/src/routes/` |
| 64 | +3. Add controller in `apps/api/src/controllers/` |
| 65 | +4. Add service in `apps/api/src/services/` |
| 66 | + |
| 67 | +**Adding a new page:** |
| 68 | + |
| 69 | +1. Create `app/(dashboard)/<route>/page.tsx` |
| 70 | +2. Add sidebar link in `components/layout/sidebar.tsx` |
| 71 | +3. Create hooks in `hooks/use-<entity>.ts` |
| 72 | +4. Create components in `components/<entity>/` |
| 73 | + |
| 74 | +--- |
| 75 | + |
| 76 | +## Branching and Commits |
| 77 | + |
| 78 | +- Branch off `main`. Use a short, descriptive branch name: |
| 79 | + - `feat/budget-alerts` |
| 80 | + - `fix/savings-rate-calculation` |
| 81 | + - `docs/helm-readme` |
| 82 | + - `chore/upgrade-mongoose` |
| 83 | + |
| 84 | +- Commit messages should be concise and use the imperative mood: |
| 85 | + - `add spending by day-of-week endpoint` |
| 86 | + - `fix savings rate always returning zero` |
| 87 | + - `update helm chart for production overlay` |
| 88 | + |
| 89 | +- Do not commit directly to `main`. |
| 90 | + |
| 91 | +--- |
| 92 | + |
| 93 | +## Pull Requests |
| 94 | + |
| 95 | +- Fill out the PR template completely. |
| 96 | +- Keep PRs focused — one logical change per PR. |
| 97 | +- All PRs require passing tests and a clean TypeScript build. |
| 98 | +- Add screenshots for any UI changes. |
| 99 | +- Request review from a maintainer when ready. |
| 100 | + |
| 101 | +**Before submitting:** |
| 102 | + |
| 103 | +```bash |
| 104 | +npm run test # all 330 tests must pass |
| 105 | +npm run lint # TypeScript must compile clean |
| 106 | +npm run format # run Prettier |
| 107 | +``` |
| 108 | + |
| 109 | +--- |
| 110 | + |
| 111 | +## Testing |
| 112 | + |
| 113 | +Tests live in `__tests__/` directories next to their source: |
| 114 | + |
| 115 | +```bash |
| 116 | +npm run test # all packages |
| 117 | +npx turbo test --filter=@this project/api # API only |
| 118 | +npx turbo test --filter=@this project/web # web only |
| 119 | +npx turbo test --filter=@this project/shared-types # schema tests only |
| 120 | +``` |
| 121 | + |
| 122 | +**Rules:** |
| 123 | + |
| 124 | +- Write tests for every function added or modified. |
| 125 | +- API service tests use real Mongoose + an in-memory MongoDB server — do not mock the DB. |
| 126 | +- Web tests use Vitest + jsdom. |
| 127 | +- All tests must pass before a PR can be merged. |
| 128 | + |
| 129 | +--- |
| 130 | + |
| 131 | +## Reporting Bugs |
| 132 | + |
| 133 | +Use the [Bug Report](.github/ISSUE_TEMPLATE/bug_report.yml) issue template. Include: |
| 134 | + |
| 135 | +- Steps to reproduce |
| 136 | +- Expected vs. actual behavior |
| 137 | +- Browser/OS/Node version if relevant |
| 138 | +- Relevant logs or screenshots |
| 139 | + |
| 140 | +--- |
| 141 | + |
| 142 | +## Requesting Features |
| 143 | + |
| 144 | +Use the [Feature Request](.github/ISSUE_TEMPLATE/feature_request.yml) issue template. Explain the problem you're solving, not just the solution you want. |
0 commit comments