How aungphyoex/turbo-npn works
Project Type and Purpose
• This is a full-stack, monorepo application built with Turborepo.
• Backend (“apps/api”) uses NestJS + TypeORM + PostgreSQL + JWT + Nodemailer + Amazon S3 utilities.
• Frontend (“apps/web”) uses Next.js v15 with React, Shadcn/UI, TailwindCSS, server-side rendering, NextAuth.
• Shared packages under “packages/…” provide reusable TypeScript configs, ESLint configs, UI components, and utility functions.
File-Structure Insights
• Top-level:
• apps/ – contains api (NestJS) and web (Next.js).
• packages/ – shared modules: shadcn (UI library), ts-config, eslint-config, utils, constants.
• assets/ – static media for README or build.
• apps/api follows a modular, layered MVC pattern:
• src/common – global decorators, guards, interceptors, pipes, utils.
• src/database – database module and transaction service.
• src/features – domain modules (auth, users, file, mail, health).
• apps/web follows Next.js App Router structure:
• app/ – route files and endpoints.
• components/, lib/, server/ – shared React components, client/server data-access helpers.
• Mono-repo orchestration via turbo.json and pnpm-workspace.yaml.
a. Main Components:
• Web Client (Next.js)
• API Server (NestJS)
• PostgreSQL Database
• Email Service (SMTP via Nodemailer)
• Object Storage (Amazon S3)
• Shared Libraries (UI, Utils, Configs)
• Authentication (JWT Access & Refresh Tokens)
• Turborepo/Caching Layer (build orchestration)
b. Relationships & Data Flows:
• Web Client → HTTP/HTTPS → API Server (REST endpoints + NextAuth callbacks)
• API Server → TypeORM → PostgreSQL
• API Server → Nodemailer → SMTP provider
• API Server → S3 utilities → Amazon S3 bucket (file upload/download)
• Web Client & API Server both import from Shared Packages
• Monorepo tooling (pnpm, Turborepo) orchestrates builds & caching
c. Architectural Patterns & Principles:
• Monolithic Micro-Frontend: separate apps under one repo with shared libs
• Layered MVC in API: Controllers → Services → Repositories → DB
• Next.js App Router with nested layout & API routes
• Dependency Injection in NestJS modules
• Token-based security via JWT guards and refresh mechanism
• Module boundaries for features (auth, users, mail, file, health)
d. Key Technologies & Frameworks:
• Backend: NestJS, TypeORM, PostgreSQL, JWT, Nodemailer, SWC
• Frontend: Next.js v15, React, Shadcn/UI, TailwindCSS, NextAuth, SWC
• Packaging: pnpm workspaces, Turborepo
• Shared: TypeScript, ESLint, Prettier, Husky, Commitizen