This guide covers app-specific standards for apps/backend. The backend integrates with Stellar/Soroban. For migration details, see Stellar Migration Notes.
cd apps/backend
npm install# Lint and auto-fix
npm run lint
# Unit tests
npm run test
# E2E tests
npm run test:e2e
# Run in watch mode
npm run start:dev- Follow NestJS module boundaries and keep business logic in services.
- Validate DTOs and keep API contracts explicit.
- Add tests for behavior changes and bug fixes.
- Keep migrations and schema-related changes coordinated.
npm run lintpasses.npm run testpasses (andnpm run test:e2ewhen endpoints change).- API-facing changes include DTO/docs updates.
- Relevant docs are updated.
- Security-facing API changes keep the standardized error contract aligned with
{ code, message, details, requestId }. - Public endpoint changes document any rate-limit env vars and include throttling or validation coverage when behavior changes.
To prevent accidental breaking changes to client-facing APIs, we use schema snapshotting. This ensures any changes to DTOs or endpoint paths are explicitly reviewed.
- Purpose: Detect unintentional API contract drift during PRs.
- Run Locally: Run
npm run testinsideapps/backend. It will fail with a diff if the schema changed. - Intentional Updates: If the API change is deliberate, update the snapshot by running
npm run test -- -uinsideapps/backendand commit the modified.snapfile. - Coverage: Currently covers the
usersroute group (apps/backend/src/users/users-schema.spec.ts). - Extending Coverage: To cover a new module, create a
<module>-schema.spec.tstest that isolates the module's controller and snapshots its OpenAPI document, following the pattern inusers-schema.spec.ts.