Logo

Command Palette

Search for a command to run...

Project Structure

Understand the monorepo architecture, including apps and shared packages.

The project is organized using Turborepo for workspace management and npm workspaces.

Monorepo Overview

  • apps/: Individual applications that make up the ecosystem.
  • packages/: Shared libraries used by the applications.
  • docker-compose.yml: For running services like MongoDB locally.
  • turbo.json: Configuration for the build system.

Apps

apps/api (Express Backend)

The backend server responsible for authentication, database operations, and API key management.

  • Tech Stack: Node.js, Express, TypeScript, Scalar (OpenAPI).
  • Key Features:
    • src/routes/: API endpoints grouped by functionality.
    • src/middleware/: RBAC and authentication logic.
    • public/openapi.json: Auto-generated API documentation.

apps/web (Next.js Frontend)

The user interface for managing teams, accounts, and viewing data.

  • Tech Stack: Next.js (App Router), Tailwind CSS, Shadcn UI, Zustand.
  • Key Features:
    • app/(site)/: Landing page and public guides.
    • app/(app)/: Dashboard and authenticated application logic.
    • app/(auth)/: Login, registration, and password recovery.
    • components/ui/: Reusable UI components.

Shared Packages

packages/shared

The core logic shared between the API and the Web frontend.

  • Models: Mongoose schemas for Users, Teams, API Keys, etc.
  • Lib: Shared utilities for session handling, encryption, and email sending.
  • Utils: Common helper functions.

packages/tsconfig

Shared TypeScript configurations for consistent compiler settings across the monorepo.


Shared Logic Pattern

This starter uses a Centralized Logic pattern. Instead of duplicating complex logic like authentication or database models, we define them once in packages/shared and import them where needed.

For example, the User model is defined in packages/shared and used by both the API (for CRUD operations) and the Web frontend (for type safety and shared logic).