Backend API for a barbershop scheduling domain, built with NestJS. This project is intended for study/learning and focuses on a modular architecture (Clean Architecture / DDD-inspired) with use-cases, repositories, and clear boundaries between domain and HTTP.
- Authentication via JWT (
/auth/sign-in) - Register customer and barbershop
- Create and list barbershop services (with optional filters)
- Create, cancel, and list bookings for customer/barbershop
- Node.js + npm
- SQLite (file-based) for local development (via TypeORM)
npm installCreate a .env file based on .env_example.
npm run start:devWith TYPEORM_SYNCHRONIZE=true, TypeORM will create/update tables automatically in the SQLite file defined by SQLITE_PATH.
npm test- Unit tests use mocked repositories.
- E2E tests configure their own in-memory SQLite database inside each test module (they do not depend on the app database file).
POST /auth/sign-in→{ "accessToken": "..." }
POST /customer→{ user, customer }
POST /barbershop→{ user, barbershop }
POST /barbershop-service(JWT) → creates a service for a barbershopGET /barbershop-service→ lists services (only active ones) with optional filters:nameminPricemaxPricebarbershopId
POST /booking(JWT) → create bookingPOST /booking/:id/cancel(JWT) → cancel bookingGET /booking/customer(JWT) → list bookings for the logged-in customerGET /booking/barbershop(JWT) → list bookings for the logged-in barbershop owner
POST /booking: only the logged-in user that owns thecustomerIdcan create a bookingPOST /booking/:id/cancel: only the booking's customer user or the barbershop owner can cancelPOST /barbershop-service: only the barbershop owner can create services for their barbershop
- HTTP responses are mapped to DTOs (presenters) to avoid returning domain objects directly.