A backend API for a barbershop scheduling app. It was built as the capstone of Rocketseat's GoStack 11 bootcamp, with a focus on SOLID principles, DDD-style layering, and tests.
- Books appointments between clients and service providers.
- Lists registered providers.
- Handles user sign up and authentication with JWT.
- Recovers passwords by sending an email with a reset link.
- Lets users update their profile.
- Accepts avatar uploads.
- Applies rate limiting to protect the API.
The codebase follows SOLID principles and a DDD-style layout. The goal is clear separation of concerns and easy testing.
- Domain modules. Code is split by business domain under
src/modules(users, appointments, notifications). Shared infrastructure lives undersrc/shared. - Repositories. Each module exposes repository interfaces. Data access details stay behind those interfaces, so the business logic does not depend on the database.
- Services. Each use case is a small service with a single responsibility.
- Dependency injection. Dependencies are wired with tsyringe. Services receive their collaborators through their constructors, which keeps them decoupled and testable.
- Node.js as the runtime.
- TypeScript as the language.
- Express as the web framework.
- TypeORM as the ORM.
- PostgreSQL as the main database.
- MongoDB for notifications.
- Redis for caching and rate limiting.
- Jest for tests.
- Other libraries:
jsonwebtokenfor auth,bcryptjsfor password hashing,multerfor uploads,nodemailerfor email,celebratefor request validation, anddate-fnsfor dates.
This project uses Yarn. The lockfile is yarn.lock.
You will need PostgreSQL, MongoDB, and Redis running.
# install dependencies
yarn
# build the TypeScript code
yarn build
# start the dev server with hot reload
yarn dev:server
# start the server with ts-node
yarn startTypeORM migrations run through the typeorm script:
# create a migration
yarn typeorm migration:create -n CreateAppointments
# run pending migrations
yarn typeorm migration:run
# revert the last migration
yarn typeorm migration:revert
# show migration status
yarn typeorm migration:showTests run with Jest:
yarn testThiago Marinho
MIT