Welcome to the Midhah Frontend Monorepo . This repository utilizes a modern, enterprise-grade architecture powered by Turborepo and pnpm Workspaces .
It contains two separate Next.js applications (Web and Admin ) that safely share utilities, global types, and API logic while maintaining strict dependency boundaries.
| Technology | Description |
|---|---|
| Framework | Next.js 16 (App Router, Turbopack) |
| Package Manager | pnpm v11+ |
| Monorepo Tool | Turborepo |
| Language | TypeScript 6.0.3 (Strict Mode) |
| Styling | Tailwind CSS v4 |
| Linting | ESLint 9 (Flat Config) & Prettier |
| State Management | Zustand |
| Backend/Auth | Firebase |
| Data Fetching | Axios & React Query |
midhah/
├── apps/
│ ├── admin/ # Next.js Admin Dashboard (Port 3000)
│ └── web/ # Next.js Public App (Port 3001)
│
├── packages/
│ └── utils/ # Shared logic (Zustand, Firebase, Axios, Fonts, global.d.ts)
│
├── pnpm-workspace.yaml # Workspace boundaries & package catalog
├── eslint.config.mjs # Global ESLint Flat Config
├── tsconfig.base.json # Shared TypeScript configuration
└── turbo.json # Turborepo pipeline configuration
Ensure the following are installed:
- Node.js v20+
- pnpm v11+
Install pnpm globally if needed:
npm install -g pnpmInstall all workspace dependencies from the repository root:
pnpm installNote: Do not use
npm installin this monorepo.
Create a .env.local file inside both applications:
apps/web/.env.local
apps/admin/.env.local
Add your:
- Firebase configuration
- API URLs
- Next.js environment variables
- Any application-specific secrets
Run both applications simultaneously:
pnpm dev| App | URL |
|---|---|
| Admin Dashboard | http://localhost:3000 |
| Web Application | http://localhost:3001 |
Run all commands from the root directory.
| Command | Description |
|---|---|
pnpm dev |
Start development servers |
pnpm build |
Build all applications |
pnpm lint |
Run ESLint across workspace |
pnpm type-check |
Run strict TypeScript checks |
Use --filter to run commands for a specific workspace.
pnpm --filter @midhah/web dev
pnpm --filter @midhah/web build
pnpm --filter @midhah/web lintpnpm --filter @midhah/admin dev
pnpm --filter @midhah/admin build
pnpm --filter @midhah/admin lintpnpm --filter @midhah/utils type-checkThis monorepo follows strict dependency ownership rules.
Applications cannot rely on dependencies installed elsewhere in the workspace.
Core package versions are maintained in the catalog section of:
pnpm-workspace.yamlExamples:
- React
- Next.js
- TypeScript
- Tailwind CSS
After updating versions:
pnpm installAlways install packages directly into the workspace that uses them.
pnpm --filter @midhah/web add lucide-react @radix-ui/react-dialogpnpm --filter @midhah/admin add react-hook-formAll shared TypeScript logic lives inside:
packages/utils
Global browser types are declared in:
packages/utils/src/global.d.ts
Examples:
window.gtag;
window.adsbygoogle;
window.googletag;To make Next.js aware of these types, include the file in each application's tsconfig.json.
{
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
"../../packages/utils/src/global.d.ts"
]
}Module not found: Can't resolve 'package-name'
Phantom dependency.
The package is imported but not declared in the application's package.json.
pnpm --filter @midhah/<app-name> add <package-name>This repository is optimized for deployment on Vercel.
- Open Vercel Dashboard
- Click Add New → Project
- Import this repository
apps/web
apps/admin
Configure all required variables inside the Vercel project settings.
Click Deploy .
Vercel will automatically:
- Detect
pnpm-lock.yaml - Install workspace dependencies
- Execute Turborepo builds
- Cache build artifacts efficiently
- Always run commands from the repository root.
- Never use
npm install. - Keep shared logic inside
packages/utils. - Install dependencies only in the workspace that uses them.
- Update shared framework versions through the pnpm catalog.
- Run
pnpm type-checkbefore creating pull requests. - Run
pnpm lintbefore committing code.