Skip to content

Commit 4521e36

Browse files
Merge pull request #7 from arkham-knight07/copilot/update-docs-latest-information
Refresh repository documentation to match current frontend, backend routes, and CI checks
2 parents 991aacb + 2e70ea4 commit 4521e36

2 files changed

Lines changed: 53 additions & 49 deletions

File tree

Docs

Lines changed: 38 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,32 @@ OriginX GigShield - Complete Code Documentation
33
1) Project Overview
44
- Purpose: Parametric insurance system for delivery partners with automatic trigger-based claims.
55
- Core modules:
6-
- Frontend app (React + Tailwind CSS)
6+
- Frontend app (React + Vite + React Router)
77
- Backend API (Node.js + Express + Mongoose)
8-
- AI helpers (`ai/`) for risk and anomaly logic experiments.
8+
- AI service (`ai/`) for risk and anomaly scoring endpoints.
99

1010
2) Frontend Documentation
1111

1212
Location: `frontend/`
1313

1414
Tech:
1515
- React (Vite)
16-
- Tailwind CSS
17-
- Vitest + Testing Library
16+
- React Router
17+
- Custom CSS (`frontend/src/index.css`)
1818

1919
Main files:
2020
- `frontend/src/App.jsx`:
21-
- API base URL configuration
22-
- Optional auth token request (`/api/auth/token`)
23-
- Registration flow form
24-
- Subscription flow form
25-
- Claim submission flow form
26-
- Tracking dashboard panel for partner/policy/claim lookup
27-
- Validation/loading/error UX
28-
- `frontend/src/index.css`: Tailwind directives
29-
- `frontend/tailwind.config.js`: content scan paths
30-
- `frontend/vite.config.js`: React plugin + jsdom test environment
31-
- `frontend/src/App.test.jsx`: UI smoke test for flow tabs
21+
- App route setup (`/`, `/register`, `/dashboard`, `/admin`)
22+
- Admin route access gating via `VITE_ADMIN_ACCESS_KEY`
23+
- `frontend/src/pages/*`: page-level UI flows (Landing, Register, Dashboard, Admin)
24+
- `frontend/src/components/*`: shared UI components
25+
- `frontend/vite.config.js`: React plugin + dev proxy for `/api` and `/ai`
3226

3327
Commands:
3428
- `cd frontend && npm install`
3529
- `npm run dev`
36-
- `npm run test`
3730
- `npm run build`
31+
- `npm run preview`
3832

3933
3) Backend Documentation
4034

@@ -44,44 +38,40 @@ Core entry:
4438
- `backend/server.js`
4539
- Middleware stack:
4640
- CORS
47-
- Helmet
4841
- JSON parser
49-
- Morgan request logs (via structured logger stream)
50-
- Centralized error middleware
5142
- Route mounts:
5243
- `/api/auth`
5344
- `/api/delivery-partners`
5445
- `/api/insurance-policies`
5546
- `/api/insurance-claims`
47+
- `/api/disruption-events`
5648
- `/api/health`
49+
- Admin utility endpoint:
50+
- `POST /api/admin/trigger-weather-check`
5751

5852
Auth and validation:
5953
- `backend/routes/authRoutes.js`: issues JWT token
6054
- `backend/middleware/authMiddleware.js`: bearer token verification
6155
- `backend/middleware/optionalAuth.js`: enforces auth only when `ENFORCE_AUTH=true`
6256
- `backend/middleware/validationMiddleware.js`: request validation result handler
63-
- `backend/validators/requestValidators.js`: input validation rules for all main endpoints
64-
65-
Observability and resiliency:
66-
- `backend/utils/logger.js`: structured logs
67-
- `backend/services/retryExecutor.js`: retry wrapper for transient operation failures
57+
- `backend/validators/requestValidators.js`: input validation rules for partner/policy/claim endpoints
6858

6959
Payout wiring:
70-
- `backend/services/payoutService.js`
71-
- `PAYOUT_MODE=mock` -> simulated payout transaction id
72-
- `PAYOUT_MODE=disabled` -> blocks payout by configuration
73-
- Integrated in claim approval flow via `backend/services/claimProcessingService.js`
60+
- `backend/services/paymentService.js`
61+
- Stub mode when payment keys are not configured
62+
- Live mode when payment keys are provided
63+
- Integrated in claim/policy flows via backend services and routes
7464

7565
4) Database Documentation (MongoDB + Mongoose Models)
7666

