2.8 KiB
2.8 KiB
Repository Guidelines
Project Structure & Module Organization
backend/contains the unified Node/Express server (backend/unified-server.js) and core backend modules inbackend/src/(services/,routes/,middleware/,graphql/).frontend/is the React app; primary code lives infrontend/src/, and production artifacts are generated infrontend/build/.backend/__tests__/holds backend Jest tests. Cross-stack UI/API checks live intests/(*.spec.jsfor Playwright, Selenium scripts undertests/selenium/).database/andbackend/migrations/contain schema and seed/migration data.docs/stores architecture and operational notes.
Build, Test, and Development Commands
- Install dependencies per package:
npm cicd backend && npm cicd frontend && npm cicd tests && npm ci
- Run backend locally:
cd backend && npm run dev(nodemon) orcd backend && npm start. - Run frontend locally:
cd frontend && npm run dev. - Build frontend:
cd frontend && npm run build. - Backend tests with coverage:
cd backend && npm test -- --coverage --passWithNoTests. - Playwright E2E (local):
cd tests && PLAYWRIGHT_BASE_URL=http://localhost:4032 npx playwright test.
Coding Style & Naming Conventions
- Use JavaScript/React with 2-space indentation and existing semicolon style.
- Prefer
async/await; keep route handlers thin and push business logic intobackend/src/services/. - Naming:
camelCasefor variables/functions,PascalCasefor React components, kebab/camel names aligned to existing files. - Test naming: Jest files as
*.test.js; Playwright files as*.spec.js. - Frontend linting follows
react-scriptsESLint defaults (react-appconfig).
Testing Guidelines
- Primary frameworks: Jest (+ Supertest) for backend and Playwright for E2E. Selenium is available for supplemental UI checks.
- Add or update backend tests for any API/service change; add Playwright coverage for user-facing flow changes.
- Include happy-path and failure-path assertions. For new modules, target at least ~80% coverage.
Commit & Pull Request Guidelines
- Follow Conventional Commit style seen in history (
feat:,fix:,chore:,docs:, optional scopes likechore(docs):). - Keep commits focused and include related migration/test updates.
- PRs should include: concise summary, linked issue (if applicable), test commands run + outcomes, and screenshots for UI changes.
- Ensure CI checks pass before merge (backend tests, frontend build, and security scan).
Security & Configuration Tips
- Never commit plaintext secrets. Keep local secrets in
backend/.env; use encrypted env files where supported. - Do not commit logs, test artifacts, or DB backups (
logs/,tests/test-results/,tests/playwright-report/,backups/).