Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/FerchoSG/healthcare-web/llms.txt

Use this file to discover all available pages before exploring further.

CitaBox is a Next.js 16 application. Before running it locally or deploying it to production, you need to configure one environment variable that tells the frontend where the CitaBox backend API is running. All other application configuration — authentication tokens, the active clinic, and theme preference — is handled automatically at runtime using localStorage.

Environment variables

CitaBox reads a single public environment variable at build time and runtime:
NEXT_PUBLIC_API_URL=http://localhost:3001
NEXT_PUBLIC_API_URL must point to a running CitaBox backend instance. If the variable is not set, the frontend defaults to http://localhost:3001. This default works for local development but will cause all API calls to fail in a deployed environment where the backend runs on a different host.

Runtime storage

CitaBox stores session and preference data in the browser’s localStorage under the following keys. These are managed automatically by the application and do not require manual configuration.
KeyPurpose
access_tokenJWT bearer token set after login. Cleared automatically on 401 responses.
clinic_idActive clinic ID sent as the x-clinic-id header on every authenticated API request.
citabox-themeUI theme preference. Accepts light, dark, or system. Defaults to system.

Development server

1

Install dependencies

Run the following command from the repository root to install all packages:
pnpm install
2

Create your environment file

Copy the example below into a new .env.local file in the project root and set NEXT_PUBLIC_API_URL to the URL of your local backend:
NEXT_PUBLIC_API_URL=http://localhost:3001
3

Start the development server

pnpm dev
The app is available at http://localhost:3000. Hot module replacement is enabled by default.

Available scripts

ScriptCommandDescription
Development serverpnpm devStarts Next.js in development mode with hot reload.
Production buildpnpm buildCompiles and optimizes the app for production.
Production serverpnpm startServes the production build locally. Run pnpm build first.
Lintpnpm lintRuns ESLint across the codebase.
End-to-end testspnpm test:e2eRuns the Playwright test suite.
E2E with UIpnpm test:e2e:uiOpens the Playwright interactive UI runner.

Deploying to Vercel

CitaBox includes @vercel/analytics and is designed to be deployed on Vercel. Analytics are enabled automatically when the app is deployed to the Vercel platform — no additional configuration is required.
1

Push your code to a Git repository

Vercel supports GitHub, GitLab, and Bitbucket. Make sure your repository contains the package.json and the Next.js app directory structure.
2

Create a new Vercel project

In the Vercel dashboard, click Add New → Project and import your repository. Vercel automatically detects the Next.js framework.
3

Set the environment variable

Under Environment Variables in the project settings, add:
NEXT_PUBLIC_API_URL = https://api.your-citabox-instance.com
Apply this to the Production environment. Add a separate value pointing to a staging backend for Preview deployments if needed.
4

Deploy

Click Deploy. Vercel runs pnpm build and publishes the output. Vercel Analytics starts collecting page view data immediately after the first deployment with no additional setup.

Production build locally

To test a production build outside of Vercel:
pnpm build && pnpm start
The app runs at http://localhost:3000 using the compiled output. Make sure NEXT_PUBLIC_API_URL is set in your environment before running pnpm build, because Next.js inlines NEXT_PUBLIC_* values at build time.

Build docs developers (and LLMs) love