How leoincode/api-solid-clean_architecture-tdd-ddd works
Project type and purpose
• This is a backend API application built with Node.js and TypeScript following Clean Architecture, SOLID principles, Domain-Driven Design (DDD) and Test-Driven Development (TDD).
• It exposes both REST endpoints (Express) and GraphQL (Apollo Server) for user signup, authentication, survey creation, listing, answering, and result retrieval.
• It uses MongoDB as the primary datastore, JWT for auth, bcrypt for hashing, plus Swagger for REST docs.
File structure
• src/main: entry point, configuration, adapters (Express, Apollo), route & middleware setup, Swagger, GraphQL type-defs, resolvers, factories.
• src/presentation: HTTP controllers, error handling, request/response helpers, middlewares.
• src/validation: validation protocol + concrete validators.
• src/domain: core models & use-case interfaces.
• src/data: use-case implementations coordinating domain use-cases with repository protocols.
• src/infra: concrete implementations of cryptography (bcrypt, JWT), MongoDB repos, email validator adapter.
• tests: unit & integration tests for each layer.
• config files: Docker (docker-compose.yml), Jest, ESLint, TSConfig.
Examining README for additional insights
• Emphasis on decoupling via interfaces, layered approach: presentation → domain → data → infra.
• Heavily uses Factory, Adapter, Decorator patterns, DI via composition roots (factories).
• Two API flavors: REST and GraphQL share the same use-cases.