Skip to content
/ template-monorepo Public template

A template monorepo for quickly creating fullstack projects.

Notifications You must be signed in to change notification settings

danmandel/template-monorepo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

97 Commits
 
 
 
 
 
 

Repository files navigation

Template Monorepo

This is an opinionated & minimalistic template for quickly starting new projects.

Technical Decisions

  1. Frontend/backend folder structure:

    • less nesting than other monorepo approaches.
    • almost 0 additional configuration compared to separate frontend/backend repos.
    • easy to swap out either frontend or backend for other, even non-typescript, tech.
    • supports frontend/backend-specific vscode settings, linting, formatting, searching.
  1. Domain Driven Design (DDD) oriented backend:

    • highly modular, scales well with application complexity.
    • more intuitive folder structure than grouping by responsibility e.g. src/models, src/controllers, etc.
  2. Next.js (App Router) frontend:

    • rapid development with file-based routing.
    • clean, reusable components with shadcdn + tailwind.
  3. GraphQL & Apollo Client:

    • strongly typed API + automatic GQL validation and type hints with Apollo VSCode extension.
    • bun codegen generates typesafe react hooks for executing queries, mutations, and subscriptions.
    • [TODO] dataloader for the n+1 query problem.
  4. Docker:

    • consistent dev environment.
    • easy deployment anywhere, can deploy frontend and backend separately if necessary.
    • simple to scale up and down.
  5. ESLint, Prettier:

    • standardized code style across entire the codebase.
    • opinionated rules to enforce best practices and avoid common mistakes.
  6. Firebase auth:

    • easy to implement and integrate into projects.

Development

From the root directory: cursor frontend && cursor backend From the backend: bun infra

Alternatively if you don't want to use docker, you can run bun dev in the frontend and backend directories.

To keep your project in sync with updates to this template, you can periodically run bun backend/bin/sync.ts. Though due to the fact that starting a project using a template clears the git history, there is a heightened chance of a merge conflict occuring if your project has significantly diverged from the template.