Getting Started
Prerequisites
| Tool | Minimum version |
|---|---|
| Node | ≥ 18 |
| pnpm | ≥ 8 |
| MongoDB | any running instance |
Installation
Clone the repository and install all dependencies from the monorepo root:
git clone https://github.com/your-org/my-app.git
cd my-app
pnpm installpnpm workspaces ensures every package under apps/ and packages/ is installed in one step.
Environment Variables
Backend — apps/backend/.env
# Server
NODE_ENV=development
PORT=3500
# Database
MONGODB_URI=mongodb://localhost:27017/myapp
# Auth
JWT_SECRET=your-jwt-secret-here
JWT_REFRESH_SECRET=your-refresh-secret-here
# AWS (SES email)
A_ACCESS_KEY_ID=your-access-key
A_SECRET_ACCESS_KEY=your-secret-key
SOURCE_EMAIL=noreply@yourdomain.comSee apps/backend/.env.example for the full template.
Frontend — apps/frontend/.env
VITE_API_BASE_URL=http://localhost:3500
VITE_APP_ENV=developmentVite resolves env files in priority order: .env.local → .env.[mode].local → .env.[mode] → .env.
Running in Development
Run all apps simultaneously:
pnpm devRun a single app:
pnpm --filter @my-app/frontend dev
pnpm --filter @my-app/backend devThe backend starts on port 3500 (configurable via PORT). The frontend Vite dev server starts on port 5173 by default.
Building
Build all packages in the correct dependency order:
pnpm buildTurborepo ensures @my-app/config → @my-app/shared → both apps.
Build only the shared package:
pnpm --filter @my-app/shared buildBuild frontend only:
pnpm --filter @my-app/frontend buildCode Quality
Linting
pnpm lint # lint all packages
pnpm lint:fix # lint + auto-fixEach package has its own .eslintrc.js extending @my-app/config/eslint.
Type checking
pnpm type-checkTests
pnpm testBackend uses Jest with Supertest. Test files live in apps/backend/src/__tests__/.
Pre-Commit Hook
Husky v9 + lint-staged runs eslint --fix automatically on every staged file before commit:
# .husky/pre-commit
pnpm exec lint-stagedNo manual lint step needed before committing.
Documentation (this site)
pnpm docs:dev # start VitePress dev server (http://localhost:5173)
pnpm docs:build # build static docs to docs/.vitepress/dist/
pnpm docs:preview # preview the built docs locally