Sambhav is a prevention-first digital protection platform prototype built for academic evaluation. It combines behavioral risk scoring (DBS), modular policy activation, and structured claim operations.
- Product and system specification:
docs/sambhav-spec.md - Detailed API contract:
docs/api.md - API quick reference:
docs/api-list.md - Deployment and operations runbook:
docs/deployment-runbook.md - Frontend setup and route map:
frontend/frontend/README.md
sambhav/
backend/ Express + SQLite API
docs/ Product, API, and operations documentation
frontend/frontend/ React + Vite web client
- Frontend: React, Vite, React Router, Axios, Framer Motion
- Backend: Node.js, Express, SQLite, JWT, bcrypt
- Auth: Bearer JWT (
Authorization: Bearer <token>)
cd backend
npm install
cp .env.example .env
npm run startHealth check:
curl http://localhost:5000/testcd frontend/frontend
npm install
cp .env.example .env
npm run devFrontend runs on http://localhost:5173 and calls backend via VITE_API_URL.
JWT_SECRET(required)PORT(default5000)FRONTEND_URL(CORS origin, defaulthttp://localhost:5173)
VITE_API_URL(example:http://localhost:5000)
If signup/login shows Network Error in local development, validate these in order:
- Backend is running on port
5000(npm run startinbackend). GET /testsucceeds athttp://localhost:5000/test.frontend/frontend/.envhasVITE_API_URL=http://localhost:5000.backend/.envhasFRONTEND_URL=http://localhost:5173.
- Free web services spin down after idle and cold-start on the next request.
- With SQLite on local service disk, runtime data durability is not guaranteed across restarts/redeploys.
- Keepalive monitors reduce cold starts but do not provide persistence guarantees.
Reference docs:
- Canonical database file for this codebase is
backend/sambhav.db(frombackend/config/db.js). backend/sambhav.sqliteis legacy/non-authoritative and should not be used for runtime assumptions.
- Backend service is up and
GET /testresponds. - Frontend
VITE_API_URLpoints to deployed backend URL. - Backend
FRONTEND_URLmatches deployed frontend origin exactly. - Keepalive monitor is configured to ping
/testevery 5 minutes. - Both frontend and backend smoke tests pass after deploy.
- Authentication (
signup,login) - User dashboard summary and protected user routes
- Plan activation and policy listing/details
- Claim creation and admin review workflow
- DBS score submission and latest score retrieval
- Receipt retrieval by policy ID
- Public narrative pages + legal/support pages (
/privacy,/terms,/contact)
- Duplicate-claim prevention is frontend-guarded; backend hard idempotency is not strict yet.
- Backend currently calculates fixed premium (
499) in receipt creation logic. - Admin endpoint coverage is focused on metrics and claims; policy/user admin listing endpoints are limited.
- Free-tier Render + SQLite is suitable for demo use, not durable production persistence.