How do you organize a full-stack monorepo?

November 18, 2026 5 answers
Asked by _z36+quendelo.8

I'm looking at how to lay out the frontend, backend, database code, and anything they share. Do you prefix every folder with the app name, or use shorter names? What structures work well as the project grows?

Answers

_g28!tivlune.5

I like dividing things by how they ship. Put independently deployed projects in apps, such as apps/web, apps/api, apps/admin, and apps/worker. Put code those projects import in packages, such as packages/db and packages/ui.

That makes the deployment boundary visible without forcing everything into frontend or backend. Give each deployable its own deployment configuration, and keep the folder names short. The repository already supplies the app context, so repeating its name in every directory usually doesn't add much.

_m59+ferrylatch.2:

Where do database migrations go in that setup?

Reply to this answer
_b23!copperkite.7

A flat layout can be perfectly readable too. Top-level api, frontend, admin, and brochure directories make sense when those are the actual products you're maintaining. A lib directory can hold genuinely shared scripts or types.

There's no need to introduce an extra apps level just for the sake of it. The tradeoff is that shared code and deployable projects sit side by side, so make their roles clear in the names or documentation.

Reply to this answer
9s~claygrommet_427

Think about the business domains as well as the technical layers. Shared libraries for orders or finance, for example, can keep related rules and types together instead of scattering them across huge server and client folders.

Watch out for a catch-all utils or common package. Once unrelated code piles up there, lots of packages can end up depending on it and small changes can trigger broad rebuilds. Give shared packages a narrow purpose and keep their dependencies deliberate.

Reply to this answer
_j83+quindelo.4

Keep the root useful but uncluttered. It can hold workspace configuration, local development orchestration, and shared tooling, while each project lives in its own directory instead of making the main app occupy the root.

Shared TypeScript, linting, and formatting configurations can reduce drift. Small config packages are an option if several projects need to consume the same settings, though they don't need to be separate packages in every repo.

Reply to this answer
r.527+claythimble

Check what your framework or workspace tooling already expects before designing a layout from scratch. An opinionated tool may provide an apps and libraries structure and save a bunch of decisions.

That isn't automatically a fit for every stack, though. Check its language support and how much of its structure you actually want to adopt.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions