Skip to content

RONL Business API - Quick Reference

Essential commands and test user credentials at a glance


๐Ÿ”‘ Test User Credentials

All passwords: test123

Utrecht (Red Theme - #C41E3A)

Username: test-citizen-utrecht
Username: test-caseworker-utrecht

Amsterdam (Bright Red Theme - #EC0000)

Username: test-citizen-amsterdam
Username: test-caseworker-amsterdam

Rotterdam (Green Theme - #00811F)

Username: test-citizen-rotterdam
Username: test-caseworker-rotterdam

Den Haag (Blue Theme - #007BC7)

Username: test-citizen-denhaag
Username: test-caseworker-denhaag

๐ŸŒ Service URLs

Frontend:   http://localhost:5173
Backend:    http://localhost:3002
Keycloak:   http://localhost:8080
Operaton:   https://operaton.open-regels.nl

Keycloak Admin:
  URL:      http://localhost:8080
  Username: admin
  Password: admin
  Realm:    ronl

โšก Quick Start Commands

# ๐Ÿš€ Start Everything
npm run docker:up     # Start Docker services
npm run dev           # Start frontend & backend

# ๐Ÿ›‘ Stop Everything
Ctrl+C                # Stop dev servers
npm run docker:down   # Stop Docker services

# ๐Ÿ”„ Restart Services
docker compose restart keycloak
docker compose restart postgres

# ๐Ÿ“‹ View Logs
docker compose logs -f keycloak
docker compose logs -f postgres

๐Ÿ”จ Development Commands

# Frontend
npm run dev:frontend          # Start frontend only
npm run build:frontend        # Build for production
npm run type-check            # TypeScript check

# Backend
npm run dev:backend           # Start backend only
npm run build:backend         # Compile TypeScript
npm run lint                  # ESLint check

# Shared Types
npm run build --workspace=@ronl/shared

# All
npm run build                 # Build everything
npm run lint                  # Lint everything
npm run format                # Format code

๐Ÿงน Cleanup Commands

# ๐Ÿ’ฃ Nuclear Reset (Clean Slate)
npm run docker:down:volumes   # Remove all Docker data
rm -rf node_modules           # Remove dependencies
rm -rf packages/*/node_modules
npm install                   # Reinstall everything
npm run build --workspace=@ronl/shared
npm run docker:up
npm run dev

# ๐Ÿ”„ Soft Reset (Keep Data)
docker compose down
docker compose up -d
npm run dev

๐Ÿ› Debugging Commands

# Check Health
curl http://localhost:3002/v1/health | jq
curl http://localhost:8080/health/ready

# Check Ports
# Linux/Mac:
sudo lsof -i :5173    # Frontend
sudo lsof -i :3002    # Backend
sudo lsof -i :8080    # Keycloak

# Windows:
netstat -ano | findstr :5173
netstat -ano | findstr :3002
netstat -ano | findstr :8080

# View Container Status
docker compose ps
docker compose logs keycloak --tail=50
docker compose logs postgres --tail=50

๐Ÿ” Testing Checklist

Test Authentication

  • Login with test-citizen-utrecht
  • Verify header shows "Utrecht"
  • Verify role badge shows "citizen"
  • Verify LoA badge shows "hoog"
  • Verify header is RED

Test Zorgtoeslag

  • Fill form with test values
  • Click "Berekenen" button
  • Verify API call succeeds (Network tab)
  • Verify result displays
  • Verify no errors in console

Test All Municipalities

  • Utrecht โ†’ RED theme
  • Amsterdam โ†’ BRIGHT RED theme
  • Rotterdam โ†’ GREEN theme
  • Den Haag โ†’ BLUE theme

Test Both Roles

  • Citizen access
  • Caseworker access

๐Ÿšจ Common Issues - Quick Fixes

JWT Audience Error

# Fix in Keycloak Admin:
# Clients โ†’ ronl-business-api โ†’ Client scopes
# โ†’ ronl-business-api-dedicated โ†’ Add mapper
# โ†’ Audience โ†’ Save
# Then logout and login again

Roles Not Showing

# Fix in Keycloak Admin:
# Clients โ†’ ronl-business-api โ†’ Client scopes
# โ†’ ronl-business-api-dedicated โ†’ Add mapper
# โ†’ User Realm Role โ†’ Save
# Then logout and login again

CORS Error

# Fix in Keycloak Admin:
# Clients โ†’ ronl-business-api โ†’ Settings
# Web Origins: Add "+"
# Save

Theme Not Loading

# Check file exists:
ls packages/frontend/public/tenants.json

# Restart dev server:
Ctrl+C
npm run dev

White Button

// Fix in App.tsx - use inline style:
style={{backgroundColor: 'var(--color-primary)'}}

๐Ÿ“‚ Important File Locations

Config Files:
  config/keycloak/ronl-realm.json      # Keycloak configuration
  config/postgres/init-databases.sql   # Database initialization
  docker-compose.yml                   # Docker services

Frontend:
  packages/frontend/src/App.tsx        # Main application
  packages/frontend/src/services/
    โ”œโ”€โ”€ keycloak.ts                    # Auth service
    โ”œโ”€โ”€ api.ts                         # API client
    โ””โ”€โ”€ tenant.ts                      # Theme service
  packages/frontend/public/tenants.json # Municipality configs

Backend:
  packages/backend/src/
    โ”œโ”€โ”€ index.ts                       # Express server
    โ”œโ”€โ”€ auth/jwt.middleware.ts         # JWT validation
    โ”œโ”€โ”€ middleware/tenant.middleware.ts # Multi-tenancy
    โ”œโ”€โ”€ routes/decision.routes.ts      # DMN endpoints
    โ””โ”€โ”€ services/operaton.service.ts   # Operaton client

Shared:
  packages/shared/src/types/           # Shared TypeScript types

๐ŸŽจ Theme Colors Reference

Utrecht:
  Primary:      #C41E3A (Red)
  Primary Dark: #9B1830
  Secondary:    #2C5F2D (Green)

Amsterdam:
  Primary:      #EC0000 (Bright Red)
  Primary Dark: #C00000
  Secondary:    #003B5C (Dark Blue)

Rotterdam:
  Primary:      #00811F (Green)
  Primary Dark: #006619
  Secondary:    #0C2340 (Navy)

Den Haag:
  Primary:      #007BC7 (Blue)
  Primary Dark: #005A99
  Secondary:    #E17000 (Orange)

๐Ÿ“Š API Endpoints Reference

# Health Check (No Auth)
GET /v1/health

# DMN Decision Evaluation (Auth Required)
POST /v1/decision/:key/evaluate
Body: { variables: { ... } }

# Process Management (Auth Required)
POST /v1/process/:key/start
GET  /v1/process/:id/status
GET  /v1/process/:id/variables
DELETE /v1/process/:id

๐Ÿ” Token Inspection

// In browser console:

// Get token from localStorage
const token = localStorage.getItem('kc-token');

// Decode at jwt.io or use:
JSON.parse(atob(token.split('.')[1]));

// Should contain:
// - municipality: "utrecht"
// - loa: "hoog"
// - realm_access.roles: ["citizen"]
// - aud: "ronl-business-api"

๐Ÿ“ Git Workflow

# Daily workflow
git pull                          # Get latest changes
git checkout -b feature/my-feature # New feature branch
# ... make changes ...
git add .                         # Stage changes
git commit -m "feat: add feature" # Commit (triggers hooks)
git push                          # Push (triggers hooks)

# Hooks run automatically:
# Pre-commit: ESLint, Prettier
# Pre-push: Type check, build shared

๐ŸŽฏ Development Flow

1. Start Docker     โ†’ npm run docker:up
2. Start Dev        โ†’ npm run dev
3. Open Browser     โ†’ http://localhost:5173
4. Login            โ†’ test-citizen-utrecht / test123
5. Test Feature     โ†’ Zorgtoeslag calculation
6. Check Logs       โ†’ Terminal & Browser Console
7. Make Changes     โ†’ Auto-reload (Vite HMR)
8. Test Again       โ†’ Verify changes
9. Commit           โ†’ git add . && git commit -m "..."
10. Push            โ†’ git push

  • Setup Guide: COMPLETE_SETUP_GUIDE.md
  • Troubleshooting: TROUBLESHOOTING_GUIDE.md
  • Project Status: PROJECT_STATUS.md
  • This Reference: QUICK_REFERENCE.md

Keep this handy while developing! ๐Ÿš€

Print this out or keep it on a second monitor for quick reference.