Sample data and demo mode
How the Closeline website and dashboard run with no API on built-in sample data, how to switch to your API, and how to remove the sample data and demo mode.
For the Full Stack package
What the sample data is
Each frontend carries its own answers for the requests it makes, exported from the seeded API into src/lib/mock/. With no API address, it runs on them with no API at all, and a "Sample data" notice on every page says so.
NEXT_PUBLIC_API_BASE_URL | What the app does |
|---|---|
Empty, or no .env at all | Runs on the sample data. No request goes to an API. |
Set, as in .env.example | Uses that API. If it cannot be reached at all (not running, or its CORS_ORIGIN does not list this app), the sample data stands in until it answers again. |
The stand-in is for an API that stopped answering, not for an app with no API: the browser keeps trying the address and logs each refused request in its console, so leave the address empty when there is no API.
The dashboard on its sample data
- The whole sample workspace Studio Sales, with its fixed clock: the pipeline of 12 open and 50 closed deals, companies and contacts, activities, notes and files, reports, projects and tasks, the team, invitations, the roles matrix, billing and invoices, notifications, the assistant's sample conversations, and the installation's users pages.
- Any password signs in.
demo@closeline.example,manager@closeline.exampleandmember@closeline.exampleopen Lena Stone (Admin), Alex Kim (Manager) and Mina Noor (Member), so each role's limits can be tried; any other email opens Lena Stone's account. Sign-up creates a new account and its trial workspace. - What you change (a deal moved, a contact, an activity, a note, an invitation, a role's grants, a plan bought through the test checkout) is kept in that browser's storage and is still there after a reload. Clearing the site's data starts over.
- Every plan is paid for in the built-in test checkout, and each invoice downloads as a PDF made in the browser.
- Each plan includes what it includes on the API. Studio Sales is on Team, so it shows the forecast, the assistant and an editable role matrix, and a notice that custom roles are on the Scale plan takes the place of New role; a workspace signed up on Starter meets the plan notices. A plan bought in the test checkout brings its features at once.
- The assistant needs the API to answer, and says so; its sample conversations and their proposal still show, and confirming the proposal adds the activity.
- No email is sent, and nothing arrives live: the bell shows the notifications already in the sample.
- With an address set and that API not answering, the dashboard tries it again every 30 seconds and returns to it once it answers.
The website on its sample data
The website makes one request, the contact form. On the sample data the form is checked as the API checks it and answered in the browser ("Message saved in your demo session."), and messages stay in that browser, so nothing is sent anywhere.
With an address set and that API not answering, the sample data stands in, in the browser. The notice says so in yarn dev, and in a production build only when it is built with NEXT_PUBLIC_SAMPLE_DATA_NOTICE=always.
Switch between the sample data and your API
| To | Without Docker | With Docker |
|---|---|---|
| Run on the sample data | Start with no .env, or set NEXT_PUBLIC_API_BASE_URL= (empty) in .env, then restart yarn dev or build again | Build with --build-arg NEXT_PUBLIC_API_BASE_URL= |
| Use your API | Set NEXT_PUBLIC_API_BASE_URL to its address with /api, such as http://localhost:8000/api, then restart yarn dev or build again | Build without that argument (the default is http://localhost:8000/api), or with your API's address |
The address is compiled in, so a change needs a restart or a new build. The API must also list the app's address in its CORS_ORIGIN.
Remove the sample data
Once the app runs on your own API, take the sample data out, in the app's folder:
yarn remove:mock- It deletes
src/lib/mock/and the "Sample data" notice, and every block of code, setting and guide passage marked for the sample data, and leavesremove:mockas a one-line note that the sample data is gone. In the full package it also updates the rootQUICKSTART.mdandREADME.mdonce both frontends have run it. yarn remove:mock --dry-runlists the changes without making them. Runyarn typecheckandyarn buildafterwards.- It does not depend on
yarn remove:demo, and works before or after it.
Commit first
It deletes code and cannot be undone without version control.
Export the sample data again
After a change to the API's seed, write both frontends' sample data again from the API's answers. In back-end, build once (the website's contact limits are read from dist/), seed and start the API:
back-endyarn build
yarn seed
yarn devThen, in a second terminal in the same folder:
back-endyarn export:mockIt signs in as each seeded account on http://localhost:8000 (or the address after --api) and writes ../dashboard/src/lib/mock/db/seed/closeline.json and ../website/src/lib/mock/db/seed/closeline.json. Nothing is written to the database.
How the sample data is built
Included with your purchase. Sign in to read, or open it in your download.
How the dashboard answers its requests in the browser, where it keeps your changes, and how a new export replaces them.
Demo mode
The template also has a demo mode, used only to show it publicly, where every visitor gets a throwaway account and a workspace of their own. It is off in every .env.example, every Dockerfile and docker-compose.yml, so your installation never runs it. Leave it off.
To delete it from the code, run this in each app's folder:
yarn remove:demoIt deletes demo mode from the code, the guides and the Dockerfile, and in the full package from docker-compose.yml and the root QUICKSTART.md too. It rewrites files and cannot be undone without version control, so commit first.
How demo mode works
Included with your purchase. Sign in to read, or open it in your download.
Running a public demo: per-visitor accounts and workspaces, what visitors can change, and the assistant's free messages.