Customization/Add your own module

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:

src/app/(crm)/projects/page.tsx
import type { Metadata } from "next"
import { ProjectsView } from "@/components/projects/projects-view"

export const metadata: Metadata = { title: "Projects" }

export default function ProjectsPage() {
  return <ProjectsView />
}

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

FileAdd
src/lib/data/preferences.tsThe id to NavId, and to the group it belongs in within NAV_GROUPS (the top, Your Space, Company or Finance)
components/shell/nav-meta.tsA label and Lucide icon in NAV_META, and a G-then shortcut in NAV_KEYS that isn't taken
components/shell/sidebar.tsxNothing, 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.tsxA 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.

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 on DEMO_TODAY so the sample data never looks stale.
  • A provider in src/components/providers/projects-provider.tsx that holds the records and offers actions (create, update, remove and restore for Undo), with a useProjects() 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 above WorkflowsProvider and ChatProvider.

5. Views and drawers

  • Tables: DataTable with saved views from useSavedViews("projects", defaults), so Edit View, columns, filters and CSV export work like everywhere else.
  • Drawers: SideDrawer with resizable, which also keeps only one drawer open at a time. A custom drawer must call useExclusiveDrawer.
  • Empty states: EmptyState with an illustration from components/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 RecordLink so other screens can link to a project.
  • Rune: a rule-based answer file like src/lib/lead-ai.ts, checked in createAssistantReply in src/lib/chat.ts, or a tool for a real model (see AI models).
  • Dashboard: a card (see Dashboards and charts).

Check it

npm run lint && npm run typecheck && npm run build

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.