e-be-tc — Book Exchange API
Problem
Design and implement a book borrowing and return system for library members — with proper domain logic, clear API contracts, and a codebase that is maintainable and testable from day one.
Role
Solo author. Responsible for system design, implementation, testing, deployment, and documentation.
Architecture
The project applies Domain-Driven Design (DDD) and Command Query Responsibility Segregation (CQRS):
- Commands (borrow, return, create member/book) are separated from queries (list available books, member history)
- Domain logic is encapsulated in clear aggregates and value objects, not scattered across controllers
- Infrastructure (PostgreSQL, Express) is kept at the boundary — swappable without touching business logic
Stack
- Runtime: TypeScript, Node.js, Express
- Database: PostgreSQL
- Testing: Jest (unit tests)
- API Docs: Swagger UI + Bruno collection
- CI/CD: GitHub Actions
- Dev environment: Nix + Direnv (reproducible, no “works on my machine”)
Key decisions
- CQRS keeps read paths cheap and write paths explicit — making business rules easy to audit
- Nix flake ensures every developer (and CI) works with the same tool versions
- Swagger + Bruno gives two ways to explore the API: browser UI and importable request collection