Add your own module
A checklist for adding a new page to the app, such as Projects or Support tickets, so it fits in like the built-in ones: route, sidebar, shortcut, search, data and empty states.
Before you start
Pick the closest built-in module and copy its shape. Invoices is a good model for a list with a drawer, Leads for a list plus a record page, and Whiteboards for a full-screen editor. The steps below use a module called Projects at /projects.
An AI coding tool can do most of this. Ask it to "add a Projects module following Docs › Customization › Add your own module, modelled on Invoices", then check each step below.
1. The page
App screens live in the (crm) route group, so they get the sidebar, header and providers. Keep the route file small and put the screen in its own folder:
For a record page, add src/app/(crm)/projects/[id]/page.tsx and use RecordLayout, like the contract and lead pages.
2. Sidebar, header and shortcut
| File | Add |
|---|---|
src/lib/data/preferences.ts | The id to NavId, and to the group it belongs in within NAV_GROUPS (the top, Your Space, Company or Finance) |
components/shell/nav-meta.ts | A label and Lucide icon in NAV_META, and a G-then shortcut in NAV_KEYS that isn't taken |
components/shell/sidebar.tsx | Nothing, unless it needs a count badge: add it to badges. Pages render from their group and are active when the path starts with /projects |
components/shell/app-header.tsx | A view in View, a line in viewFromPath, and the title and buttons for that view |
People who saved their own sidebar get new pages added to the same group, next to the page before them (loadSidebar in preferences.ts), so nobody has to reset their sidebar. Settings › Sidebar picks up the new page in its group by itself.
3. Search
In components/search/command-palette.tsx, add the page to the pages list with a few search words, a "New project" action if there is one, and a scope with results if people should find individual projects with ⌘K.
4. The data
- Types and sample records in
src/lib/data/projects.ts. Base dates onDEMO_TODAYso the sample data never looks stale. - A provider in
src/components/providers/projects-provider.tsxthat holds the records and offers actions (create, update, remove and restore for Undo), with auseProjects()hook. Screens read and change data only through it; that's what lets you connect a backend later by changing one file. - Mount it in
components/providers/crm-providers.tsx, below every provider it reads from. If Rune or workflows should know about projects, it must sit aboveWorkflowsProviderandChatProvider.
5. Views and drawers
- Tables:
DataTablewith saved views fromuseSavedViews("projects", defaults), so Edit View, columns, filters and CSV export work like everywhere else. - Drawers:
SideDrawerwithresizable, which also keeps only one drawer open at a time. A custom drawer must calluseExclusiveDrawer. - Empty states:
EmptyStatewith an illustration fromcomponents/empty/illustrations.tsx, never a blank table. - Actions: confirm with a toast (
useToast()), with Undo for anything destructive.
6. Connect it to the rest
- Customers: a tab or a Details block on the customer page if projects belong to a customer.
- Links: a case in
RecordLinkso other screens can link to a project. - Rune: a rule-based answer file like
src/lib/lead-ai.ts, checked increateAssistantReplyinsrc/lib/chat.ts, or a tool for a real model (see AI models). - Dashboard: a card (see Dashboards and charts).
Check it
Then open the page in light and dark mode, at phone width, with the sidebar collapsed, and with Modern and Classic layouts. Check the G-then shortcut, ⌘K, an empty state, and that Undo brings a removed record back.