Contributing Guide
Welcome to the FitNexa development team! Follow these guidelines to maintain code quality and consistency.
π οΈ Local Setupβ
- Infrastructure:
docker-compose up -d(Starts PG, Redis, Rabbit, Mongo). - Shared Library: Always run
npm run buildinfitnexa-shared(ornpm run build:sharedfrom root) after making changes. - Services: Use
npm run easy-startin the root to launch the orchestrated environment (backend, admins, mobile). See Monorepo Scripts for all root scripts.
π€ Code Standardsβ
- TypeScript: Strictly required for all new logic.
- Clean Architecture: Follow the Controller -> Service -> Repository pattern for microservices.
- Logging: Use the shared
createLoggerand includecorrelationIdwhen logging errors. - Errors: Throw
AppErrorfrom@fitnexa/sharedfor consistent API error responses.
π Workflowsβ
Adding a New API Endpointβ
- Define the route in the specific service's
routes.ts. - Implement the controller logic.
- Implement the business logic in a service class.
- (Recommended) Update the service's
.yamlSwagger documentation.
Database Migrationsβ
- Modify
schema.prisma. - Run
npx prisma migrate dev --name <description>. - Re-generate the client:
npx prisma generate.
Running Testsβ
- Root:
npm run test:allruns all backend service test suites (gym, identity, nutrition, squad, content, messaging, logging, wizard) in sequence. - Interactive:
npm run easy-testlets you choose environment (Local vs UAT) and mode (Standard Run or Coverage Report), then runs each serviceβs tests. - Per-service:
npm run test:gym,npm run test:identity, etc., ornpm run testinside a service directory (e.g.fitnexa-backend/services/gym-service). - Integration:
npm run test:integrationruns the gateway integration test suite. - See Monorepo Scripts for the full list.
π Related Linksβ
- Monorepo Scripts β Root scripts (easy-start, easy-test, test:all, dev:services, etc.)
- AI & Developer Guidelines (Mandatory for ALL changes)
- Decision Log (Rationale for architectural choices)
- UAT Setup Guide
- System Overview Β· Shared Package