How pgkwon1/ocowan_api works
Project type and purpose
• This is a NestJS-based backend application (no UI/front-end code present), structured as a monolithic server with multiple feature modules.
File structure
• Top level:
• src/main.ts: application entry point
• src/app.module.ts: root module wiring all feature modules
• src/common, decorators, interceptors, exception handlers: cross-cutting concerns
• src/modules: each folder under modules is a domain (e.g. auth, users, team, til, levels…)
• config files: nest-cli.json, tsconfig.json, package.json, CI in .github/workflows
• Each module typically has:
• Module file (.module.ts)
• Controller(s)
• Service(s)
• Entities/Models: database ORM definitions
• Guards, strategies, util services (e.g. JWT)
Key insights from README
• It’s a standard NestJS project scaffold, configurable via npm scripts for dev/prod/test.
a. Main components:
1. NestJS Application (single process)
• Main Module
• Feature Modules (auth, users, team, til, levels, bigthree, ocowan, storage, azure, external-api, redis, winston)
2. Database (e.g., PostgreSQL/MySQL – implied by entities/models)
3. Redis Cache
4. External Services:
• Azure (via Azure Service module)
• Generic External API
• GitHub (for exception handling or data fetch?)
5. Clients/Consumers:
• REST clients (web/mobile) calling controllers
• CLI/cron jobs (if any)
b. Relationships/Interactions:
• Controllers expose HTTP endpoints → call Services
• Services orchestrate business logic, access Repositories (ORM) → Database
• Caching layer: Services may read/write to Redis via Redis Module
• Auth Module issues JWTs & protects routes via Guards/Interceptors
• External API Module & Azure Module call out to third-party endpoints
• Winston Module captures logs across Services/Controllers
• Common/Exception/Interceptors provide cross-cutting AOP bits
c. Architectural patterns:
• Modular monolith with clear bounded contexts
• Dependency Injection (Nest’s DI container)
• Layered pattern: Controller → Service → Repository/ORM
• Decorator-based guards, exception filters, interceptors
d. Key technologies/frameworks:
• NestJS framework (Modules, Controllers, Providers)
• TypeScript
• TypeORM or Sequelize (entities/models)
• Redis client (nestjs-redis)
• Azure SDK
• Winston logger