Corpointa is configured through two complementary mechanisms: environment variables (defined in aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/EricMartinez758/corpointa-frontend/llms.txt
Use this file to discover all available pages before exploring further.
.env file at the project root) and a small set of TypeScript configuration files under src/config/ and src/lib/. Environment variables control runtime concerns such as which backend URL to target and which authentication provider to use, while the code-level configuration files govern font choices and the Axios API client behaviour. This separation keeps deployment-specific values out of source control and makes it straightforward to promote the same build artifact across environments by swapping the environment file.
Environment Variables
Vite exposes variables prefixed withVITE_ to the browser bundle via import.meta.env. All Corpointa environment variables follow this convention.
| Name | Required | Default | Description |
|---|---|---|---|
VITE_API_URL | Optional | http://localhost:4000 | Base URL of the Corpointa REST API backend. All Axios requests are relative to this value. |
VITE_CLERK_PUBLISHABLE_KEY | Optional¹ | (none) | Clerk publishable key for the alternative Clerk-based authentication flow. Only required when using Clerk auth routes. |
¹To configure these values, copy the example file and edit it:VITE_CLERK_PUBLISHABLE_KEYbecomes required if your application routes users through the Clerk sign-in pages atsrc/routes/clerk/.
.env.example file ships with only VITE_CLERK_PUBLISHABLE_KEY declared. Add VITE_API_URL manually if your backend is not at the default address:
API Client
All HTTP communication with the backend is handled through a single Axios instance defined insrc/lib/api-client.ts. The instance is pre-configured with the backend base URL and a JSON content-type header, and it includes a request interceptor that automatically attaches the authenticated user’s JWT to every outgoing request.
- On every request, Axios calls the interceptor before sending.
- The interceptor reads
document.cookieand looks for a cookie namedthisisjustarandomstring— the cookie managed by the built-in auth store. - The cookie value is URL-decoded and JSON-parsed to extract the raw JWT string.
- If a valid token is found, it is attached as a
Bearertoken in theAuthorizationheader. - If the cookie is absent or malformed, the request proceeds without an
Authorizationheader (useful for unauthenticated endpoints such as/auth/login).
apiClient from this file, so any change to base URL or interceptor logic applies universally.
Authentication Mode
Corpointa supports two mutually exclusive authentication modes. Choose one based on your deployment requirements.- Built-in JWT (Default)
- Clerk (Optional)
The default authentication flow uses the Corpointa backend’s own On a successful login response, the auth store writes the returned JWT into the
/auth/login endpoint. No additional third-party accounts or configuration are needed beyond a running backend.How it works:Users submit their cédula (national ID) and password through the login form. The frontend calls the backend via src/features/auth/api/auth-api.ts:thisisjustarandomstring browser cookie. From that point, the Axios interceptor picks it up automatically on every subsequent request.Configuration required: None beyond VITE_API_URL.Font Configuration
Corpointa supports switchable font families, selectable at runtime from the Settings → Appearance page. The available fonts are declared insrc/config/fonts.ts:
- Add the font name string to the
fontsarray insrc/config/fonts.ts. - Add the corresponding
<link>tag inindex.htmlto load the font from Google Fonts or another source. - Register the font family in
index.cssusing a TailwindCSS v4@theme inlineblock:
'roboto' → font-roboto), which Corpointa’s appearance settings apply dynamically to the root element.
Scripts Reference
All project scripts are defined inpackage.json and run via pnpm:
| Script | Command | Description |
|---|---|---|
dev | vite | Start the Vite development server with HMR at http://localhost:5173. |
build | tsc -b && vite build | Type-check the project then compile an optimised production bundle into dist/. |
preview | vite preview | Serve the production build locally at http://localhost:4173 for pre-deploy validation. |
lint | eslint . | Run ESLint across all project files using the configured rule set. |
format | prettier --write . | Auto-format all files in place using Prettier. |
format:check | prettier --check . | Check formatting across all files without writing changes (useful in CI). |
test | vitest run --browser.headless | Execute the full test suite once in headless Chromium via Playwright. |
test:watch | vitest --browser.headless | Run tests in watch mode — re-runs affected tests on file save. |
test:ui | vitest --ui --browser.headless | Open the Vitest interactive UI while running tests headlessly. |
test:browser | vitest | Run tests in a visible Chromium browser window (non-headless). |
test:coverage | vitest run --coverage --browser.headless | Run the test suite and generate a V8 code-coverage report. |
test:browser:install | playwright install chromium --with-deps | Install the Chromium browser and its system dependencies for Playwright. |
knip | knip | Analyse the project for unused files, exports, and dependencies. |