Pre-built code blocks

Admin panel with a real login

Admin shell + real auth gate

For when the answer to “An admin back office to manage it” is yes.

Sidebar, tabs, CRUD tables, toast — with server-side auth and render-time escaping baked in, so the two things every hand-rolled admin gets wrong are impossible by construction.

Built by hand again in 14 of 20 audited projects before this existed. Each rebuild was another chance to make the mistake below.

A control desk of switches and stacked rows standing behind a closed gate, with the padlock hanging on the desk side of the gate rather than the visitor side

Skip the rebuild

You do not write this one. It arrives in your project as ordinary source you can read, change and keep, with its audit record and its caveats beside it.

  1. Download the Playground. It is free and runs on your own machine.
  2. Start a new app and tick “An admin back office to manage it”.
  3. This block is written in, along with anything else you ticked.

Download the Playground See the other blocks

The mistake it removes

Rebuilt in ~14/20 projects and flagged every time. Vibe Coder: '/admin is guarded only by robots noindex… the URL is guessable' and 'descriptions are trusted HTML at render time'. Coaching App: 'access tiers are cosmetic, not enforced'.

What the audit found

Named rather than summarized. The reasoning behind each one ships inside the block, so it travels with the code instead of living on a page you have to trust.

What you still have to do

A copied file cannot own your secrets, your host or your legal obligations. This is the part the block deliberately does not claim.

What lands in your project

node

  • node/admin-auth.js

The gate. scrypt password hashing, HMAC-signed expiring tokens, timing-safe compares. Zero dependencies (node:crypto). Wrap every mutating handler in requireAdmin(req,res).

vanilla

  • vanilla/admin-shell.js

The UI. Never decides auth (the server does) and never assigns data to innerHTML — every cell is textContent, so escaping is structural, not dependent on the write path.

What you supply

Licensed MIT. It is a starting point, not a finished product.

Get it

Download the Playground See the other blocks

Nothing here is locked. The files are yours, in your folder, under a permissive license.

Questions

Is Admin panel with a real login audited?
Yes. A full due-diligence audit was run on 2026-07-17 and the verdict was a pass.
What do I still have to do myself?
Serve /admin over HTTPS only and put ADMIN_SECRET and ADMIN_PASSWORD_HASH in your host's secret store (Vercel/Netlify/Fly environment, or a secrets manager). The block enforces the auth check and escapes at render time; it cannot supply the transport or the credential, and a guessable secret defeats both.
How do I get this code?
Download the Playground, start a new app, and tick “An admin back office to manage it”. The block is written into your project as ordinary source you can read and edit.

All pre-built code blocks · Learn to build from zero · The coding guide