# Build your own admin

Run your customers, orders and bookings from admin pages of your own, on your own domain, or from your own server.

Page Lemon has three places. Only the second and third are yours:

- **Page Lemon's admin** is ours. You never use it.
- **Your Dashboard** at `dash.pagelemon.com` runs everything: sites, people, groups, payments and refunds.
- **Your own admin pages**, for example `admin.example.com`, open only for your team. Each person sees what their group allows.

## Say this to your AI

```prompt
Build our own admin on PageLemon.com: my team should see our customers, orders and bookings
```

To run it from your own server instead:

```prompt
Set up a webhook so my server hears about every paid order and every new booking
```

## What your AI will ask you

- Which things your team manages: users, orders, bookings, memberships.
- Which teammates, and what each may do: only look, or also change.
- The address for the pages, such as `admin.example.com`.
- Whether you want admin pages from Page Lemon or your own server.

## What to have ready

- A workspace, with your teammates already in it. They sign in with the login they use for Page Lemon.
- A domain you control, for the admin address. Your AI shows the DNS records to add at your domain host.
- For your own server: the address that should receive events.

## Two ways

**Admin pages.** Your AI starts from the Team admin template: Users, Orders and Bookings pages.

1. Your teammates sign in on your admin address with their Page Lemon account (team sign-in). No one sets another password.
2. You give each group ticks: View, Edit or Remove users; View or Manage orders; View or Manage bookings; View memberships. Editing needs viewing.
3. Each person sees only the pages and buttons their ticks allow, and the server checks every action again.
4. A teammate who asks for a refund starts a request. It waits until the Workspace Owner approves or declines it in the Dashboard.
5. Only the Workspace Owner or an Admin sets the ticks and changes who is in a ticked group.

**Your own server.** Your server talks to Page Lemon, and Page Lemon tells it what happens.

- **A key** with the smallest scope that does the job. Keep it on your server, never in a web page, an app or a browser: anyone who opens the page could read it. Pages that run in a browser use the team sign-in instead.
- **Webhooks:** Page Lemon sends your server an event for each thing below. Your server answers once per event, even if one arrives twice or late.
- A key stops working when its person leaves the workspace. Make a new one under someone who stays.

| Event | When |
|---|---|
| `user.joined`, `user.removed`, `user.paused`, `user.resumed`, `user.deleted` | A user of your site joins, leaves, is paused, comes back or deletes their account |
| `order.paid`, `order.refunded`, `order.fulfilled` | An order is paid, refunded or marked sent |
| `refund.requested`, `refund.approved`, `refund.declined` | A refund is asked for, approved or declined |
| `booking.created`, `booking.changed`, `booking.cancelled` | A booking is made, changed or cancelled |
| `membership.started`, `membership.ended` | A paid membership starts or ends |

Teammates never produce user events. Events from a test payment or test user are marked as tests.

## Pausing a user

Pause a user to stop them signing in without deleting anything. Their sessions end at once, and they see that their access is paused when they try again. Their records, orders, bookings and memberships stay, and a paid membership keeps billing: cancel it separately if you want it to stop. Resume them to let them back. Teammates are removed in the Dashboard, never paused.

## Publishing and your admin

On a site with admin ticks, only the Workspace Owner or an Admin can publish or roll back HTML or scripts. Other people are refused, and there is no approval step yet: ask an Owner or Admin to publish.

> **Plans:** admin pages and webhooks depend on your plan. [See pricing](/pricing)

## Good to know

- Your admin pages hold no key and no secret.
- A teammate removed from the workspace loses their admin access at once.
- Test it on a [staging copy](/docs/staging): ask your AI to try each group and say what it sees.

Stuck? Ask your AI first, then see [Fix a problem](/docs/fix-a-problem). Write to support only if those don't help.

For AI assistants: the setup guide is at [pagelemon.com/agents/blocks](https://pagelemon.com/agents/blocks).
