-
Start the backend server:
cd D:\Projects\HalalChain\backend npm run dev
Keep this terminal running. You should see:
HalalChain API running on http://localhost:4000 WebSocket server running on ws://localhost:4000/ws -
Start the frontend (optional, for UI testing):
cd D:\Projects\HalalChain\frontend npm run dev
Open a new PowerShell window and run:
# Test health endpoint (no auth required)
Invoke-RestMethod -Uri http://localhost:4000/api/health -Method Get
# Test v2.0 health endpoint (requires ADMIN auth - see below)
Invoke-RestMethod -Uri http://localhost:4000/api/admin/system/health -Method Get- Open browser to
http://localhost:3000 - Login as admin:
admin@halalchain.com/demo-admin-2024 - Navigate to settings pages (once frontend is built)
Import these endpoints into your API client:
Public Endpoints (No Auth):
GET http://localhost:4000/api/health
Admin Endpoints (Require ADMIN Role):
GET http://localhost:4000/api/admin/system/healthGET http://localhost:4000/api/admin/system/configsGET http://localhost:4000/api/admin/feature-flagsGET http://localhost:4000/api/admin/automation/rulesGET http://localhost:4000/api/admin/queuesGET http://localhost:4000/api/admin/maintenance/status
All /api/admin/* endpoints require authentication. To test them:
- Login via the frontend at
http://localhost:3000 - The frontend automatically sends the auth cookie
- Use browser DevTools → Network tab to see API calls
# Login
$response = Invoke-RestMethod -Uri http://localhost:4000/api/auth/login `
-Method Post `
-ContentType "application/json" `
-Body '{"email":"admin@halalchain.com","password":"demo-admin-2024"}'
# Use the token
$token = $response.token
Invoke-RestMethod -Uri http://localhost:4000/api/admin/system/health `
-Method Get `
-Headers @{"Authorization"="Bearer $token"}- Server starts without errors:
npm run dev - Health check works:
http://localhost:4000/api/health - Database connected (check console logs)
- Redis connected (check console logs)
- Scheduler started (check console for cron jobs)
Cause: Server not running or endpoint doesn't exist
Solution:
- Make sure
npm run devis running in backend directory - Check that you're using the correct URL
Cause: No auth token/cookie
Solution: Login via frontend or include auth token in headers
Cause: Dependencies not installed
Solution: Run npm install in backend directory
-
Run database migration:
cd backend npx prisma migrate dev --name add_v2_system_tables -
Seed v2.0 data:
npm run db:seed:v2
-
Test new endpoints (after seeding):
- System configs will be populated
- Feature flags will be created
- Automation rules will be initialized
Watch the console output for:
[Scheduler] All jobs scheduled— Cron jobs are running[AutomationScheduler] Starting daily rule evaluation— Rules executing[BackupScheduler] Starting daily backup— Backups running- Structured JSON logs from Pino
# Build should succeed with no errors
npm run build
# Check dist folder exists
dir distNote: The v2.0 features are backend-only. Frontend UI pages need to be built separately to interact with these endpoints via a user interface.