Documentation Index
Fetch the complete documentation index at: https://mintlify.com/AdriP-maker/JAAR_Antigravity/llms.txt
Use this file to discover all available pages before exploring further.
Environment Variables
SIMAP Digital uses Vite’s environment variable system. All client-side variables must be prefixed withVITE_ to be exposed to the browser bundle. Create a .env file at the project root before starting the dev server or running a production build.
Variable reference
Human-readable application name shown in the browser tab and PWA manifest.
Optional — the app falls back to a hard-coded string if unset.
Semantic version string injected at build time. Displayed in the About screen
and included in Excel export headers.
The base URL of your Supabase project, e.g.
https://abcdefgh.supabase.co.
Found in Project Settings → API → Project URL in the Supabase dashboard.
Required for cloud sync; the app runs offline without it but cannot push
pending records to the cloud layer.The
anon (public) API key for your Supabase project.
Found in Project Settings → API → Project API keys.
This key is intentionally public and is safe to embed in a client bundle;
Row Level Security policies (defined in 00001_init.sql) enforce data access
rules server-side regardless of what the client sends.Selects the AI inference backend used by the risk-scoring engine (
In a rural deployment with no internet, keep this set to
aiService.js).
Accepted values:| Value | Behaviour |
|---|---|
local | Uses the browser’s built-in window.ai API (Chrome 127+). No external calls. |
openai | Forwards prompts to the OpenAI API. Requires VITE_OPENAI_API_KEY. |
claude | Forwards prompts to the Anthropic Claude API. Requires the corresponding key. |
local.OpenAI secret key (
sk-…). Only required when VITE_AI_PROVIDER=openai.
Even though this variable is bundled into the client (Vite limitation), treat it
as sensitive and restrict it with OpenAI’s usage policies and project-level key
scoping.Example .env file
Copy .env.example from the repository root and fill in your values:
Runtime System Config (DEFAULT_CONFIG)
Beyond environment variables (which are baked in at build time), SIMAP Digital stores a mutable system configuration object in IndexedDB under the config table with the key 'general'. This allows administrators to change operational parameters at runtime — through the Admin panel — without rebuilding or redeploying the app.
The defaults are declared in src/utils/constants.js:
Config field reference
Monthly water quota charged to each registered household, in Panamanian
balboas (B/.).
All payment calculations — change computation, debt totals, the points engine, and commission splits — derive from this single value.
Changing it takes effect immediately for any new payment recorded after the save; historical records retain the amount that was in force when they were created.
All payment calculations — change computation, debt totals, the points engine, and commission splits — derive from this single value.
Changing it takes effect immediately for any new payment recorded after the save; historical records retain the amount that was in force when they were created.
When
When
true, the cobrador (collector) may accept partial payments and record
them with tipo: 'parcial'. The saldo ledger stores the household’s running
balance and estado is set to 'parcial' until the outstanding amount is
cleared.When
false, only full-quota payments are accepted; the UI hides the partial
payment option.The number of consecutive unpaid months after which a household’s
The payment engine evaluates this threshold each time a saldo record is written. Lower values increase cut-off sensitivity; higher values extend the grace period.
estado is
automatically promoted from 'moroso' to 'corte' (service cut-off).The payment engine evaluates this threshold each time a saldo record is written. Lower values increase cut-off sensitivity; higher values extend the grace period.
Reading and writing config
Two async helpers insrc/services/db.js wrap all config I/O:
getConfig() always returns a complete object: if the 'general' row has never been written (fresh install before initDB() runs), it returns DEFAULT_CONFIG directly. saveConfig(cfg) performs an IndexedDB put, so it is safe to call even when the row does not yet exist.
Build Configuration
Vite (vite.config.js)
| Option | Value | Purpose |
|---|---|---|
plugins | react() | Enables JSX compilation and React Fast Refresh in development |
base | '/' | Ensures all asset imports use root-relative URLs; required when Vercel serves the SPA from / |
build.outDir | 'dist' | All compiled files land in dist/; this matches the Vercel outputDirectory |
build.sourcemap | false | Source maps are omitted from the production bundle to reduce deployed asset size |
server.port | 5173 | Default Vite dev port |
server.open | true | Opens http://localhost:5173 automatically when you run npm run dev |
Vercel (vercel.json)
rewrites rule is essential for client-side routing. Without it, Vercel’s CDN would return a 404 for any URL other than / because dist/ contains only index.html — React Router handles path resolution in the browser, not on the server.
npm Scripts
All scripts are defined inpackage.json and invoked via npm run <script>.
| Script | Command | Purpose |
|---|---|---|
dev | vite | Starts the Vite development server on http://localhost:5173 with Hot Module Replacement (HMR). Changes to React components and CSS are reflected instantly without a full reload. |
build | vite build | Compiles and bundles the app for production into dist/. Runs tree-shaking, minification, and asset hashing. Output is ready to deploy to Vercel or any static host. |
preview | vite preview | Serves the production bundle from dist/ locally (default port 4173). Use this to validate the production build before deploying — behaviour may differ from dev because HMR and dev-only code paths are absent. |
lint | eslint . | Runs ESLint across the entire source tree using the project’s flat config (eslint.config.js). Catches unused variables, React hook rule violations, and other static issues. Run this in CI before merging pull requests. |