Package Setup
Learn how Phyre lets you scale your app using zero-config monorepo packages.
Enable Multi-App Mode
To enable Phyre's automatic multi-app routing, open phyre.config.js and set:
export default { packagesStructure: true, packages: [ { name: 'web', prefix: '/' }, { name: 'admin', prefix: '/admin' } ] }
This tells Phyre to load any number of packages inside your monorepo, each mapped to a unique URL prefix. No extra configuration is required.
Your Project Structure
Once packagesStructure is enabled, create the following folder layout:
root/ └── packages/ ├── web/ │ └── src/ └── admin/ └── src/
Every package automatically becomes its own app. Just place your UI inside src/ and Phyre handles the rest.
Scaling Your App
Want to turn an existing codebase into a package?
# move your existing application src/ # into any package you want packages/ └── web/ └── src/
With this simple step, the new package is instantly mounted under its prefix and becomes a fully independent app within your monorepo.
How Routing Works
Phyre uses file-based routing inside each package:
web/ └── src/ └── client/ └── routes/ ├── index.jsx ← http://localhost:3000/ └── About.jsx ← http://localhost:3000/about admin/ └── src/ └── client/ └── routes/ ├── index.jsx ← http://localhost:3000/admin ├── Home.jsx ← http://localhost:3000/admin/home └── Users.jsx ← http://localhost:3000/admin/users
Every package has its own isolated routing tree, mounted automatically at the prefix you chose. No manual router configuration is ever needed.
Phyre also applies package prefixes to your API routes. Any file inside src/server/api automatically becomes an API endpoint, mounted under:
http://localhost:3000/api/<packagePrefix>/<apiName>
For example:
web/ └── src/ └── server/ └── api/ contact.js ← /api/contact admin/ └── src/ └── server/ └── api/ users.js ← /api/admin/users stats.js ← /api/admin/stats
No configuration is required. Phyre mounts API routes automatically based on your package prefix and file names.
Next Steps
Now that your multi-app monorepo is running, continue with:
- File-based Routing – Build pages and dynamic routes
- Layouts – Share UI across pages
- Data Loading – Fetch data server-side
- API Routes – Build your backend
