The built-in mock API
How the dashboard runs with no back-end on sample data kept in the browser, what works there, and how to switch it to your API or remove it.
For the Full Stack package
What it is
The dashboard carries a small server of its own that runs in the browser. It answers every request the dashboard makes, with the same answers, status codes and permission checks as the NestJS API, so every screen works with no back-end at all. It is what the Admin Dashboard package runs on out of the box, and what the Full Stack's dashboard falls back to when no API address is set.
A "Sample data" notice sits at the bottom of every page while it answers, so nobody mistakes it for a connected back-end.
Turning it on and off
There is no flag. One setting decides, NEXT_PUBLIC_API_BASE_URL, compiled in when the dashboard is built:
# empty or missing: the mock API, no back-end needed
NEXT_PUBLIC_API_BASE_URL=
# set: your API, the mock never runs
NEXT_PUBLIC_API_BASE_URL=http://localhost:8000/api- Without Docker, the dashboard with no
.envfile runs on the mock. Restartyarn dev, or runyarn buildagain, after changing the value. - A Docker image built with no
--build-argruns on the mock. Docker Compose always builds the dashboard with the API's address. - When a browser that used the mock is pointed at a real API, the dashboard drops the sample session and data it kept, so the first request is not made with a token the API would refuse.
What works on it
| Area | On the mock API |
|---|---|
| Sign-in | The sample accounts: admin@example.com with Admin@123 (Super Admin), and the sample Viewers such as john.smith@admin.com with admin123. A wrong password is refused, as on the API. |
| Data | The API's own sample data: 12 admins, 5 roles and 25 permissions, 15 users and 12 deleted ones, 15 projects and 12 deleted ones, the Super Admin's 10 tasks, 13 app settings and 50 countries, plus three earlier assistant conversations. |
| Changes | Real: creating, editing, deleting, restoring, granting a permission and renaming a role all change the data and survive a reload, in that browser only. |
| Permissions | Checked from the signed-in admin's roles and refused as the API refuses them, so a Viewer sees exactly what a read-only account sees. |
| Pictures | An uploaded picture is kept in the browser and shows; nothing leaves it. |
| AI assistant | One model, Aniq Demo, with scripted answers built from the current data: figures, cards, lists and a chart. No provider, no key. |
Every answer is delayed a fraction of a second on purpose, so the loading states the dashboard ships with are seen.
Start over
Clear the site's data for the dashboard's address in your browser's settings, or run this in the browser's console, and the samples come back as they shipped:
localStorage.removeItem("mock_db_v1"); location.reload();Remove it
Once you run on your own API for good, delete the mock from the code, in the dashboard's folder:
yarn remove:mockIt deletes src/lib/mock/ and the sample data notice, and strips the blocks marked #region mock-api. The dashboard then needs NEXT_PUBLIC_API_BASE_URL set. It rewrites files and cannot be undone without version control, so commit first.
How it is built
Included with your purchase. Sign in to read, or open it in your download.
Where the mock lives, how a request reaches it, and adding a route of your own.