# Admin Panel

Overview of the Nextly admin panel, including navigation, default permissions, and how to access it.

Nextly ships with a full-featured admin panel for managing your collections, singles, media library, users, and settings without leaving the browser. It is mounted at `/admin` and is rendered by the same Next.js app that exports the Nextly route handlers, so there is no separate service to deploy.

## Accessing the admin panel

The first time you visit `/admin` and the database has no users, Nextly redirects you to a setup wizard at `/admin/setup` to create the initial Super Admin account. After that, sign in at `/admin/login`.

```
https://your-app.com/admin
```

Authentication is custom (email + password, JWT-backed sessions, API keys, RBAC) — see [Authentication](https://nextlyhq.com/docs/guides/authentication.md) for the full reference.

## Navigation structure

The admin uses a dual-sidebar layout on desktop. A narrow icon strip on the far left lists the top-level sections; clicking one reveals a wider inner sidebar with the items inside that section. On screens narrower than 1024px the layout switches to a single hamburger drawer automatically — no configuration required.

The top-level sections (in order) are:

| Section       | Route                        | What it contains                                                                                                                                      |
| ------------- | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| Dashboard     | `/admin`                     | Landing page after login                                                                                                                              |
| Builder       | `/admin/builder/collections` | Schema management for Collections / Singles / Components — the [Visual Schema Builder](https://nextlyhq.com/docs/schema-builder.md)                   |
| Collections   | `/admin/collections/[slug]`  | Per-collection content surface; the icon appears in the sidebar once at least one collection exists and lands on the most-recently-created collection |
| Singles       | `/admin/singles/[slug]`      | Per-single content surface; same dynamic visibility rule as Collections                                                                               |
| Media Library | `/admin/media`               | Upload, browse, and edit files referenced by `upload` fields                                                                                          |
| Plugins       | `/admin/plugins`             | Only visible when at least one plugin is installed and registers admin pages                                                                          |
| Users         | `/admin/users`               | Users, Roles, Custom user fields                                                                                                                      |
| Settings      | `/admin/settings`            | General, API keys, Email providers, Email templates, Email layout, Image sizes                                                                        |

Collection and Single icons are added to the primary sidebar dynamically as you register collections / singles in `nextly.config.ts` (or create them via the Visual Schema Builder). The Builder icon is always present but can be hidden in production; see [Schema Builder visibility](https://nextlyhq.com/docs/admin/branding.md#schema-builder-visibility) for the `admin.branding.showBuilder` toggle.

## What you can do in each section

### Content management

Every collection registered in `nextly.config.ts` gets a list view with filtering, sorting, pagination, and search. Click an entry to open the editing form; inputs are rendered field-type-aware (rich-text editor for `richText`, date picker for `date`, file picker for `upload`, related-document picker for `relationship`, and so on).

Singles render a single editing form at `/admin/singles/[slug]` instead of a list view, since each Single has exactly one document.

### Media Library

A central media library at `/admin/media` supports drag-and-drop uploads, thumbnails, and file metadata editing. `upload` fields across all collections reference this library; uploading from inside an `upload` field writes to the same store. The default backend writes to `./public/uploads/` on local disk; configure a different storage adapter in `nextly.config.ts` to use S3, Vercel Blob, or UploadThing.

### Visual Schema Builder

The Visual Schema Builder lets you create and edit Collections, Singles, and Field Groups without writing TypeScript. It generates the same artifacts the code-first approach produces. See [Visual Schema Builder](https://nextlyhq.com/docs/schema-builder.md) for the full reference.

### Users, Roles, and Custom Fields

The Users section groups three pages:

* **Users** (`/admin/users`) — list, create, edit, and disable user accounts.
* **Roles** (`/admin/security/roles`) — create roles and assign permissions to them. The setup wizard seeds a `Super Admin` role that holds every permission and assigns it to the first user.
* **Custom Fields** (`/admin/users/fields`) — add extra fields to the user model. Only scalar field types are accepted on user records; see the [`users` reference](https://nextlyhq.com/docs/configuration/nextly-config.md#users) in `nextly.config.ts`.

### Settings

The Settings inner sidebar is split into sub-groups:

* **System.** General (site-wide settings) and API Keys.
* **Email.** Email Providers (Resend, SMTP, etc.), Email Templates, and Email Layout.

Image-size presets and the (programmatic) Permissions page also live under settings.

## Permissions

Nextly's RBAC model uses permission slugs in the form `<action>-<resource>` (e.g. `read-users`, `create-roles`, `update-api-keys`, `manage-settings`). Permissions and the `Super Admin` role are seeded the first time the database is set up — for the core resources (`users`, `roles`, `permissions`) the seeder creates one row per `(action, resource)` pair across `create`, `read`, `update`, `delete`. See [`packages/nextly/src/database/seeders/permissions.ts`](https://github.com/nextlyhq/nextly/blob/main/packages/nextly/src/database/seeders/permissions.ts) for the seeder source.

The admin sidebar is permission-gated. The built-in mapping is:

| Sidebar item                                            | Required permission                              |
| ------------------------------------------------------- | ------------------------------------------------ |
| Dashboard                                               | Always visible                                   |
| Collections list / entries                              | Per-collection read permissions                  |
| Singles list / entries                                  | Per-Single read permissions                      |
| Media Library                                           | `read-media`                                     |
| Users                                                   | `read-users`                                     |
| Roles                                                   | `read-roles`                                     |
| Custom Fields                                           | `manage-settings`                                |
| General settings                                        | `manage-settings`                                |
| API Keys                                                | `update-api-keys`                                |
| Email Providers / Templates / Layout                    | `manage-settings`                                |
| Plugins overview                                        | `manage-settings`                                |
| Builders (Collections / Singles / Field Groups Builder) | Gated by the `admin.branding.showBuilder` toggle |

Permissions for collections you define in `nextly.config.ts` follow the same slug pattern (`read-posts`, `update-posts`, etc.); they are wired up automatically when the collection is registered. Assign permissions to roles from `/admin/security/roles`.

## Plugins in the admin

A plugin can register sidebar entries via its `admin.placement` setting. Until at least one plugin is installed, the Plugins section is hidden. When a plugin does add entries, they appear under the section the plugin chose (Collections, Singles, Users, Settings, Plugins, or Standalone). You can override the placement and appearance per-plugin from `admin.pluginOverrides` in `nextly.config.ts`; see [Customization](https://nextlyhq.com/docs/admin/customization.md#plugin-overrides).

## Next steps

* [Visual Schema Builder](https://nextlyhq.com/docs/schema-builder.md) — design content types without writing code
* [Customization](https://nextlyhq.com/docs/admin/customization.md) — sidebar config, navigation permissions, plugin overrides
* [Branding](https://nextlyhq.com/docs/admin/branding.md) — logo, favicon, color scheme, Builder visibility
* [Collections](https://nextlyhq.com/docs/configuration/collections.md) — code-first collection definitions
* [Singles](https://nextlyhq.com/docs/configuration/singles.md) — code-first Single definitions
