How to Build an Admin Panel
An admin panel is the back office of your app. It needs three things done properly: tables you can search, roles the server enforces, and a log of every change.

Key takeaways
- Hiding an admin page in the menu is not security. Every admin action must be checked on the server, by role, every time.
- Build the audit log before the first edit button. You cannot reconstruct who changed a record after the fact.
- Prefer reversible actions: suspend instead of delete, refund with a reason, soft-delete with a restore button.
An admin panel is a private section of your app where staff look up users and records, fix problems and take actions customers cannot, such as refunding an order, banning a spammer or editing a listing. To build one, give staff a role that the server checks on every request, build searchable tables for the few records support touches most, put each action behind a confirmation, and write every change to an audit log. Most of the effort is not the screens, it is making sure only the right people can use them and that every action leaves a trail.
List what admins actually do
Before designing anything, write down the ten requests your team handles most. For a typical app it looks something like this: find a user by email, see their recent orders or bookings, resend a confirmation email, change an email address, issue a refund, hide a post someone reported, suspend an account, adjust a credit balance, export a list for accounting. That list is your panel. Each line becomes either a column in a table, a button on a detail page or a filter.
Notice that almost none of these is "edit any field of any table". A generic spreadsheet over your database feels powerful and is dangerous: one mistyped price or status silently breaks something. Purpose-built actions with validation are slower to build and far safer.
Roles the server enforces
Start with two or three roles and resist inventing more until you need them:
- Admin: everything, including managing other staff and destructive actions.
- Support: look up users and records, resend emails, issue small refunds, suspend accounts. No role changes, no bulk exports.
- Viewer: read only, for a bookkeeper or an investor who wants numbers without buttons.
Store the role where the server can trust it, not in a field the user can edit. On Startbase Cloud, the Users section lets you switch a user between Member and Admin, stored in the user's app metadata for your app to check. For finer roles, keep a staff_roles table that only admins can write to. Then enforce the role in two places: row level security policies on the tables, and a check at the top of every server function that performs an admin action. Hiding the Admin link from non-admins is good manners, but it protects nothing on its own.
The tables an admin panel adds
Your app's own tables (users, orders, posts) stay as they are. The panel adds a few of its own:
- staff_roles: user id, role, granted by, granted at.
- audit_log: who (actor id), what (action name such as refund_issued or account_suspended), which record (table and id), before and after values for the changed fields, a free-text reason, and the time. Insert-only: no one, including admins, can update or delete rows.
- admin_notes: notes staff leave on a customer or record ("called on Tuesday, promised a refund"), with author and time.
- status columns on existing tables: suspended_at and suspension_reason on users, hidden_at on posts, deleted_at for soft deletes.
The audit log is best written by the same server function that performs the action, in the same transaction, so an action cannot happen without its log line. A database trigger on sensitive tables is a good backstop for changes made outside the panel.
The screens of a first version
Search and list views
One global search box that finds a user by email, name or id, and an order or record by its reference, covers most support work. Below it, a list view per important table with the columns support needs at a glance, filters for the common questions (status, date range, plan) and server-side pagination. Never load every row into the browser; a panel that works with 200 users will freeze at 50,000.
Detail pages
A user detail page is the heart of the panel: profile, account status, recent activity, related records (orders, bookings, posts), staff notes and the actions available for this user. Show the audit history of this record at the bottom, so anyone can see that a refund was already issued yesterday.
Actions with confirmations
Each action opens a small dialog that states what will happen in plain words, asks for a reason where it matters (refunds, suspensions, balance changes) and requires typing the account email for anything irreversible. Prefer reversible versions: suspend rather than delete, hide rather than remove, and soft delete with a restore button.
Overview
A landing page with a few counts (signups today, open reports, failed payments) and a queue of things that need a human, such as reported posts or stuck orders. Keep it short; a full analytics view is a separate project.
The hard parts
- Impersonation. "Log in as this user" is the most requested and most dangerous admin feature. If you add it later, make it read-only, time-limited, clearly bannered and logged. Leave it out of version one.
- Bulk actions. Selecting 500 users and changing their plan is how outages happen. Require a preview of affected rows and a typed confirmation, and log one entry per row.
- Personal data. Staff do not need to see everything. Mask payment details and hide sensitive fields from roles that do not need them. Exports of customer data should be admin-only and logged.
- Money. Refunds and credits go through your payment provider and your own records in one function, with the reason saved. Never let the panel edit a balance column directly.
- Time zones. Show times in the staff member's zone with the zone label; store everything in UTC.
Inside the app or separate?
For a small product, put the panel at /admin inside the same app, sharing its sign-in and database. It is the least to maintain, and roles plus row level security keep it safe. A separate app makes sense when the admin side grows large, when staff use a different sign-in policy, or when you want the admin code out of the bundle customers download. Either way, while you build, Startbase's own Backend tab is your personal back office: its table browser lets you filter, edit and export rows directly. That is fine for you, the builder. Your support staff should get the safer purpose-built panel instead. The app security checklist lists what to check before staff get access.
A brief to paste into Startbase
Add an admin panel at /admin to my app. Roles: admin and support, checked on the server for every admin action and enforced with row level security; non-staff get a 404. Screens: an overview with signups today, open reports and failed payments; a global search by email, name or order number; a users list with filters for status and plan; a user detail page with profile, recent orders, staff notes and audit history. Actions: resend confirmation email, suspend and unsuspend with a required reason, issue a refund through Stripe with a reason (support up to $50, admin any amount). Every action writes to an insert-only audit_log table in the same transaction, with actor, action, record, before and after values, reason and time. No hard deletes.
Our custom CRM guide covers the customer-facing records many admin panels end up managing, and internal tools has more back-office examples. Before sharing the panel with staff, run the security check and read every finding about tables without row level security.
Leave these for later
- Impersonation and "log in as".
- A generic editor for every table and column.
- Custom role builders with per-permission checkboxes.
- Charts beyond a few counts on the overview.
- Two-person approval for large refunds, until the amounts justify it.
Frequently asked questions
How do I secure an admin panel?
Check the user's role on the server for every admin request and in the database with row level security, store roles where users cannot edit them, and log every action. Hiding the page or the menu link is not security.
Should the admin panel be a separate app?
Not at first. A protected /admin section inside your app shares sign-in and data and is easier to maintain. Split it out when the admin side grows large or needs a different sign-in policy.
What should an audit log record?
Who acted, what action, which record, the values before and after, the reason and the time. Make the table insert-only so nobody can quietly edit history.
Can I use a database tool instead of building an admin panel?
For yourself, yes: a table browser is fine for the builder. For support staff, a purpose-built panel with validated actions, confirmations and logging is far safer than raw table editing.
