Adding an App
How to add a new Next.js app to the monorepo.
1. Copy an existing app
cp -r apps/energy apps/my-app2. Update package.json
Change the package name and port:
{
"name": "@numa/my-app",
"scripts": {
"dev": "next dev --turbopack -p 300X",
"start": "next start -p 300X"
}
}3. Update proxy.ts
Adjust the routing rules for your new platform’s needs.
4. Add root scripts
In the root package.json, add convenience scripts:
{
"scripts": {
"dev:my-app": "turbo run dev --filter=@numa/my-app",
"build:my-app": "turbo run build --filter=@numa/my-app"
}
}5. Add environment variable
Add the cross-app URL to .env.example:
NEXT_PUBLIC_MY_APP_URL=http://localhost:300XAnd update @numa/config to export the new URL if needed.
6. Install and verify
pnpm install
pnpm turbo run dev --filter=@numa/my-appApp structure checklist
Your new app should have:
| File | Purpose |
|---|---|
package.json | Dependencies and scripts |
next.config.ts | Next.js config with i18n plugin and transpilePackages |
tsconfig.json | TypeScript config extending tooling |
eslint.config.mjs | ESLint config extending shared config |
.prettierrc.mjs | Prettier config extending shared config |
postcss.config.mjs | PostCSS with Tailwind plugin |
components.json | shadcn configuration |
proxy.ts | Edge routing (locale, auth, permissions) |
app/layout.tsx | Root layout with providers |
app/error.tsx | Root error boundary |
app/i18n/request.ts | i18n re-export |
app/[lang]/layout.tsx | Locale layout |
global.d.ts | Type declarations for packages |
Port assignments
| App | Port |
|---|---|
| Gateway | 3000 |
| Energy | 3001 |
| Operations | 3002 |
| Finance | 3003 |
| Shared | 3004 |
| Docs | 3005 |
Last updated on