Admin panel
For Admin panel only projects, the login is /, the home page is /dashboard, and other panel pages omit the /admin prefix. Components use @/components and @/components/ui. API endpoints such as /api/admin/users/export keep their paths. Examples below use the combined public website + admin panel layout; generated standalone guides use the app’s actual paths.
Admin panel
The admin panel provides a starting point for managing your application. Select Public website + admin panel or Admin panel only in the creation wizard to include it.
Connect the database and create your first administrator before testing protected pages. Follow the authentication guide.
Open the panel
Start the application, then visit /admin and sign in with your administrator account.
| Route | What you can do |
|---|---|
/admin |
Sign in or request password recovery. |
/admin/home |
View the protected home page and account menu. |
/admin/users |
Search, filter, sort, create and edit users; export matching users to CSV. |
/admin/users/[userId] |
Open a user’s details. |
/admin/settings |
Try the general settings form. |
/admin/settings/preferences |
Try the preferences form. |
Password recovery requires Resend and a configured sender. Settings forms are examples: Preview changes updates local state. Connect authorized server operations and storage to save settings or upload files.
Reuse the page header
Use PageHeader to keep headings and toolbar actions consistent across admin pages:
import { PageHeader } from "@/components/admin/page-header";
import { Button } from "@/components/admin/ui/button";
export function ProductsHeader() {
return (
<PageHeader
title="Products"
description="Manage the products shown on your website."
actions={<Button>Add product</Button>}
/>
);
}
Connect the button to your own form, dialog or navigation. titleId is available when another element needs to reference the heading.
Extend a data table
The panel includes DataTable, DataTableSearch, DataTablePagination and useDataTableState in the admin component and hook directories.
When adding another entity:
- Reuse those controls and extend the schemas in
src/lib/table-query.ts. - Validate allowed filters and sort fields on the server.
- Authorize every query, mutation and export.
- Invalidate the relevant tRPC queries after a mutation.
The Users page is the working example. Its URL preserves search, role, sort and pagination. CSV export includes every matching user, regardless of the visible page.
See API and data for server and client patterns.
Keep static controls visible
Public and authentication pages render static controls immediately. The protected panel first waits for server authorization inside AdminGate, with a null fallback. Once authorized, render headings, form fields, filters, table headers and pagination immediately; scope skeletons to unresolved data. The cookie-only proxy redirects anonymous visitors before rendering and never replaces server authorization. See Authentication for route coverage.
Keep existing rows visible during background updates. The server must continue to authorize protected pages, APIs and actions.