API REFERENCE

Define Routes Group

defineRoutesGroup() is an utility function that allows you to create a routes group by attaching pages under a same path.


Imagine you have multiple pages that share the same path, you can use this function to group them together.

Usage

admin.group.ts
tsximport { defineRoutesGroup } from "rasengan"; import Dashboard from "@/app/admin/dashboard.page"; import Users from "@/app/admin/users.page"; import Settings from "@/app/admin/settings.page"; import Profile from "@/app/admin/profile.page"; export default defineRoutesGroup({ path: "/admin", children: [ Dashboard, Users, Settings, Profile, ] });

As you can see, all the pages are grouped under the same path. This group can be easily imported in your router.

app.router.ts
tsximport { RouterComponent, defineRouter } from "rasengan"; import AdminGroup from "@/app/admin.group"; class AppRouter extends RouterComponent {} export default defineRouter({ pages: [AdminGroup], })(AppRouter);

Options

defineRoutesGroup() accepts an object with the following properties:

OptionTypeDescriptionOptional
pathstringThe path of the routes groupNo
childrenPageComponent[] | MDXPageComponent[]The pages to be grouped under the same pathNo
defineRoutesGroup
renderApp

Subscribe to the Newsletter

Stay informed to the news about rasengan.js including new releases, events, etc...

© 2025 Rasengan Labs, All rights reserved.