Frontend — Environment & Configuration

Installing dependencies and configuring the Next.js client

Step 1 — Install Frontend Dependencies

Open a second VS Code window with the saas-pos-frontend folder. In its terminal, run:

bash

This may take 2–5 minutes.

Step 2 — Create the .env.local File

The repository ships a template with every supported variable. Copy it, then fill in your values:

bash

(On Windows without Git Bash: duplicate .env.example in the VS Code sidebar and rename the copy to .env.local.)

Required Variable

VariableDescriptionDevelopment Value
NEXT_PUBLIC_API_URLBackend REST API base URL. Must include the /api/v1 suffix — the Socket.IO client derives the websocket URL from it by stripping /api/v1.http://localhost:5000/api/v1Required
The /api/v1 suffix is required

Set NEXT_PUBLIC_API_URL=http://localhost:5000/api/v1 — not …/api and not the bare host. Every API module and the realtime socket connection build their URLs from this one value. There is no separate socket URL variable.

Image Uploads — Cloudinary

Product, brand, and branding images are uploaded from the browser straight to Cloudinary using an unsigned upload preset; deletions go through a small server-side route that signs the request with your API secret. All four variables live in the frontend .env.local (the backend does not talk to Cloudinary).

VariableDescriptionExample / Format
NEXT_PUBLIC_CLOUDINARY_CLOUD_NAMEYour Cloudinary cloud identifiermy-cloud-nameRequired
NEXT_PUBLIC_CLOUDINARY_UPLOAD_PRESETName of an unsigned upload presetposvelo_unsignedRequired
CLOUDINARY_API_KEYAPI key — server-side only, used to sign image deletions123456789012345Required
CLOUDINARY_API_SECRETAPI secret — server-side only, never exposed to the browserabc123xyz…Required

To get these values:

  1. Create a free account at cloudinary.com and copy the Cloud Name, API Key, and API Secret from the dashboard.
  2. Go to Settings › Upload › Upload presets › Add upload preset, set Signing mode to Unsigned, save, and use the preset's name for NEXT_PUBLIC_CLOUDINARY_UPLOAD_PRESET.
Skipping Cloudinary

The app runs without Cloudinary — you just won't be able to upload product, brand, or logo images until the four values are set.

Optional Variables

VariableDescriptionExample
NEXT_PUBLIC_CODECANYON_URLPurchase link shown by the demo bannerhttps://codecanyon.net/item/…Optional
NEXT_PUBLIC_DEMO_MODEShows the public demo banner/credentials on the login page. Pair with the backend's DEMO_MODE.falseOptional
NEXT_PUBLIC_TEST_MODEEnables developer quick-login buttons on the login page. Never enable in production.falseOptional
NEXT_PUBLIC_TEST_ADMIN_EMAILQuick-login email for the Admin button (test mode only)admin@example.comOptional
NEXT_PUBLIC_TEST_MANAGER_EMAILQuick-login email for the Manager buttonmanager@example.comOptional
NEXT_PUBLIC_TEST_CASHIER_EMAILQuick-login email for the Cashier buttoncashier@example.comOptional
NEXT_PUBLIC_TEST_HR_EMAILQuick-login email for the HR buttonhr@example.comOptional
NEXT_PUBLIC_TEST_EMPLOYEE_EMAILQuick-login email for the Employee buttonemployee@example.comOptional

Complete .env.local Example

.env.local
Warning

The NEXT_PUBLIC_ prefix exposes variables to the browser bundle. Never store secrets, passwords, or API keys with this prefix — they will be visible to all users. That is why CLOUDINARY_API_KEY / CLOUDINARY_API_SECRET have no prefix (they stay on the server) and why test-mode passwords are never put in environment variables at all.