Scale your remix app with modules.
Warning
This is a experimental package, use at your own risk.
A module is a remix app that can be mounted into another remix app.
.
├── modules
│ └── order <=== this is a module
│ ├── routes
│ └── root.tsx
├── routes
└── root.tsx
npm install remix-modules
Update your remix.config.js file and use the custom routes config option.
import { defineConfig } from 'vite';
import { vitePlugin as remix } from '@remix-run/dev';
import { remixModules } from 'remix-modules';
export default defineConfig(() => {
return {
plugins: [remix(
routes: async () => {
const modules = remixModules();
await modules.mount('modules/order', {
at: '/orders', // mount the order module at /orders
layout: 'routes/_admin' // use _admin as layout
});
return modules.routes();
}
)]
}
});
See the example for a more detailed example.