How parthikrb/turborepo-react-nestjs works
Main Components
• Frontend (apps/web):
– A React application that uses TanStack Router for routing, Mantine as a UI library, and Tailwind CSS for styling.
• Backend (apps/api):
– A NestJS application that handles API requests and business logic.
• Shared Packages:
– UI Library (packages/ui): Contains reusable React components.
– Database (packages/db): Contains database schemas and Drizzle ORM configurations.
– ESLint and TypeScript Configs (packages/eslint-config and packages/typescript-config): Shared setups used across the monorepo.
• Build and Development Infrastructure:
– Turborepo for high-performance builds and workspace management.
– Tools like pnpm, Prettier, Husky, and lint-staged to streamline development.
Relationships and Interactions
• The Frontend (apps/web) interacts with the Backend (apps/api) via REST (or potentially GraphQL) API calls.
• The Backend (apps/api) uses the Database package (packages/db) to manage data persistence via Drizzle ORM.
• Both the frontend and backend make use of shared configurations from the ESLint and TypeScript packages, ensuring consistent code quality and type-checking.
• The UI components from packages/ui serve as the base for building the user interface in the React app.
• The Turborepo configuration (turbo.json and pnpm-workspace.yaml) ties these components together under the same build and dependency management framework.
Architectural Patterns and Design Principles
• Separation of Concerns: The frontend and backend are clearly separated, enabling independent development and testing.
• Monorepo Management: Turborepo is used to manage multiple apps and packages efficiently.
• Modular Design: Shared packages for UI, database, and configurations are modular, promoting reusability and consistency.
• Type Safety: Emphasis on TypeScript across the monorepo ensures robust type-safety and fewer runtime errors.
• DevOps Tooling: Preconfigured tools (ESLint, Prettier, Husky) ensure code quality throughout the development lifecycle.