</>
  • Home
  • About
  • Skills
  • Experience
  • Case Studies
  • Blog
  • Projects
madrimov.uz

Keling, jiddiy
tizim quramiz

madrimov5014@gmail.com→
</>© 2026 Madrimov Xudoshukur
GitHubTelegramEmail
← Blog
June 14, 2026

Monorepo architecture: one repo, many projects

MonorepoTurborepoBunArxitekturaDevOps

While building the M-Smart School platform, we decided to keep several apps (admin panel, teacher interface, mobile API, a shared UI library) in one repository. This is a monorepo — many projects in one repo. Below is why we chose this approach and how to build it, based on practice.

What is a monorepo?

A monorepo is an architecture where several independent projects (apps and libraries) live in a single version-control repository. The opposite approach — each project in its own repo — is called polyrepo.

When do you need a monorepo?

A monorepo isn't always the right choice. It shines in these cases:

  • Several apps share common code (UI components, types, utilities)
  • Frontend and backend types must stay in sync (end-to-end type safety)
  • One team develops several related projects in parallel

Structure

A typical Bun workspaces monorepo structure looks like this:

my-monorepo/
├── apps/
│   ├── admin/          # Next.js admin panel
│   ├── api/            # Bun + Hono backend
│   └── mobile-api/
├── packages/
│   ├── ui/             # umumiy React komponentlar
│   ├── types/
│   └── config/
├── package.json
└── turbo.json

Workspaces definition

In the root package.json we declare the workspaces:

{
  "name": "my-monorepo",
  "private": true,
  "workspaces": ["apps/*", "packages/*"],
  "devDependencies": { "turbo": "^2.0.0" }
}

Speeding up with Turborepo

As the monorepo grows, builds slow down. Turborepo solves this with caching and parallel execution. turbo.json defines the pipeline:

{
  "$schema": "https://turbo.build/schema.json",
  "tasks": {
    "build": { "dependsOn": ["^build"], "outputs": [".next/**", "dist/**"] },
    "dev": { "cache": false, "persistent": true }
  }
}

Practical workflow

Commands run from the root, and Turborepo figures out which packages to rebuild:

turbo dev
turbo build
turbo build --filter=admin

Pros and cons

  1. Pro: with shared types, frontend and backend never drift out of sync
  2. Pro: a change spanning several apps in one PR is atomic and consistent
  3. Con: CI/CD setup is more complex — you must deploy only the changed app
  4. Con: the repo grows, the entry barrier for newcomers is higher

Conclusion

If your projects share code and evolve together, the monorepo + Turborepo combo is powerful: type safety, atomic changes and fast builds. But be ready to pay with CI/CD complexity. For us at M-Smart School it was the right choice — but, as always, test it in your own context.