Skip to content

Initial setup ​

Prerequisites ​

  • Node.js 20 or later
  • PostgreSQL 14 or later
  • A terminal with access to the server where IDVIZE will run

Environment variables ​

Create a .env file in the idvize-api directory. The minimum required variables:

VariablePurposeExample
DATABASE_URLPostgreSQL connection stringpostgresql://idvize:secret@localhost:5432/idvize
JWT_SECRETSecret for signing authentication tokens (HS256, min 32 chars)A random string
JWT_SIGNING_SECRETSecret for signing plan approval hashes (HMAC-SHA-256)A different random string
API_KEYKey for API-key-authenticated endpointsA random string
SEED_MODEproduction (empty database), demo or development (sample data)production

Optional but recommended:

VariablePurpose
ANTHROPIC_API_KEYEnables AI-assisted cost analysis and plan review. Without it, AI features degrade gracefully.
PORTAPI server port. Defaults to 3001.
CORS_ORIGINSComma-separated list of allowed frontend origins.
CONTINUOUS_ASSESSMENT_INTERVAL_MINUTESHow often the assessment sweep runs. Default 60. Set to 0 to disable.

WARNING

Never commit .env files to source control. The .gitignore already excludes them.

Database setup ​

IDVIZE manages its own schema. On first start the API creates all tables, indexes and row-level security policies automatically.

bash
# Create the database and two roles
psql -U postgres -c "CREATE ROLE idvize_owner WITH LOGIN PASSWORD 'owner-secret';"
psql -U postgres -c "CREATE ROLE idvize_app WITH LOGIN PASSWORD 'app-secret';"
psql -U postgres -c "CREATE DATABASE idvize OWNER idvize_owner;"

Set DATABASE_URL to the owner connection (used for migrations) and DATABASE_APP_URL to the app connection (used at runtime, with RLS enforced). If only DATABASE_URL is set, both pools use the same connection.

First start ​

bash
cd idvize-api
npm install
npm run dev

The server:

  1. Runs schema migrations (creates or updates all 37 tables).
  2. Applies row-level security policies and grants.
  3. If SEED_MODE=demo, loads sample tenants, users and applications.
  4. Starts listening on the configured port.

First tenant (production mode) ​

In production mode, no data is loaded. Create the first tenant through the API:

bash
curl -X POST http://localhost:3001/v1/tenants \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -d '{
    "name": "Acme Corp",
    "domain": "acme.com",
    "plan": "enterprise"
  }'

Then create the first PlatformAdmin user. See Users and roles.

Frontend ​

bash
cd idvize
npm install
npm run dev

The frontend starts on port 5173 by default and connects to the API at http://localhost:3001. To change the API URL, set VITE_API_BASE_URL in idvize/.env.

Health check ​

GET /health

Returns the running commit, branch, server start time and uptime. Unauthenticated — suitable for load balancer probes.