How angular-university/nestjs-course works
Project Type & Purpose
• This is a full-stack sample application used in a NestJs course.
• Frontend: Angular SPA (served on port 4200).
• Backend: NestJs REST API (launched via rest-api/npm run server).
• Data layer: MongoDB (populated via scripts).
File Structure
• Top level:
– angular.json, package.json, proxy.json, src/ (Angular app), rest-api/ (NestJs server), shared/ (common DTOs).
• Frontend (src/):
– app/auth (login, interceptor, service), app/courses (modules, components, HTTP service).
– environments, assets, styles, test configs.
• Backend (rest-api/src/):
– auth (controller, module, user schema), courses (controllers, repositories, schemas), filters, guards, middleware, pipes.
– main.ts bootstraps NestJs.
– populate-db.ts & db-data.ts seed MongoDB.
• Config files: proxy.json (for dev‐proxy from Angular → NestJs), karma.conf.js, protractor.conf.js.
Pull Insights from README
• Describes how to run both servers, Node 16 requirement.
• Emphasizes separate package.json in rest-api.
a. Main Components
• Angular Frontend (Browser)
• NestJs Backend (REST API server)
• MongoDB Database
• Shared DTO Layer (Type definitions shared between client & server)
• External tools (Node, Angular CLI, Proxy)
b. Relationships & Data Flows
• Browser ↔ Angular app components ↔ HTTP calls → NestJs controllers
• NestJs controllers → service/repository layer → MongoDB driver (Mongoose)
• Auth flow: LoginComponent → AuthService → AuthController → JWT → Guards
• Seed scripts → MongoDB (populate initial data)
c. Architectural Patterns & Principles
• Separation of concerns:
– Angular modules (feature modules for auth, courses)
– NestJs modules (AuthModule, CoursesModule)
• Layered architecture (controllers → services/repositories → schemas)
• Dependency injection (built-into NestJs, Angular)
• Filters & pipes (error handling, validation)
• Guards & middleware (authentication, authorization, request‐scoped logic)
d. Core Technologies & Frameworks
• Frontend: Angular, RxJS, Angular CLI, HTTP client, interceptors
• Backend: NestJs, TypeScript, Mongoose (MongoDB), Jest (e2e), class-validator
• Dev tooling: Node.js, npm, proxy.json, tsconfig, tslint/prettier