7767
- `backend/models/DeliveryPartner.js`
7868
- identity/contact fields, city + coordinates, platform list, risk category, policy linkage
7969
- `backend/models/InsurancePolicy.js`
80-
- plan tier, premium, max/remaining coverage, active window, status, loss-ratio metadata, exclusions
70+
- plan tier, premium, max/remaining coverage, active window, status, pricing metadata, exclusions
8171
- `backend/models/InsuranceClaim.js`
82-
- associated partner/policy/event, claim status, requested/approved payout, fraud metadata, payout reference
72+
- associated partner/policy/event, claim status, payout and fraud metadata
8373
- `backend/models/DisruptionEvent.js`
84-
- disruption type, geo impact zone, measurements, exclusion tag, aggregate payout tracking
74+
- disruption type, geo impact zone, measurements, exclusions, aggregate payout tracking
8575

8676
Database config:
8777
- `backend/config/databaseConfig.js`
@@ -100,29 +90,37 @@ Delivery Partner:
10090

10191
Insurance Policy:
10292
- `POST /api/insurance-policies/subscribe`
103-
- `GET /api/insurance-policies/metadata/pricing-model`
93+
- `GET /api/insurance-policies/partner/:partnerId`
10494
- `GET /api/insurance-policies/:policyId`
95+
- `PATCH /api/insurance-policies/:policyId/cancel`
10596

10697
Insurance Claim:
10798
- `POST /api/insurance-claims/submit`
99+
- `GET /api/insurance-claims/partner/:partnerId`
108100
- `GET /api/insurance-claims/:claimId`
101+
- `GET /api/insurance-claims/flagged`
102+
- `PATCH /api/insurance-claims/:claimId/review`
103+
104+
Disruption Events:
105+
- `POST /api/disruption-events`
106+
- `GET /api/disruption-events`
107+
- `POST /api/disruption-events/check-threshold`
108+
- `POST /api/disruption-events/:eventId/trigger-claims`
109109

110110
Health:
111111
- `GET /api/health`
112112

113113
6) Quality and CI/CD
114114

115-
Backend tests:
115+
Backend checks:
116116
- `cd backend && npm test`
117-
- Includes existing service tests + new auth/validation/retry tests
118117

119-
Frontend tests:
120-
- `cd frontend && npm run test`
118+
Frontend checks:
119+
- `cd frontend && npm run build`
121120

122-
CI workflow:
123-
- `.github/workflows/ci.yml`
124-
- backend install + tests
125-
- frontend install + tests + build
121+
CI workflow (`.github/workflows/ci.yml`):
122+
- backend: `npm ci` + `npm test`
123+
- frontend: `npm ci` + `npm run build`
126124

127125
7) Deployment + Secrets Checklist
128126

@@ -133,7 +131,6 @@ Required env vars:
133131
- `ENFORCE_AUTH`
134132
- `AUTH_DEMO_USERNAME`
135133
- `AUTH_DEMO_PASSWORD_HASH` (preferred) / `AUTH_DEMO_PASSWORD`
136-
- `PAYOUT_MODE`
137134
- `WEATHER_API_KEY`
138135
- `POLLUTION_API_KEY`
139136

frontend/README.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
# GigShield Frontend (React + Tailwind CSS)
1+
# GigShield Frontend (React + Vite)
22

33
This frontend implements core user flows for the GigShield prototype:
44

55
1. Delivery partner registration
66
2. Policy plan subscription
77
3. Claim submission
88
4. Policy/claim tracking dashboard
9-
5. Validation + loading + error feedback UX
9+
5. Admin dashboard access gate (`/admin`) via `VITE_ADMIN_ACCESS_KEY`
1010

1111
## Tech Stack
1212

1313
- React (Vite)
14-
- Tailwind CSS
15-
- Vitest + React Testing Library
14+
- React Router
15+
- Custom CSS styling (`src/index.css`)
1616

1717
## Setup
1818

@@ -24,14 +24,21 @@ npm run dev
2424

2525
Default app URL: `http://localhost:5173`
2626

27-
## Build & Test
27+
## Available Scripts
2828

2929
```bash
30-
npm run test
30+
npm run dev
3131
npm run build
32+
npm run preview
3233
```
3334

3435
## API Configuration
3536

36-
- Set backend base URL in app header (default `http://localhost:5000/api`)
37-
- Optional: Request auth token from `/api/auth/token` and reuse it automatically for protected endpoints when backend auth enforcement is enabled.
37+
- In development, Vite proxy routes:
38+
- `/api``http://localhost:5000`
39+
- `/ai``http://localhost:5001`
40+
- For deployed environments, set values in `frontend/.env`:
41+
- `VITE_API_BASE_URL`
42+
- `VITE_AI_BASE_URL`
43+
- `VITE_RAZORPAY_KEY_ID`
44+
- `VITE_ADMIN_ACCESS_KEY`

0 commit comments

Comments
 (0)