/monorepo

Principles

Core principles guiding the Monorepo Boilerplate architecture.

The development of Monorepo Boilerplate is guided by a set of core principles that ensure the project remains maintainable, scalable, and enjoyable to work with.

1. Simplicity & Pragmatism

We believe in choosing simple, proven solutions over complex, bleeding-edge alternatives unless the complexity is justified.

  • Monolith First: We use a modular monolith approach for the backend. It's easier to develop, deploy, and debug than microservices, while still allowing for future splitting if scale requires it.
  • Standard Tools: We stick to industry standards like NestJS, Angular, React, and PostgreSQL.

2. Strict Typing & Safety

TypeScript is used throughout the entire stack.

  • End-to-End Type Safety: We aim to share types between the backend and frontend via shared packages to prevent integration bugs.
  • Strict Mode: TypeScript strict mode is enabled to catch errors at compile time.

3. Developer Experience (DX)

A great developer experience leads to better products.

  • Monorepo: Using Turborepo allows for fast builds, shared caching, and easy code sharing.
  • Automated Setup: Commands like pnpm composer:up and pnpm db:seed make onboarding new developers a breeze.
  • Consistency: Shared ESLint and Prettier configs ensure the codebase looks and feels the same across all apps.

4. Modularity

Code should be organized into logical modules with clear boundaries.

  • Domain-Driven Design (DDD): We encourage organizing backend code by domain (e.g., auth, user, organization) rather than technical layers.
  • Encapsulation: Modules should expose only what is necessary, keeping their internal implementation private.

5. Security by Design

Security is not an afterthought.

  • Centralized Auth: Using OIDC for authentication centralizes identity management.
  • Role-Based Access Control (RBAC): A robust permission system is built into the core.