Kantuta POS externalises every deployment-specific value through Vite environment variables. There are no hard-coded URLs in application logic — each service reads fromDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Eleazarguitar18/kantuta_pos_front/llms.txt
Use this file to discover all available pages before exploring further.
import.meta.env at runtime, making it straightforward to move the same build artefact between environments or override individual values without touching source code.
Environment variables
Only one environment variable is required to run Kantuta POS:| Variable | Required | Description |
|---|---|---|
VITE_API_BASE_URL | ✅ Yes | Base URL of the NestJS REST API without a trailing slash |
src/components/auth/services/urlBase.ts:
src/components/auth/services/urlBase.ts
|| "http://localhost:3000" fallback means the app will compile and start without a .env file, but it will attempt to contact localhost:3000 — only useful if the NestJS backend is already running on that port.
Vite only exposes variables whose names begin with
VITE_ to client-side code. Any variable you add without this prefix will be undefined at runtime, even if it is present in your .env file.Development vs production setup
- Development
- Production
Create a With this configuration:Vite prints the local URL in the terminal. Any change to a
.env file in the project root (next to package.json). Vite loads this file automatically when you run npm run dev..env
- Axios services resolve to
http://localhost:3000for all API calls. - Socket.IO opens a WebSocket connection to
http://localhost:3000(the/apisuffix is stripped automatically bySocketContext). - Vite’s HMR dev server runs at
http://localhost:5173with full source maps and React Refresh.
.env file requires restarting the dev server — Vite does not hot-reload environment variables.Vite configuration
Thevite.config.ts file at the project root is intentionally minimal:
vite.config.ts
@vitejs/plugin-react— enables JSX transform, React Refresh (HMR), and the React DevTools integration.vite-plugin-svgr— converts SVG files to named React components (import { ReactComponent as Logo } from './logo.svg'), used throughout the icon system.
vite.config.ts (with proxy)
VITE_API_BASE_URL to an empty string or http://localhost:5173 so that Axios calls hit the Vite dev server, which then forwards them to NestJS.
Inactivity timeout
AuthContext enforces a 45-minute inactivity timeout on every authenticated session. The timer resets on any of the following user interactions: mousemove, keydown, scroll, or click.
src/context/auth/AuthContext.tsx (relevant excerpt)
logoutStorage() clears access_token, refresh_token, and user from localStorage and redirects the browser to /signin. This behaviour is non-configurable via environment variables — adjust the constant in AuthContext.tsx if your deployment requires a different session length.
The JWT itself is also validated on mount: if access_token is already expired when the page loads, the user is logged out immediately without waiting for the inactivity timer.
Socket.IO connection
SocketContext creates a single shared Socket.IO client that connects to the same host as the REST API:
src/context/SocketContext.tsx
.replace(/\/api\/?$/, "") call strips a trailing /api segment from API_BASE_URL so that Socket.IO connects to the WebSocket root of the server rather than a REST sub-path. For example:
VITE_API_BASE_URL | Resolved Socket.IO URL |
|---|---|
http://localhost:3000 | http://localhost:3000 |
http://localhost:3000/api | http://localhost:3000 |
https://api.your-domain.com | https://api.your-domain.com |
useSocket() hook:
Upgrade: websocket header pass-through).