Setting Up a Multi-App Monorepo with GitHub Actions CI
A monorepo keeps frontend, mobile, and backend in one place — but CI must be smart to stay fast. This guide shows how to set up a multi-app monorepo with GitHub Actions using path filters and caching, the same pattern used by OllamoMUI.
1. Repo layout
Organize apps under a clear root so workflows can target them with paths filters.
repo/
frontend/ (Next.js)
mobile/ (React Native / Expo)
backend/ (FastAPI)
.github/workflows/ci.yml2. Path-filtered CI
Only run a job when files in its app changed — this keeps CI fast in a multi-app repo.
name: CI
on: [push, pull_request]
jobs:
frontend:
if: ${{ github.event_name == 'push' || contains(github.event.pull_request.changed_files, 'frontend') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: 20, cache: npm, cache-dependency-path: frontend/package-lock.json }
- run: npm ci
working-directory: frontend
- run: npm run build
working-directory: frontend3. Cache and parallelize
Use the built-in npm/pip caches keyed by lockfile, and run jobs in parallel.
For larger monorepos, adopt Turborepo or Nx to share build caches across apps.
4. Secure secrets & Dependabot
Store deploy keys in GitHub Encrypted Secrets; enable Dependabot for npm, pip, and github-actions ecosystems.
FAQ
How do I run CI only for changed apps?
Use path filters or check changed files in an `if:` condition, as shown above. For many apps, a matrix with paths is cleaner.
Should I use Turborepo or Nx?
Both work. Turborepo is lighter and pairs well with Next.js; Nx is more feature-rich. Either shares task caches across the monorepo.
Can a Dhaka developer set this up for me?
Yes. Rakibul Hasan (Rhasan@dev) configures monorepo CI/CD, GitHub Actions, and Dependabot as part of freelance/devops engagements.
Built by a Dhaka-based full-stack developer
Rakibul Hasan is a full-stack developer in Dhaka, Bangladesh (GMT+6), open to remote jobs, work-from-home, and freelance work. Available for full-stack, backend, and AI/LLM engineering.