How tetris973/mono-next-nest-template works
Main Components
• Frontend: Represent the Next.js application housed in the apps/web directory. Include details such as:
• Next.js (React) with server/client components.
• UI libraries like Mantine, testing tools such as Playwright, Vitest, and Storybook integration.
• Backend: Represent the NestJS server found in apps/server. Key aspects include:
• REST API controllers and modules (e.g., auth, user, role, and common utility folders).
• Authentication (Passport with JWT and local strategies).
• Authorization via CASL.
• ORM and database integration using Prisma (extended with Kysely) connecting to a Postgres database.
• Logging using Pino and Swagger for API documentation.
• Shared Package(s): Include the backend API SDK found in packages/backend-api-sdk which the frontend likely uses to interact with backend APIs using OpenAPI-generated code.
• Database and Infrastructure: Indicate that a Postgres database is set up (managed via Prisma migrations) and Docker containers are provided for both local development and production deployment. This component is backed by the docker/ directories (development and production setups).
• CI/CD and DevOps: You might add a component showing integration with GitLab CI/CD ('.gitlab-ci.yml') and other dev tooling (Husky, ESLint, Prettier, linters).
Relationships and Dependencies
• Frontend (Next.js) making API calls to the backend (NestJS).
• The backend interacting with the database (Postgres) and using Prisma/Kysely for ORM functionality.
• The shared backend API SDK serving as an integration layer, ensuring type-safe API calls between frontend and backend.
• Authentication flow where the frontend sends login credentials, the backend processes them via Passport strategies, and returns a JWT token.
• Integration points such as Swagger endpoints for API documentation and CASL for authorization.
• Docker should be represented either as an envelope around these components for deployment consistency or as an infrastructure container that houses the backend, database, and possibly a reverse proxy.
Architectural Patterns/Design Principles
• Monorepo Structure: Emphasize that the overall project is set up as a monorepo with separate apps for the frontend and backend plus shared packages. This suggests high cohesion across components and common build tooling (pnpm workspaces).
• Domain Driven/Modular Design: Identify modules for authentication, authorization, user management, and roles.
• Test Strategy Components: Show the inclusion of unit tests, integration/E2E tests (both in apps/server/test and apps/web/test), indicating a strong culture of automated testing.
• Dockerization: Point out that Docker (with separate development and production configurations) is used for environment consistency and deployment.
Relevant Technologies and Frameworks
• Backend: NestJS, Prisma, CASL, Passport.js, pino, Swagger, Vitest.
• Frontend: Next.js, React 18, Mantine, Playwright, Vitest, Storybook.
• Developer Tooling: pnpm, Husky, ESLint, Prettier, GitLab CI/CD, and Docker.
• Shared API SDK: OpenAPI integration to generate backend API clients.