From 6b557d81740e236b3cbdafafe751f661ba043da8 Mon Sep 17 00:00:00 2001 From: Jagan Kumar Hotta <138506773+techySPHINX@users.noreply.github.com> Date: Wed, 18 Mar 2026 00:30:55 +0530 Subject: [PATCH] fix: ml-services-implementation-plan --- .../nivesh-backend-ml-integration.agent.md | 57 + .../ML_SERVICES_EXECUTION_CHECKLIST.md | 308 +++ .../ML_SERVICES_EXECUTIVE_PLAN.md | 79 + .../ML_SERVICES_REMEDIATION_ROADMAP.md | 247 +++ .../SPRINT_WISE_TICKET_PLAN.md | 259 +++ ml-services/requirements.txt | 192 -- mobile_design/SOP_NIVESH_MOBILE_APP.md | 1934 ----------------- mobile_design/src/theme/ThemeProvider.tsx | 66 - mobile_design/src/theme/animations.ts | 54 - mobile_design/src/theme/colors.ts | 262 --- mobile_design/src/theme/index.ts | 10 - mobile_design/src/theme/shadows.ts | 68 - mobile_design/src/theme/spacing.ts | 39 - mobile_design/src/theme/typography.ts | 79 - mobile_design/src/utils/categories.ts | 53 - mobile_design/src/utils/constants.ts | 52 - mobile_design/src/utils/formatAmount.ts | 103 - mobile_design/src/utils/index.ts | 4 - mobile_design/src/utils/validators.ts | 61 - 19 files changed, 950 insertions(+), 2977 deletions(-) create mode 100644 .github/agents/nivesh-backend-ml-integration.agent.md create mode 100644 ml-services-execution-plan/ML_SERVICES_EXECUTION_CHECKLIST.md create mode 100644 ml-services-execution-plan/ML_SERVICES_EXECUTIVE_PLAN.md create mode 100644 ml-services-execution-plan/ML_SERVICES_REMEDIATION_ROADMAP.md create mode 100644 ml-services-execution-plan/SPRINT_WISE_TICKET_PLAN.md delete mode 100644 ml-services/requirements.txt delete mode 100644 mobile_design/SOP_NIVESH_MOBILE_APP.md delete mode 100644 mobile_design/src/theme/ThemeProvider.tsx delete mode 100644 mobile_design/src/theme/animations.ts delete mode 100644 mobile_design/src/theme/colors.ts delete mode 100644 mobile_design/src/theme/index.ts delete mode 100644 mobile_design/src/theme/shadows.ts delete mode 100644 mobile_design/src/theme/spacing.ts delete mode 100644 mobile_design/src/theme/typography.ts delete mode 100644 mobile_design/src/utils/categories.ts delete mode 100644 mobile_design/src/utils/constants.ts delete mode 100644 mobile_design/src/utils/formatAmount.ts delete mode 100644 mobile_design/src/utils/index.ts delete mode 100644 mobile_design/src/utils/validators.ts diff --git a/.github/agents/nivesh-backend-ml-integration.agent.md b/.github/agents/nivesh-backend-ml-integration.agent.md new file mode 100644 index 0000000..c5826cd --- /dev/null +++ b/.github/agents/nivesh-backend-ml-integration.agent.md @@ -0,0 +1,57 @@ +--- +name: Nivesh Backend-ML Integration Engineer +description: "Use when implementing, debugging, or reviewing cross-service work between backend NestJS and ml-services FastAPI, including API contracts, auth propagation, schema validation, retraining workflows, and deployment/runtime alignment." +tools: [read, search, edit, execute, todo] +model: "GPT-5 (copilot)" +argument-hint: "Describe the business goal, affected backend and ml-services modules, contract changes expected, and whether tests should be run." +user-invocable: true +--- +You are the Nivesh Backend-ML Integration Engineer, a senior software and ML platform engineer responsible for reliable end-to-end delivery across `backend` and `ml-services`. + +## Mission +Ship production-grade features and fixes that keep backend and ML services tightly aligned, secure, and test-verified. + +## Scope +- Primary scope: `backend/` and `ml-services/` +- Secondary scope: `docs/`, `docker-compose*.yml`, `k8s/`, `helm/`, `monitoring/`, and environment examples when integration contracts change + +## Execution Priorities +Follow the remediation sequence unless the user sets a different priority: +1. Phase 0 critical path stability: MLS-001 to MLS-005 +2. Phase 1 security and runtime hardening: MLS-006 to MLS-008 +3. Phase 2 contract and validation governance: MLS-009 to MLS-011 +4. Phase 3 retraining control plane: MLS-012 to MLS-014 +5. Phase 4 integration and release convergence: MLS-015 to MLS-017 + +## Quality Bar +- Operate at SWE-benchmark-style rigor: root-cause first, minimal safe patch, evidence-backed validation +- Never claim a test passed unless it was executed and result captured +- Prefer deterministic fixes over speculative changes + +## Non-Negotiable Constraints +- Do not change API contracts silently; when changing contracts, update caller code, tests, and docs in the same task +- Do not weaken auth, API key checks, rate limiting, or validation boundaries +- Do not leave backend and ml-services endpoint naming inconsistent +- Do not complete work with unresolved build, type, or test failures caused by your changes + +## Operating Workflow +1. Discover and map current contracts, endpoints, schema expectations, and auth behavior +2. Identify integration impact across backend callers and ml-services providers +3. Propose and apply the smallest complete change set that resolves the issue +4. Update environment templates, deployment manifests, and docs when contracts or runtime behavior change +5. Run targeted validation first, then broader checks when risk is cross-cutting +6. Report outcomes with explicit evidence, remaining risks, and next action + +## Validation Defaults +Use relevant commands based on scope and report exact outcomes: +- ML services tests: `cd ml-services; pytest` +- ML endpoint tests: `cd ml-services; pytest test/test_model_server.py -v` +- Backend tests: `cd backend; pnpm test` +- Backend build checks: `cd backend; pnpm build` + +## Output Format +Return responses in this order: +1. Objective and resolution summary +2. File-by-file changes and contract impact +3. Validation commands executed with pass or fail status +4. Risks, assumptions, and recommended next step diff --git a/ml-services-execution-plan/ML_SERVICES_EXECUTION_CHECKLIST.md b/ml-services-execution-plan/ML_SERVICES_EXECUTION_CHECKLIST.md new file mode 100644 index 0000000..1ba09c4 --- /dev/null +++ b/ml-services-execution-plan/ML_SERVICES_EXECUTION_CHECKLIST.md @@ -0,0 +1,308 @@ +# ML Services Execution Checklist + +Document owner: ML Services Engineering +Document date: 2026-03-17 +Linked strategy document: ML_SERVICES_REMEDIATION_ROADMAP.md +Linked executive plan: ML_SERVICES_EXECUTIVE_PLAN.md +Linked sprint plan: SPRINT_WISE_TICKET_PLAN.md +Execution mode: Principal architect governance with weekly phase gates + +## How to Use This Checklist + +1. Assign owner and target date for every item before execution starts. +2. Mark each item done only when objective evidence is captured. +3. Do not close a phase until all mandatory gate criteria are satisfied. +4. Record deviations and approved exceptions in the notes section. + +Legend: + +- Priority: C0 (Critical), C1 (High), C2 (Medium) +- Status: [ ] Not started, [x] Complete + +## A) Program Governance and Pre-Flight + +- [ ] Confirm execution owner matrix across ML, Platform, Backend, QA, SRE +- [ ] Finalize sprint mapping for Phase 0 to Phase 4 +- [ ] Open tracking board with each task ID mapped to engineering ticket +- [ ] Define release branch strategy and rollback approach +- [ ] Confirm non-production validation environment availability + +Evidence links: + +- Owner matrix: +- Tracking board: +- Release and rollback plan: + +## B) Phase 0 - Critical Path Stabilization (Week 1) + +### B1. Intent DAG Reliability (C0) + +- [ ] Align intent DAG required columns with real dataset fields +- [ ] Align intent DAG trainer invocation with actual train function signature +- [ ] Validate XCom outputs for accuracy and f1 mapping +- [ ] Execute DAG dry-run and record logs + +Evidence: + +- DAG run ID: +- Dry-run log: + +### B2. Credit DAG Reliability (C0) + +- [ ] Align credit DAG required columns with actual training dataset schema +- [ ] Align target label naming across DAG and model training logic +- [ ] Expose or adapt trainer interface to support DAG invocation contract +- [ ] Execute DAG dry-run and record logs + +Evidence: + +- DAG run ID: +- Dry-run log: + +### B3. Build and Container Integrity (C0) + +- [ ] Fix docker-compose model-server dockerfile path reference +- [ ] Fix Dockerfile dependency file reference to existing requirements source +- [ ] Validate local build success +- [ ] Validate CI build success + +Evidence: + +- Local build output: +- CI build run: + +### Phase 0 Gate (Mandatory) + +- [ ] Intent retraining DAG runs without interface/schema failure +- [ ] Credit retraining DAG runs without interface/schema failure +- [ ] model-server image builds successfully in local and CI + +Gate approver: + +- [ ] Principal architect sign-off + +## C) Phase 1 - Security and Runtime Hardening (Week 2 to Week 3) + +### C1. Endpoint Security Consistency (C1) + +- [ ] Inventory all model-server endpoints by auth requirement +- [ ] Apply API key and rate-limit dependency to non-health operational endpoints +- [ ] Apply equivalent protection to drift monitoring router endpoints +- [ ] Validate authorized and unauthorized behavior with test cases + +Evidence: + +- Endpoint security matrix: +- Test report: + +### C2. Probe Semantics Correction (C1) + +- [ ] Update Kubernetes deployment readiness path to readiness endpoint +- [ ] Update Kubernetes deployment liveness path to liveness endpoint +- [ ] Update Helm template probe paths consistently +- [ ] Validate behavior under dependency failure simulation + +Evidence: + +- K8s manifest diff: +- Helm template diff: +- Probe behavior test log: + +### C3. Environment Contract Alignment (C1) + +- [ ] Add ML_SERVICE_URL and ML_API_KEY to backend environment example +- [ ] Add ML_API_KEYS or equivalent policy variable to ml-services environment example +- [ ] Update integration docs with canonical auth and endpoint settings + +Evidence: + +- Updated env examples: +- Docs updates: + +### Phase 1 Gate (Mandatory) + +- [ ] All non-health operational endpoints reject missing or invalid auth +- [ ] Probe configuration uses correct readiness and liveness paths +- [ ] Backend and ml-services env examples are contract-complete + +Gate approver: + +- [ ] Principal architect sign-off + +## D) Phase 2 - Contract and Validation Governance (Week 4 to Week 5) + +### D1. Strict API Schema Enforcement (C1) + +- [ ] Replace weak dictionary payload contracts with explicit request models +- [ ] Replace weak response payload contracts where ambiguity exists +- [ ] Add field constraints and validation messages for invalid requests + +Evidence: + +- Schema diff: +- Contract test run: + +### D2. Validation Layer Integration (C1) + +- [ ] Integrate data_validation checks into inference input boundary +- [ ] Integrate validation checks into retraining data ingestion path +- [ ] Add failure-mode tests for malformed payloads and training data + +Evidence: + +- Validation integration points: +- Failure-mode tests: + +### D3. OpenAPI Governance in CI (C2) + +- [ ] Generate OpenAPI artifact in CI pipeline +- [ ] Add contract drift check policy +- [ ] Fail CI on unreviewed contract changes + +Evidence: + +- CI workflow update: +- Sample contract report: + +### Phase 2 Gate (Mandatory) + +- [ ] Typed contracts enforced on critical endpoints +- [ ] Validation checks active for inference and training boundaries +- [ ] CI contract governance gate enabled + +Gate approver: + +- [ ] Principal architect sign-off + +## E) Phase 3 - Retraining Control Plane Completion (Week 6 to Week 7) + +### E1. Manual Retraining Control (C1) + +- [ ] Add authenticated manual retraining endpoint(s) +- [ ] Capture audit metadata for each retraining trigger +- [ ] Add operator runbook for manual invocation and rollback + +Evidence: + +- API spec and endpoint test: +- Runbook: + +### E2. Drift to Retraining Path (C1) + +- [ ] Define policy thresholds and cool-down windows +- [ ] Connect drift alert path to controlled retraining trigger flow +- [ ] Add safety guardrails for repeated trigger suppression + +Evidence: + +- Trigger policy config: +- End-to-end scenario test: + +### E3. Production Drift Data Source (C1) + +- [ ] Replace simulated drift data path with production source adapter +- [ ] Validate data quality and schema checks on collected drift samples +- [ ] Verify drift outputs against known baseline snapshots + +Evidence: + +- Data source integration: +- Drift validation report: + +### Phase 3 Gate (Mandatory) + +- [ ] Manual retraining is operational and authenticated +- [ ] Drift-trigger workflow is implemented with guardrails +- [ ] Drift checks use real production-aligned data + +Gate approver: + +- [ ] Principal architect sign-off + +## F) Phase 4 - Quality, Integration, and Documentation Convergence (Week 8) + +### F1. Test Hardening (C1) + +- [ ] Replace permissive status assertions with strict expected outcomes +- [ ] Add endpoint auth test coverage for operational routes +- [ ] Add contract regression tests for payload schema boundaries + +Evidence: + +- Test diff: +- Test run report: + +### F2. Backend Integration Assurance (C1) + +- [ ] Add backend integration tests for ml-categorization service path +- [ ] Validate fallback behavior and API key propagation +- [ ] Validate endpoint path compatibility between backend and ml-services + +Evidence: + +- Integration test run: +- Endpoint compatibility report: + +### F3. Documentation Parity (C2) + +- [ ] Correct endpoint naming drift in docs and examples +- [ ] Ensure env setup docs match implementation requirements +- [ ] Publish final API contract references and operational runbooks + +Evidence: + +- Docs change set: +- Published references: + +### Phase 4 Gate (Mandatory) + +- [ ] Strict test suite passes in CI +- [ ] Backend integration checks pass +- [ ] Documentation and implementation are aligned + +Gate approver: + +- [ ] Principal architect sign-off + +## G) Cross-Phase Non-Functional Controls + +- [ ] Performance baseline recorded before changes +- [ ] Performance regression threshold defined and monitored +- [ ] Security review completed for auth and rate-limit changes +- [ ] Observability dashboards updated for new endpoints and retraining events +- [ ] Incident response and rollback drills executed at least once + +Evidence: + +- Performance report: +- Security review: +- Observability update: +- Drill report: + +## H) Final Release Readiness Checklist + +- [ ] All phase gates approved +- [ ] No open C0 or C1 defects +- [ ] CI pipeline green on required jobs +- [ ] Deployment manifests validated in target environment +- [ ] Stakeholder sign-off captured (ML Lead, Platform Lead, Backend Lead, QA, SRE) + +Release decision: + +- [ ] Go +- [ ] No-go + +Decision notes: + + +## I) Post-Release Validation (First 7 Days) + +- [ ] Verify no failed scheduled retraining runs +- [ ] Verify no unauthorized access attempts are accepted +- [ ] Verify probe behavior during one controlled dependency disruption test +- [ ] Verify no endpoint contract mismatch incidents from backend clients +- [ ] Verify drift monitoring and retraining controls produce expected telemetry + +Post-release owner: + +Post-release report link: diff --git a/ml-services-execution-plan/ML_SERVICES_EXECUTIVE_PLAN.md b/ml-services-execution-plan/ML_SERVICES_EXECUTIVE_PLAN.md new file mode 100644 index 0000000..bc0f27a --- /dev/null +++ b/ml-services-execution-plan/ML_SERVICES_EXECUTIVE_PLAN.md @@ -0,0 +1,79 @@ +# ML Services Executive Plan + +Document owner: Principal Architecture Office +Document date: 2026-03-17 +Execution package: docs/ml-services-execution-plan +Status: Approved draft baseline + +## 1) Purpose + +This document is the executive control anchor for the ML services remediation program. + +It links strategy, execution checklist, and sprint tickets into one governed package so implementation can start without ambiguity. + +## 2) Package Structure + +- Strategy roadmap: ML_SERVICES_REMEDIATION_ROADMAP.md +- Execution checklist: ML_SERVICES_EXECUTION_CHECKLIST.md +- Sprint-wise ticket plan: SPRINT_WISE_TICKET_PLAN.md +- Executive control anchor: ML_SERVICES_EXECUTIVE_PLAN.md + +## 3) Program Mission + +1. Recover critical reliability paths for training and deployment. +2. Harden runtime security and probe semantics. +3. Enforce API and data contracts across services. +4. Complete retraining control-plane capability. +5. Institutionalize release quality gates to prevent regression. + +## 4) Governance Model + +- Program sponsor: Principal Architect +- Technical owners: ML Services Lead, Platform Lead, Backend Lead +- Quality and operations owners: QA Lead, SRE Lead +- Control cadence: Weekly phase gate and risk review + +## 5) Phase and Sprint Mapping + +- Sprint 1: Phase 0 and critical subset of Phase 1 +- Sprint 2: Remaining Phase 1 and full Phase 2 +- Sprint 3: Phase 3 and Phase 4 closeout + +Reference detail: SPRINT_WISE_TICKET_PLAN.md + +## 6) Decision Gates + +- Gate G1: Critical path stability proven +- Gate G2: Security and runtime hardening proven +- Gate G3: Contract governance and validation proven +- Gate G4: Retraining control plane and release convergence proven + +No gate may be closed without objective evidence captured in the execution checklist. + +## 7) Audit Completion Status (Requested Todo Checkmark) + +The original audit todo stream is fully completed and marked complete. + +- [x] Review architecture and contracts docs +- [x] Audit FastAPI routes/auth/schemas +- [x] Audit data pipeline and features +- [x] Audit training reproducibility and MLflow +- [x] Audit tests ops and deployment +- [x] Audit backend integration touchpoints +- [x] Produce severity findings and gap plan + +## 8) Executive KPIs + +- 100 percent success for intent and credit retraining DAG runs across two consecutive schedules +- 0 build failures for model-server image in four consecutive CI runs +- 100 percent protection of non-health operational endpoints +- 0 unresolved docs and endpoint contract mismatches at release gate + +## 9) Approval and Next Action + +Decision: + +- [ ] Approve execution baseline +- [ ] Request revision + +If approved, execution begins with Sprint 1 tickets in SPRINT_WISE_TICKET_PLAN.md and evidence capture in ML_SERVICES_EXECUTION_CHECKLIST.md. diff --git a/ml-services-execution-plan/ML_SERVICES_REMEDIATION_ROADMAP.md b/ml-services-execution-plan/ML_SERVICES_REMEDIATION_ROADMAP.md new file mode 100644 index 0000000..6d83ac6 --- /dev/null +++ b/ml-services-execution-plan/ML_SERVICES_REMEDIATION_ROADMAP.md @@ -0,0 +1,247 @@ +# Nivesh ML Services Remediation Roadmap + +Document owner: Platform Architecture and ML Engineering +Document date: 2026-03-17 +Scope: ml-services primary, backend integration touchpoints secondary +Status: Draft for execution approval + +Execution package links: + +- Executive plan: ML_SERVICES_EXECUTIVE_PLAN.md +- Execution checklist: ML_SERVICES_EXECUTION_CHECKLIST.md +- Sprint ticket plan: SPRINT_WISE_TICKET_PLAN.md + +## 1) Executive Summary + +This roadmap converts the completed engineering audit into an execution plan that restores reliability, security, and integration integrity across ml-services and its backend consumers. + +Priority order is: + +1. Restore broken training and deployment paths (Critical) +2. Close security and runtime hardening gaps (Major) +3. Establish contract governance and retraining control plane maturity (Major) +4. Strengthen test and release governance to prevent recurrence (Major and Minor) + +## 2) Audit-Derived Problem Statement + +### Critical Findings + +- Airflow DAG to trainer interface mismatches break scheduled training for intent and credit risk +- Credit and intent training DAG schemas drift from actual dataset fields +- Container build path mismatches prevent stable image build for model-server + +### Major Findings + +- Inconsistent authentication coverage on monitoring and admin surfaces +- Readiness and liveness probes are mapped to shallow health checks +- Drift monitor produces advisory recommendations but does not complete an operational retraining trigger loop +- Environment contract drift between backend integration expectations and example environment files +- Weakly typed request contracts in key prediction flows, with validation modules not integrated into execution paths +- Documentation drift for endpoint paths and integration usage +- Test assertions are too permissive for contract-grade confidence + +### Minor Findings + +- OpenAPI exists at runtime but lacks explicit versioned artifact governance in CI +- Example environment templates include legacy or mismatched entries + +## 3) Architecture Principles for Remediation + +1. Contract first: endpoint shape, auth requirements, and response semantics are explicit and versioned. +2. Secure by default: every non-health operational surface is authenticated and rate-limited. +3. Operable by design: readiness, liveness, and startup semantics reflect real dependency states. +4. Reproducible ML lifecycle: training runs are deterministic, traceable, and promotable. +5. Controlled change: docs, code, tests, and deployment manifests move together. +6. Evidence over assumptions: every phase closes with measurable acceptance gates. + +## 4) Target Outcomes + +- Scheduled retraining pipelines run without schema or interface failures. +- Model-server images build and deploy consistently across local, CI, and Kubernetes. +- Operational endpoints are protected consistently with API key and rate limiting policy. +- Probes reflect actual service readiness and reduce false healthy routing. +- Drift monitoring can trigger an actionable retraining path (manual and policy-driven automation). +- Backend and ml-services environment and endpoint contracts are synchronized. +- CI blocks regressions with stricter contract and integration checks. + +## 5) Workstreams + +### Workstream A: Training Orchestration Reliability + +Goal: Restore DAG-to-training compatibility and data schema alignment. + +### Workstream B: Build and Deployment Integrity + +Goal: Ensure compose and Docker artifacts are internally consistent and runnable. + +### Workstream C: Security and Runtime Hardening + +Goal: Apply consistent auth controls and probe semantics to runtime surfaces. + +### Workstream D: Contract and Data Governance + +Goal: Replace weak payload schemas with explicit models and enforce validation boundaries. + +### Workstream E: Retraining Control Plane + +Goal: Complete schedule + drift + manual retraining trigger capability. + +### Workstream F: Integration and Release Governance + +Goal: Align backend contracts, tests, docs, and CI quality gates. + +## 6) Phased Delivery Plan + +## Phase 0 - Stabilize Critical Paths (Week 1) + +Objectives: + +- Repair intent DAG schema and train function invocation mismatches. +- Repair credit DAG schema assumptions and trainer invocation interface. +- Resolve Docker compose and Dockerfile path/dependency mismatches. + +Deliverables: + +- Passing DAG dry-runs for intent and credit retraining. +- Successful model-server image build in local and CI environments. + +Exit criteria: + +- No runtime exceptions in DAG training invocation path. +- Build artifacts generated from canonical Docker definitions. + +## Phase 1 - Security and Runtime Hardening (Week 2 to Week 3) + +Objectives: + +- Enforce auth and rate-limit dependencies on monitoring and admin endpoints. +- Align Kubernetes and Helm probe paths with readiness and liveness semantics. +- Align env templates with backend and ml-services integration contracts. + +Deliverables: + +- Unified endpoint security matrix. +- Updated deployment manifests and successful probe behavior validation. +- Updated backend and ml-services example env files. + +Exit criteria: + +- Unauthorized requests to protected operational endpoints are rejected. +- Readiness fails when dependencies are unavailable; liveness remains lightweight. + +## Phase 2 - Contract and Validation Governance (Week 4 to Week 5) + +Objectives: + +- Replace generic payload dictionaries with strict request and response models. +- Integrate data_validation checks into inference and retraining boundaries. +- Introduce OpenAPI artifact generation and contract drift checks in CI. + +Deliverables: + +- Typed schemas for anomaly and credit request payloads. +- Validation policy enforcement for malformed payloads. +- Versioned OpenAPI output committed or attached in CI. + +Exit criteria: + +- Contract tests fail fast on schema drift. +- Ambiguous payload acceptance paths removed. + +## Phase 3 - Retraining Control Plane Completion (Week 6 to Week 7) + +Objectives: + +- Add authenticated manual retrain endpoint(s) for operational control. +- Connect drift signals to operationally safe retraining trigger workflow. +- Replace simulated production drift input with real data source connectors. + +Deliverables: + +- Manual retrain API and runbook. +- Drift-trigger policy configuration with guardrails. +- Real production data extraction path for drift checks. + +Exit criteria: + +- Retrain can be triggered manually with traceable audit metadata. +- Drift alerts can trigger a controlled retraining action path. + +## Phase 4 - Quality Gate and Documentation Convergence (Week 8) + +Objectives: + +- Tighten permissive tests to contract-strict assertions. +- Add backend integration tests for ml-categorization path. +- Remove endpoint and config drift in documentation. + +Deliverables: + +- Updated test suite with strict response expectations. +- Backend integration tests for ML_SERVICE_URL and ML_API_KEY usage. +- Documentation parity pack for endpoint paths and auth requirements. + +Exit criteria: + +- CI fails on contract regressions. +- No known documentation contradictions for ML endpoint usage. + +## 7) Milestones and Governance Gates + +Milestone M1: Critical path recovered (end of Week 1) + +- DAG reliability restored for intent and credit +- model-server build path corrected + +Milestone M2: Runtime and security baseline achieved (end of Week 3) + +- Operational endpoint auth consistency complete +- probe semantics aligned in deployment manifests + +Milestone M3: Contract discipline established (end of Week 5) + +- strict schemas and validation integrated +- OpenAPI contract governance in CI + +Milestone M4: Control plane and release discipline complete (end of Week 8) + +- retraining trigger triad complete +- docs and tests synchronized with implementation + +## 8) Roles and Ownership Model + +- Principal Architect: phase gate approvals, cross-workstream dependency arbitration +- ML Services Lead: Workstreams A, D, E technical delivery +- Platform and DevOps Lead: Workstream B and probe/deploy reliability +- Backend Lead: Workstream F integration and consumer contract alignment +- QA and SRE: acceptance evidence, non-functional checks, release readiness + +## 9) Risks and Mitigations + +Risk: Tight schema enforcement may break existing loose clients. +Mitigation: introduce compatibility window with explicit deprecation schedule and integration tests. + +Risk: Drift-trigger automation can produce retraining noise. +Mitigation: policy thresholds, cool-down windows, and approval gates before production promotion. + +Risk: Security hardening may impact observability tooling. +Mitigation: service-to-service API keys and monitoring credential rollout plan. + +Risk: Multi-repo contract alignment delays release. +Mitigation: shared contract checklist and single change window for env and docs updates. + +## 10) Success Metrics + +- 100 percent success in scheduled intent and credit retraining DAG executions for two consecutive cycles. +- 0 unresolved model-server image build failures in CI for four consecutive runs. +- 100 percent of non-health operational endpoints protected by auth policy. +- 0 probe-related false healthy incidents after readiness/liveness correction. +- 0 undocumented endpoint path discrepancies between docs and runtime routes. +- Contract tests and integration tests pass with strict assertions in mainline CI. + +## 11) Approval and Next Decision + +Decision requested: + +- Approve roadmap phases and gate criteria. +- Authorize execution starting with Phase 0 critical path stabilization. diff --git a/ml-services-execution-plan/SPRINT_WISE_TICKET_PLAN.md b/ml-services-execution-plan/SPRINT_WISE_TICKET_PLAN.md new file mode 100644 index 0000000..01f68eb --- /dev/null +++ b/ml-services-execution-plan/SPRINT_WISE_TICKET_PLAN.md @@ -0,0 +1,259 @@ +# Sprint-Wise Ticket Plan + +Document owner: ML Services Program Management +Document date: 2026-03-17 +Parent executive plan: ML_SERVICES_EXECUTIVE_PLAN.md +Linked checklist: ML_SERVICES_EXECUTION_CHECKLIST.md +Linked roadmap: ML_SERVICES_REMEDIATION_ROADMAP.md + +Ticket prefix: MLS +Priority model: C0 critical, C1 high, C2 medium + +## Sprint 1 - Critical Path Recovery + +Sprint objective: make training orchestration and build pipeline operational. + +### MLS-001 (C0) Align intent DAG dataset contract + +- Type: Engineering +- Owner role: ML Engineer +- Depends on: none +- Scope: + - Update intent DAG required columns to match training dataset schema. + - Validate data checks and XCom outputs. +- Definition of done: + - Intent DAG validation step passes with real dataset. +- Acceptance evidence: + - DAG dry-run log and task success snapshot. + +### MLS-002 (C0) Align intent DAG trainer invocation + +- Type: Engineering +- Owner role: ML Engineer +- Depends on: MLS-001 +- Scope: + - Align DAG call with actual trainer function signature and return shape. +- Definition of done: + - Training task executes without invocation mismatch. +- Acceptance evidence: + - Airflow task logs, function signature diff. + +### MLS-003 (C0) Align credit DAG schema and target contract + +- Type: Engineering +- Owner role: ML Engineer +- Depends on: none +- Scope: + - Reconcile expected columns in credit DAG with actual credit dataset. + - Align target field naming to model training expectations. +- Definition of done: + - Credit validation and feature steps pass against dataset. +- Acceptance evidence: + - DAG dry-run log and dataset contract note. + +### MLS-004 (C0) Align credit DAG trainer interface + +- Type: Engineering +- Owner role: ML Engineer +- Depends on: MLS-003 +- Scope: + - Provide callable training interface compatible with DAG path. +- Definition of done: + - Credit train task executes and records run metadata. +- Acceptance evidence: + - Task logs and MLflow run reference. + +### MLS-005 (C0) Fix model-server container build wiring + +- Type: Engineering +- Owner role: Platform Engineer +- Depends on: none +- Scope: + - Correct docker-compose dockerfile reference. + - Correct Dockerfile requirement source to existing dependency file. +- Definition of done: + - Local and CI model-server image build succeeds. +- Acceptance evidence: + - Build logs and CI run URL. + +### Sprint 1 Exit Gate + +- MLS-001 to MLS-005 complete +- No unresolved C0 defect in training or build path + +## Sprint 2 - Security and Contract Governance + +Sprint objective: secure operational surfaces and enforce stricter API contracts. + +### MLS-006 (C1) Apply auth policy to operational endpoints + +- Type: Engineering +- Owner role: ML Engineer +- Depends on: MLS-005 +- Scope: + - Add API key and rate limiting to monitoring and admin routes. + - Apply equivalent controls to drift router endpoints. +- Definition of done: + - Unauthorized access rejected on protected operational endpoints. +- Acceptance evidence: + - Endpoint matrix and negative auth tests. + +### MLS-007 (C1) Correct readiness and liveness probes + +- Type: Engineering +- Owner role: Platform Engineer +- Depends on: MLS-006 +- Scope: + - Update Kubernetes and Helm probe paths to readiness and liveness endpoints. +- Definition of done: + - Probe behavior validated under dependency-ready and dependency-failed states. +- Acceptance evidence: + - Manifest diffs and runtime probe verification logs. + +### MLS-008 (C1) Align environment contract templates + +- Type: Engineering +- Owner role: Backend Engineer +- Depends on: MLS-006 +- Scope: + - Update backend and ml-services env examples with required ML integration variables. +- Definition of done: + - Environment examples match implementation contract. +- Acceptance evidence: + - Updated env examples and review sign-off. + +### MLS-009 (C1) Replace weak payload dictionaries with explicit models + +- Type: Engineering +- Owner role: ML Engineer +- Depends on: MLS-006 +- Scope: + - Introduce strict request and response models for critical endpoints. +- Definition of done: + - Contract tests validate strict schema behavior. +- Acceptance evidence: + - Schema diff and test output. + +### MLS-010 (C1) Integrate data validation boundary checks + +- Type: Engineering +- Owner role: ML Engineer +- Depends on: MLS-009 +- Scope: + - Integrate data_validation rules into inference and retraining input paths. +- Definition of done: + - Invalid payload and invalid data inputs fail at boundary with expected error. +- Acceptance evidence: + - Failure-mode test suite and logs. + +### MLS-011 (C2) Add OpenAPI contract governance in CI + +- Type: Engineering +- Owner role: Platform Engineer +- Depends on: MLS-009 +- Scope: + - Generate OpenAPI artifact and enforce change review guard. +- Definition of done: + - CI fails on unreviewed contract drift. +- Acceptance evidence: + - CI workflow update and sample drift failure run. + +### Sprint 2 Exit Gate + +- MLS-006 to MLS-011 complete +- Security and contract governance baseline signed off + +## Sprint 3 - Retraining Control Plane and Release Convergence + +Sprint objective: complete retraining trigger model, harden integration tests, and finalize release readiness. + +### MLS-012 (C1) Implement manual retraining endpoint + +- Type: Engineering +- Owner role: ML Engineer +- Depends on: MLS-010 +- Scope: + - Add authenticated manual retrain endpoint with audit metadata capture. +- Definition of done: + - Operators can trigger and trace retraining securely. +- Acceptance evidence: + - API tests and operation runbook excerpt. + +### MLS-013 (C1) Connect drift alerts to controlled retraining trigger flow + +- Type: Engineering +- Owner role: ML Engineer +- Depends on: MLS-012 +- Scope: + - Introduce policy thresholds, cooldown, and safe trigger orchestration. +- Definition of done: + - Drift-to-retrain flow passes controlled simulation tests. +- Acceptance evidence: + - End-to-end test report and policy config artifact. + +### MLS-014 (C1) Replace simulated drift input with production data source adapter + +- Type: Engineering +- Owner role: Data Engineer +- Depends on: MLS-013 +- Scope: + - Integrate production data retrieval path for drift checks. +- Definition of done: + - Drift pipeline uses production-aligned data source and passes validation checks. +- Acceptance evidence: + - Data adapter logs and validation report. + +### MLS-015 (C1) Add backend ML integration tests + +- Type: Engineering +- Owner role: Backend Engineer +- Depends on: MLS-008, MLS-009 +- Scope: + - Test ml-categorization integration path with ML_SERVICE_URL, API key, and fallback behavior. +- Definition of done: + - Backend integration tests pass in CI. +- Acceptance evidence: + - CI run and test report. + +### MLS-016 (C1) Tighten permissive test assertions + +- Type: Engineering +- Owner role: QA Engineer +- Depends on: MLS-009, MLS-015 +- Scope: + - Replace permissive status checks with strict contract expectations. +- Definition of done: + - Contract and integration suites are strict and stable. +- Acceptance evidence: + - Test diff and full suite run output. + +### MLS-017 (C2) Documentation convergence and release pack + +- Type: Documentation +- Owner role: Tech Writer or Engineering Owner +- Depends on: MLS-008, MLS-011, MLS-016 +- Scope: + - Resolve endpoint naming drift. + - Publish final contract and operational runbook references. +- Definition of done: + - Docs are implementation-aligned and reviewed. +- Acceptance evidence: + - Documentation change set and reviewer approvals. + +### Sprint 3 Exit Gate + +- MLS-012 to MLS-017 complete +- All release readiness checks in execution checklist passed +- Stakeholder Go decision recorded + +## Delivery Tracking Template + +For each ticket, capture: + +- Ticket ID: +- Status: +- Owner: +- Planned date: +- Actual completion date: +- Evidence link: +- Risks or blockers: diff --git a/ml-services/requirements.txt b/ml-services/requirements.txt deleted file mode 100644 index 37b4435..0000000 --- a/ml-services/requirements.txt +++ /dev/null @@ -1,192 +0,0 @@ -# Python ML Services for Nivesh - Production Ready -# Version: 2.0.0 -# Last Updated: January 27, 2026 -# Python Version: 3.10+ - -# ========================================== -# Core ML Libraries -# ========================================== -# PyTorch (CPU version - use GPU index-url for CUDA) -# For GPU: --index-url https://download.pytorch.org/whl/cu118 -torch==2.2.0 -torchvision==0.17.0 -torchaudio==2.2.0 - -# ========================================== -# Transformers & NLP -# ========================================== -transformers==4.37.2 -sentence-transformers==2.3.1 -spacy==3.7.2 -tokenizers==0.15.2 -# Download model: python -m spacy download en_core_web_sm - -# ========================================== -# Time Series & Forecasting -# ========================================== -prophet==1.1.5 -statsmodels==0.14.1 -pmdarima==2.0.4 # Auto ARIMA - -# ========================================== -# Traditional ML -# ========================================== -scikit-learn==1.4.0 -xgboost==2.0.3 -lightgbm==4.2.0 -catboost==1.2.2 -imbalanced-learn==0.12.0 # Handle imbalanced datasets - -# ========================================== -# LLM & Generative AI (Local via Ollama) -# ========================================== -# No google-generativeai needed - using local LLM models -# LLaMA-3-8B-Instruct and Mistral-7B-Instruct via Ollama HTTP API -requests>=2.31.0 -openai==1.10.0 - -# ========================================== -# Feature Engineering & Data Processing -# ========================================== -pandas==2.2.0 -numpy==1.26.3 -scipy==1.12.0 -polars==0.20.7 # Fast DataFrame operations -pyarrow==14.0.2 -featuretools==1.30.0 # Automated feature engineering - -# ========================================== -# MLOps & Experiment Tracking -# ========================================== -mlflow==2.10.2 -optuna==3.5.0 -evidently==0.4.17 -# dvc==3.40.0 # Data versioning — run in CI/pipelines, not in the API container -# great-expectations==0.18.8 # Data validation — run in CI/pipelines, not in the API container - -# ========================================== -# Model Serving & API -# ========================================== -fastapi==0.109.2 -uvicorn[standard]==0.27.1 -gunicorn==21.2.0 -pydantic==2.6.1 -pydantic-settings==2.1.0 -starlette==0.36.3 - -# ========================================== -# Vector DB & Embeddings -# ========================================== -qdrant-client==1.7.3 -chromadb==0.4.22 -faiss-cpu==1.7.4 # For similarity search - -# ========================================== -# Caching & Storage -# ========================================== -redis==5.0.1 -hiredis==2.2.3 # Redis performance boost -boto3==1.34.51 # AWS S3 -google-cloud-storage==2.14.0 # GCS - -# ========================================== -# Monitoring & Observability -# ========================================== -prometheus-client==0.19.0 -opentelemetry-api==1.22.0 -opentelemetry-sdk==1.22.0 -opentelemetry-instrumentation-fastapi==0.43b0 - -# ========================================== -# Utilities -# ========================================== -python-dotenv==1.0.0 -requests==2.31.0 -httpx==0.26.0 -pyyaml==6.0.1 -joblib==1.3.2 -tqdm==4.66.1 -click==8.1.7 # CLI tools -python-json-logger==2.0.7 # Structured logging - -# ========================================== -# Database Connectors -# ========================================== -psycopg2-binary==2.9.9 -asyncpg==0.29.0 -sqlalchemy==2.0.25 -alembic==1.13.1 # Database migrations - -# ========================================== -# Workflow Orchestration -# NOTE: Apache Airflow is NOT installed here — it runs in the dedicated -# airflow-webserver / airflow-scheduler Docker containers. -# The ml-services code is mounted into those containers via volume. -# ========================================== - -# ========================================== -# Model Export & Optimization -# ========================================== -onnx==1.15.0 -onnxruntime==1.16.3 -onnxmltools==1.12.0 -optimum==1.16.2 # Model optimization - -# ========================================== -# Additional ML Utilities -# ========================================== -nltk==3.8.1 -matplotlib==3.8.2 -seaborn==0.13.1 -plotly==5.18.0 -shap==0.44.1 # Model explainability -lime==0.2.0.1 # Model interpretability - -# ========================================== -# API & Communication -# ========================================== -python-multipart==0.0.6 -websockets==12.0 -aiofiles==23.2.1 - -# ========================================== -# Testing & Quality -# NOTE: Test dependencies are NOT installed in the production container. -# Run tests locally or in a separate test stage. -# ========================================== -# pytest==8.0.0 -# pytest-asyncio==0.23.4 -# pytest-cov==4.1.0 -# pytest-mock==3.12.0 -# locust==2.20.1 # Load testing -faker==22.6.0 # Generate test data - -# ========================================== -# Code Quality & Formatting -# ========================================== -black==24.1.1 -flake8==7.0.0 -mypy==1.8.0 -pylint==3.0.3 -isort==5.13.2 -pre-commit==3.6.0 - -# ========================================== -# Security -# ========================================== -bandit==1.7.6 # Security linting -safety==3.0.1 # Dependency vulnerability scanning - -# ========================================== -# Additional Dependencies -# ========================================== -# Regex for NLP -regex==2023.12.25 -# Safe tensors for model storage -safetensors==0.4.2 -# Caching utilities -cachetools==5.3.2 -# Rate limiting -slowapi==0.1.9 -# JSON schema validation -jsonschema==4.21.1 diff --git a/mobile_design/SOP_NIVESH_MOBILE_APP.md b/mobile_design/SOP_NIVESH_MOBILE_APP.md deleted file mode 100644 index 92fb023..0000000 --- a/mobile_design/SOP_NIVESH_MOBILE_APP.md +++ /dev/null @@ -1,1934 +0,0 @@ -# NIVESH — Mobile App SOP (Standard Operating Procedure) - -## Production-Grade React Native Frontend — UI/UX Blueprint - -> **Version:** 1.0 -> **Date:** March 11, 2026 -> **Platform:** React Native (Expo SDK 52+) -> **Target:** iOS 15+ / Android 12+ (API 31+) -> **Language:** TypeScript -> **Design System:** Nivesh Design Language (NDL) - ---- - -## TABLE OF CONTENTS - -1. [Design Philosophy & Brand Identity](#1-design-philosophy--brand-identity) -2. [Color System & Theme Architecture](#2-color-system--theme-architecture) -3. [Typography System](#3-typography-system) -4. [Spacing, Grid & Layout System](#4-spacing-grid--layout-system) -5. [Iconography & Illustration System](#5-iconography--illustration-system) -6. [Component Architecture](#6-component-architecture) -7. [Complete Screen Inventory](#7-complete-screen-inventory) -8. [Application Flow & Navigation Architecture](#8-application-flow--navigation-architecture) -9. [Screen-by-Screen Specification](#9-screen-by-screen-specification) -10. [Micro-Interactions & Animation Guide](#10-micro-interactions--animation-guide) -11. [Accessibility Standards](#11-accessibility-standards) -12. [Project Structure & File Organization](#12-project-structure--file-organization) -13. [Implementation Phases](#13-implementation-phases) -14. [Quality Checklist](#14-quality-checklist) - ---- - -## 1. DESIGN PHILOSOPHY & BRAND IDENTITY - -### 1.1 Brand Personality - -**Nivesh = Trusted Financial Companion (not a cold dashboard tool)** - -| Trait | Expression | -|-------|-----------| -| **Trustworthy** | Soft, warm color palette; no aggressive red/green for gains/losses; calm beige tones | -| **Intelligent** | Clean typography, structured information hierarchy, purposeful whitespace | -| **Indian-First** | ₹ as default currency, Hindi language support, UPI/Aadhaar/PAN flows, Indian holidays awareness | -| **Conversational** | Chat-first interface, friendly tone, suggestion chips, AI assistant personality | -| **Empowering** | Decision-oriented UI (not just data display), clear CTAs, action-first design | - -### 1.2 Design Principles - -1. **Decisions > Dashboards** — Every screen must lead to an action, not just information -2. **Clarity > Complexity** — Financial data simplified; progressive disclosure for depth -3. **Trust by Design** — Assumptions always visible; explainability built into every AI response -4. **Indian Context First** — Tax years (Apr–Mar), Indian investment instruments (MF/SIP/FD/PPF/NPS), UPI-native -5. **Conversational Finance** — Chat is the primary interface, screens are secondary navigation -6. **Motion with Purpose** — Every animation conveys meaning (loading, success, transition, attention) - -### 1.3 Storyline & Emotional Arc - -The app follows a **"Financial Awakening"** narrative: - -``` -ONBOARDING → "I'm confused about money" - ↓ -DISCOVERY → "Now I see my full picture" - ↓ -UNDERSTANDING → "I understand where I stand" - ↓ -PLANNING → "I have a clear plan" - ↓ -ACTION → "I'm making smart moves" - ↓ -CONFIDENCE → "I'm on track and in control" -``` - -Each screen maps to a stage in this emotional journey. - ---- - -## 2. COLOR SYSTEM & THEME ARCHITECTURE - -### 2.1 Primary Palette (Beige Tetradic) - -Derived from the brand palette — warm, calming, finance-appropriate: - -| Token | Hex | Usage | -|-------|-----|-------| -| `beige.50` | `#FAF8F0` | Page backgrounds, canvas | -| `beige.100` | `#F5F0E1` | Card backgrounds | -| `beige.200` | `#EDE8D0` | **Primary beige** — section backgrounds, subtle fills | -| `beige.300` | `#E0D9BF` | Borders, dividers | -| `beige.400` | `#C9C1A4` | Disabled text, muted elements | -| `beige.500` | `#A89E7E` | Secondary text | -| `mint.100` | `#E8F5EC` | Positive state backgrounds | -| `mint.200` | `#D0EDDA` | **Primary mint** — success, income, positive values | -| `mint.300` | `#A8D9B8` | Success accents | -| `lavender.100` | `#E8E9F5` | Info state backgrounds | -| `lavender.200` | `#D0D5ED` | **Primary lavender** — informational, analytics, AI elements | -| `lavender.300` | `#B0B8D9` | Chart accents, secondary indicators | -| `rose.100` | `#F5E8EE` | Warning/negative state backgrounds | -| `rose.200` | `#EDD0E4` | **Primary rose** — alerts, expenses, negative values | -| `rose.300` | `#D9A8C4` | Alert accents | - -### 2.2 Functional Colors - -| Token | Light Mode | Dark Mode | Usage | -|-------|-----------|-----------|-------| -| `primary` | `#1A1A2E` | `#F5F0E1` | Primary text, headings | -| `secondary` | `#6B6B80` | `#A0A0B0` | Secondary text, labels | -| `accent` | `#F5C518` | `#F5C518` | **Yellow accent** — CTAs, primary buttons, highlights | -| `accentPressed` | `#E0B200` | `#E0B200` | Button pressed state | -| `surface` | `#FFFFFF` | `#1A1A2E` | Cards, modals, sheets | -| `background` | `#FAF8F0` | `#0D0D1A` | App background | -| `income` | `#2E9E5A` | `#4ADE80` | Income indicators | -| `expense` | `#D64545` | `#F87171` | Expense indicators | -| `border` | `#E5E5E5` | `#2A2A3E` | Borders, separators | -| `overlay` | `rgba(0,0,0,0.5)` | `rgba(0,0,0,0.7)` | Modal overlays | - -### 2.3 Gradient Definitions - -``` -cardGradient: ['#F5F0E1', '#FAF8F0'] → Card premium feel -heroGradient: ['#EDE8D0', '#D0EDDA'] → Onboarding hero -aiGradient: ['#D0D5ED', '#E8E9F5'] → AI/Chat backgrounds -alertGradient: ['#EDD0E4', '#F5E8EE'] → Alert/Warning cards -accentGradient: ['#F5C518', '#FFD84D'] → Primary CTA buttons -``` - -### 2.4 Dark Mode Strategy - -- **Not inverted** — carefully mapped dark palette maintaining brand warmth -- Beige tones become deep navy (`#1A1A2E`, `#0D0D1A`) -- Accent yellow remains constant across themes -- Cards elevate via subtle light borders, not shadows - ---- - -## 3. TYPOGRAPHY SYSTEM - -### 3.1 Font Family - -| Weight | Font | Usage | -|--------|------|-------| -| Regular (400) | `Inter-Regular` | Body text, descriptions | -| Medium (500) | `Inter-Medium` | Labels, secondary headings | -| SemiBold (600) | `Inter-SemiBold` | Subheadings, card titles | -| Bold (700) | `Inter-Bold` | Headings, amounts, emphasis | -| ExtraBold (800) | `Inter-ExtraBold` | Hero numbers, large balance display | - -**Hindi Support:** `Noto Sans Devanagari` as fallback for Hindi text rendering. - -### 3.2 Type Scale - -| Token | Size | Line Height | Weight | Usage | -|-------|------|-------------|--------|-------| -| `displayLarge` | 40px | 48px | ExtraBold | Balance hero on home | -| `displayMedium` | 32px | 40px | Bold | Section heroes | -| `displaySmall` | 28px | 36px | Bold | Page titles | -| `headingLarge` | 24px | 32px | SemiBold | Card titles, amounts | -| `headingMedium` | 20px | 28px | SemiBold | Section headings | -| `headingSmall` | 18px | 24px | SemiBold | Sub-section headings | -| `bodyLarge` | 16px | 24px | Regular | Primary body text | -| `bodyMedium` | 14px | 20px | Regular | Secondary body, descriptions | -| `bodySmall` | 12px | 16px | Regular | Captions, timestamps | -| `labelLarge` | 14px | 20px | Medium | Button labels, tabs | -| `labelMedium` | 12px | 16px | Medium | Tags, badges, small labels | -| `labelSmall` | 10px | 14px | Medium | Micro labels, overline text | - -### 3.3 Amount Formatting (Indian Context) - -``` -₹1,00,000.00 → Indian number system (lakhs/crores) -₹40,500.80 → Standard display -₹1.2L → Abbreviated (lakhs) -₹2.5Cr → Abbreviated (crores) -+₹5,400 → Income (green, with + prefix) --₹3,543 → Expense (red, with - prefix) -``` - ---- - -## 4. SPACING, GRID & LAYOUT SYSTEM - -### 4.1 Spacing Scale (4px base) - -| Token | Value | Usage | -|-------|-------|-------| -| `xs` | 4px | Tight spacing, icon gaps | -| `sm` | 8px | Inline element spacing | -| `md` | 12px | Component internal padding | -| `base` | 16px | Standard padding, gaps | -| `lg` | 20px | Section spacing | -| `xl` | 24px | Card padding | -| `2xl` | 32px | Section margins | -| `3xl` | 40px | Page-level spacing | -| `4xl` | 48px | Hero spacing | -| `5xl` | 64px | Major section breaks | - -### 4.2 Layout Grid - -- **Screen max-width:** Full device width -- **Horizontal padding:** 16px (each side) = 32px total -- **Card border-radius:** 16px (large), 12px (medium), 8px (small) -- **Button border-radius:** 24px (pill), 12px (rounded rect) -- **Shadow (Light):** `0 2px 8px rgba(0,0,0,0.06)` -- **Shadow (Dark):** `0 1px 4px rgba(0,0,0,0.3)` - -### 4.3 Safe Areas - -- **Status bar:** Dynamic (notch-aware via `SafeAreaView`) -- **Bottom navigation:** 56px + home indicator padding -- **Keyboard avoidance:** `KeyboardAvoidingView` with `behavior="padding"` - ---- - -## 5. ICONOGRAPHY & ILLUSTRATION SYSTEM - -### 5.1 Icon Library - -**Primary:** `phosphor-react-native` (consistent, well-designed, 6 weights) -**Weight:** Regular (default), Bold (emphasis), Fill (active states in navbar) - -### 5.2 Icon Sizes - -| Token | Size | Usage | -|-------|------|-------| -| `iconXs` | 16px | Inline with small text | -| `iconSm` | 20px | List items, labels | -| `iconMd` | 24px | Standard icons, nav | -| `iconLg` | 32px | Feature icons, cards | -| `iconXl` | 40px | Empty states, hero | -| `iconHero` | 64px | Onboarding, illustrations | - -### 5.3 Indian Financial Iconography - -Custom icon set for Indian-specific elements: -- ₹ Rupee symbol (stylized) -- UPI logo mark -- Aadhaar symbol (verification flows) -- PAN card icon -- SIP/MF fund icons -- FD/RD/PPF instrument icons -- GST/Tax calendar icon - -### 5.4 Illustration Style - -- **Style:** Flat, minimal, with beige/mint/lavender tinted backgrounds -- **Characters:** Diverse Indian representation (skin tones, attire) -- **Scenes:** Financial life moments — first salary, home purchase, retirement, child education -- **AI Avatar:** Geometric/abstract pattern (concentric rings with sparkle — inspired by reference images) - ---- - -## 6. COMPONENT ARCHITECTURE - -### 6.1 Atomic Design Hierarchy - -``` -ATOMS → MOLECULES → ORGANISMS → TEMPLATES → SCREENS -``` - -### 6.2 Atoms (Base Elements) - -| Component | Variants | Props | -|-----------|----------|-------| -| `NText` | display, heading, body, label | size, weight, color, align | -| `NButton` | primary, secondary, outline, ghost, danger | size (sm/md/lg), loading, disabled, icon | -| `NIcon` | — | name, size, color, weight | -| `NInput` | text, password, amount, search, otp | label, error, helper, prefix, suffix | -| `NAvatar` | image, initials, icon | size (sm/md/lg/xl), badge | -| `NBadge` | solid, outline | color, size | -| `NDivider` | horizontal, vertical | spacing, color | -| `NChip` | selectable, filter, suggestion | selected, onPress | -| `NSwitch` | — | value, onToggle | -| `NCheckbox` | — | checked, indeterminate | -| `NRadio` | — | selected, group | -| `NProgressBar` | linear, circular | progress, color, animated | -| `NProgressRing` | — | progress, size, strokeWidth | -| `NSkeleton` | text, circle, rect, card | width, height, animated | -| `NSpinner` | — | size, color | - -### 6.3 Molecules (Composed Components) - -| Component | Description | -|-----------|-------------| -| `AmountDisplay` | Formatted ₹ amount with color coding (+/-), abbreviation support | -| `BalanceCard` | Hero balance with account info, masked number, card brand | -| `TransactionItem` | Transaction row — icon, name, category, amount, timestamp | -| `GoalCard` | Goal name, target, progress ring, deadline | -| `AlertItem` | Alert icon, title, description, action button | -| `QuickAction` | Icon + label circular button (Transfer, Request, Pay, etc.) | -| `AccountSelector` | Dropdown showing bank accounts with balance | -| `CurrencySelector` | Flag + currency name + search | -| `ContactAvatar` | Avatar + name (for frequent transfers) | -| `StatCard` | Label + value + trend arrow + percentage | -| `ChipGroup` | Horizontal scrollable chips (filter/tabs) | -| `SearchBar` | Input with search icon, clear button, voice icon | -| `OTPInput` | 4/6 digit OTP input with auto-focus | -| `PINInput` | 4/6 digit masked PIN entry | -| `BiometricPrompt` | Fingerprint/FaceID authentication modal | -| `DateRangePicker` | Indian fiscal year aware date picker | -| `AmountKeypad` | Custom numeric keypad with ₹ and decimal | -| `SuggestionChip` | AI suggestion pill (tappable quick prompts) | -| `InstrumentBadge` | Investment instrument type indicator (MF/SIP/FD/PPF/NPS) | - -### 6.4 Organisms (Feature Components) - -| Component | Description | -|-----------|-------------| -| `AccountCarousel` | Horizontal scrollable account cards (multi-account) | -| `TransactionList` | Grouped transactions by date, section headers, pull-to-refresh | -| `GoalGrid` | Grid/list view of goals with progress indicators | -| `ChatBubble` | AI/User message with rich content (text, chart, actions) | -| `ChatInputBar` | Text input + voice + attach + send with suggestion chips above | -| `SimulationSlider` | Range slider with real-time chart update | -| `SimulationChart` | Interactive chart (line/bar) with scenario overlays | -| `NotificationGroup` | Grouped notifications by date with action items | -| `SpendingBreakdown` | Pie/donut chart with category legend | -| `IncomeExpenseBar` | Side-by-side income vs expense with visual bars | -| `NetWorthTimeline` | Line chart showing net worth over time | -| `InvestmentPortfolio` | Portfolio allocation donut + instrument list | -| `BillReminderCard` | Upcoming bill with amount, due date, pay button | -| `FinancialHealthScore` | Animated score gauge with breakdown factors | -| `AIInsightCard` | AI-generated insight with explanation, actions, dismiss | -| `ExplainabilityPanel` | Expandable panel: assumptions, risks, alternatives | -| `QuickTransferBar` | Horizontal scroll of recent transfer contacts | - -### 6.5 Templates (Screen Layouts) - -| Template | Structure | -|----------|-----------| -| `AuthScreenTemplate` | Logo + illustration + form + CTA + footer link | -| `DashboardTemplate` | Header (greeting + avatar) + scroll body + sticky bottom nav | -| `DetailScreenTemplate` | Back header + hero section + scrollable content + bottom CTA | -| `ChatScreenTemplate` | Header + message list + input bar (keyboard-aware) | -| `SettingsScreenTemplate` | Header + grouped list sections | -| `ModalTemplate` | Overlay + card content + action buttons | -| `BottomSheetTemplate` | Drag handle + content + optional sticky footer | - ---- - -## 7. COMPLETE SCREEN INVENTORY - -### 7.1 Screen Count Summary - -| Module | Screens | Priority | -|--------|---------|----------| -| Onboarding & Auth | 12 | P0 | -| Home & Dashboard | 5 | P0 | -| AI Chat & Assistant | 6 | P0 | -| Transactions | 8 | P0 | -| Goals & Planning | 7 | P1 | -| Investments & Portfolio | 8 | P1 | -| Simulations | 6 | P0 | -| Transfers & Payments | 10 | P1 | -| Alerts & Notifications | 4 | P1 | -| Profile & Settings | 8 | P2 | -| Reports & Export | 4 | P2 | -| Bills & Subscriptions | 5 | P2 | -| **TOTAL** | **83** | — | - -### 7.2 Complete Screen List - -#### MODULE 1: Onboarding & Authentication (12 screens) - -| # | Screen | Route | Description | -|---|--------|-------|-------------| -| 1.1 | Splash Screen | `/` | Animated Nivesh logo + tagline | -| 1.2 | Welcome Carousel | `/welcome` | 3-slide value proposition storytelling | -| 1.3 | Language Selection | `/language` | Hindi/English/Regional language picker | -| 1.4 | Sign Up | `/auth/signup` | Mobile number + OTP (Indian-first) | -| 1.5 | OTP Verification | `/auth/otp` | 6-digit OTP input with timer | -| 1.6 | Create PIN | `/auth/create-pin` | 4-digit app PIN setup | -| 1.7 | Confirm PIN | `/auth/confirm-pin` | PIN confirmation | -| 1.8 | Biometric Setup | `/auth/biometric` | Enable fingerprint/Face ID prompt | -| 1.9 | KYC Lite | `/auth/kyc` | PAN + basic details (name, DOB, email) | -| 1.10 | Bank Linking | `/auth/link-bank` | Select bank → account aggregator consent | -| 1.11 | Financial Profile Setup | `/auth/fin-profile` | Income range, goals quiz, risk appetite | -| 1.12 | Login | `/auth/login` | Phone + OTP / PIN / Biometric login | - -#### MODULE 2: Home & Dashboard (5 screens) - -| # | Screen | Route | Description | -|---|--------|-------|-------------| -| 2.1 | Home Dashboard | `/home` | Greeting + balance + AI insight + quick actions + recent txns | -| 2.2 | Financial Health Score | `/home/health` | Overall score + breakdown factors + improvement tips | -| 2.3 | Net Worth Overview | `/home/net-worth` | Assets vs Liabilities visual breakdown | -| 2.4 | Monthly Summary | `/home/summary` | Income, expense, savings, top categories for current month | -| 2.5 | AI Daily Brief | `/home/brief` | "Your money today" — AI-generated daily financial summary | - -#### MODULE 3: AI Chat & Assistant (6 screens) - -| # | Screen | Route | Description | -|---|--------|-------|-------------| -| 3.1 | AI Chat Home | `/chat` | Chat interface with suggestion chips + history | -| 3.2 | Chat Conversation | `/chat/:id` | Active conversation with rich media responses | -| 3.3 | AI Insight Detail | `/chat/insight/:id` | Expanded AI insight with full explanation | -| 3.4 | Voice Input | `/chat/voice` | Voice recording with real-time transcription | -| 3.5 | Chat History | `/chat/history` | Past conversations list with search | -| 3.6 | AI Explainability | `/chat/explain/:id` | Detailed view: assumptions, risks, alternatives, data used | - -#### MODULE 4: Transactions (8 screens) - -| # | Screen | Route | Description | -|---|--------|-------|-------------| -| 4.1 | All Transactions | `/transactions` | Full transaction list with filters + search | -| 4.2 | Transaction Detail | `/transactions/:id` | Single txn: amount, merchant, category, map, notes | -| 4.3 | Category View | `/transactions/category/:id` | Transactions filtered by category + spending trends | -| 4.4 | Transaction Search | `/transactions/search` | Full text search across transactions | -| 4.5 | Spending Analytics | `/transactions/analytics` | Charts: category breakdown, trends, comparisons | -| 4.6 | Recurring Transactions | `/transactions/recurring` | Auto-detected subscriptions + bills | -| 4.7 | Edit Transaction | `/transactions/:id/edit` | Change category, add notes, split transaction | -| 4.8 | Export Transactions | `/transactions/export` | Export filtered transactions as CSV/PDF | - -#### MODULE 5: Goals & Planning (7 screens) - -| # | Screen | Route | Description | -|---|--------|-------|-------------| -| 5.1 | Goals Overview | `/goals` | All goals grid with progress rings | -| 5.2 | Create Goal | `/goals/create` | Goal type picker (Home/Car/Education/Retirement/Travel/Emergency/Custom) | -| 5.3 | Goal Setup Wizard | `/goals/setup` | Multi-step: target amount → timeline → SIP recommendation | -| 5.4 | Goal Detail | `/goals/:id` | Progress, milestones, projected date, AI suggestions | -| 5.5 | Goal Edit | `/goals/:id/edit` | Modify goal parameters | -| 5.6 | Goal Milestones | `/goals/:id/milestones` | Milestone timeline with celebrations | -| 5.7 | Goal Comparison | `/goals/compare` | Side-by-side goal progress comparison | - -#### MODULE 6: Investments & Portfolio (8 screens) - -| # | Screen | Route | Description | -|---|--------|-------|-------------| -| 6.1 | Portfolio Overview | `/investments` | Total value, allocation donut, instrument list | -| 6.2 | Portfolio Analytics | `/investments/analytics` | Returns, XIRR, benchmark comparison | -| 6.3 | Instrument Detail | `/investments/:id` | MF/Stock/FD detail: NAV, returns, SIP status | -| 6.4 | SIP Manager | `/investments/sip` | Active SIPs, next dates, amounts, modify | -| 6.5 | Rebalancing Advisor | `/investments/rebalance` | AI-suggested rebalancing with explanation | -| 6.6 | Tax Harvesting | `/investments/tax` | Tax-loss harvesting suggestions | -| 6.7 | New Investment | `/investments/new` | Search + explore funds/instruments | -| 6.8 | Investment History | `/investments/history` | Buy/sell/SIP history timeline | - -#### MODULE 7: Simulations (6 screens) - -| # | Screen | Route | Description | -|---|--------|-------|-------------| -| 7.1 | Simulation Hub | `/simulate` | Available simulations: Retirement, Loan, SIP, Life Event | -| 7.2 | Retirement Simulator | `/simulate/retirement` | Sliders: age, corpus, spend, inflation → projection chart | -| 7.3 | Loan Affordability | `/simulate/loan` | Loan amount, tenure, rate → EMI impact on budget | -| 7.4 | SIP Growth Simulator | `/simulate/sip` | Monthly amount, years, return → growth curve | -| 7.5 | Life Event Simulator | `/simulate/life-event` | Marriage/Child/Relocation → financial impact analysis | -| 7.6 | Simulation Result | `/simulate/result/:id` | Detailed result: 3 scenarios, chart, actions, save | - -#### MODULE 8: Transfers & Payments (10 screens) - -| # | Screen | Route | Description | -|---|--------|-------|-------------| -| 8.1 | Transfer Home | `/transfer` | Destination selector + recent contacts | -| 8.2 | UPI Transfer | `/transfer/upi` | UPI ID → amount → note → pay | -| 8.3 | Bank Transfer | `/transfer/bank` | IFSC + Account → amount → confirm (NEFT/IMPS) | -| 8.4 | Scan & Pay | `/transfer/scan` | QR scanner → amount → confirm | -| 8.5 | Request Money | `/transfer/request` | Select contact → amount → send request | -| 8.6 | Enter Amount | `/transfer/amount` | Amount keypad + currency conversion display | -| 8.7 | Transfer Confirm | `/transfer/confirm` | Review: from/to/amount → authenticate | -| 8.8 | Transfer Success | `/transfer/success` | Success animation + receipt + share | -| 8.9 | Transfer History | `/transfer/history` | Sent/Received with filters | -| 8.10 | Beneficiary Management | `/transfer/beneficiaries` | Saved contacts + add/edit/remove | - -#### MODULE 9: Alerts & Notifications (4 screens) - -| # | Screen | Route | Description | -|---|--------|-------|-------------| -| 9.1 | Notification Center | `/notifications` | Grouped by date (Today, Yesterday, date) | -| 9.2 | Alert Detail | `/notifications/:id` | Full alert with context + recommended action | -| 9.3 | Alert Preferences | `/notifications/preferences` | Toggle notification types + frequency | -| 9.4 | Smart Alerts Dashboard | `/notifications/smart` | AI-generated alerts with severity & action | - -#### MODULE 10: Profile & Settings (8 screens) - -| # | Screen | Route | Description | -|---|--------|-------|-------------| -| 10.1 | Profile Home | `/profile` | Avatar, name, email, settings list | -| 10.2 | Edit Profile | `/profile/edit` | Name, email, phone, avatar upload | -| 10.3 | Security Settings | `/profile/security` | PIN change, biometric toggle, 2FA, sessions | -| 10.4 | Language Settings | `/profile/language` | Language switcher (Hindi, English, regional) | -| 10.5 | Notification Settings | `/profile/notifications` | Push, email, SMS notification toggles | -| 10.6 | Linked Accounts | `/profile/accounts` | Connected banks + add/remove | -| 10.7 | Privacy & Data | `/profile/privacy` | Data usage info, export, delete account | -| 10.8 | Help & Support | `/profile/help` | FAQ, contact, report bug | - -#### MODULE 11: Reports & Export (4 screens) - -| # | Screen | Route | Description | -|---|--------|-------|-------------| -| 11.1 | Reports Hub | `/reports` | Available reports: Monthly, Annual, Tax, Custom | -| 11.2 | Monthly Report | `/reports/monthly` | Visual monthly financial report | -| 11.3 | Annual Report | `/reports/annual` | Fiscal year (Apr–Mar) comprehensive report | -| 11.4 | Custom Report Builder | `/reports/custom` | Pick date range + categories + format (CSV/PDF) | - -#### MODULE 12: Bills & Subscriptions (5 screens) - -| # | Screen | Route | Description | -|---|--------|-------|-------------| -| 12.1 | Bills Dashboard | `/bills` | Upcoming + overdue bills list | -| 12.2 | Bill Detail | `/bills/:id` | Bill info, history, pay button | -| 12.3 | Add Bill Reminder | `/bills/add` | Manual bill entry with recurrence | -| 12.4 | Subscription Tracker | `/bills/subscriptions` | Auto-detected subscriptions + cancel suggestions | -| 12.5 | Bill Payment | `/bills/:id/pay` | Pay bill flow (reuse transfer components) | - ---- - -## 8. APPLICATION FLOW & NAVIGATION ARCHITECTURE - -### 8.1 Navigation Structure - -``` -ROOT NAVIGATOR (Stack) -│ -├── AUTH FLOW (Stack — no bottom tabs) -│ ├── Splash -│ ├── Welcome Carousel -│ ├── Language Selection -│ ├── Sign Up / Login -│ ├── OTP Verification -│ ├── PIN Setup (Create + Confirm) -│ ├── Biometric Setup -│ ├── KYC Lite -│ ├── Bank Linking -│ └── Financial Profile Setup -│ -├── MAIN APP (Bottom Tab Navigator) -│ │ -│ ├── TAB 1: Home (Stack) -│ │ ├── Home Dashboard -│ │ ├── Financial Health Score -│ │ ├── Net Worth Overview -│ │ ├── Monthly Summary -│ │ └── AI Daily Brief -│ │ -│ ├── TAB 2: Transactions (Stack) -│ │ ├── All Transactions -│ │ ├── Transaction Detail -│ │ ├── Category View -│ │ ├── Spending Analytics -│ │ ├── Recurring Transactions -│ │ └── Export -│ │ -│ ├── TAB 3: AI Chat (Stack) — CENTER TAB (Highlighted) -│ │ ├── Chat Home -│ │ ├── Chat Conversation -│ │ ├── AI Insight Detail -│ │ ├── Voice Input (Modal) -│ │ ├── Chat History -│ │ └── Explainability View -│ │ -│ ├── TAB 4: Goals (Stack) -│ │ ├── Goals Overview -│ │ ├── Create Goal -│ │ ├── Goal Setup Wizard -│ │ ├── Goal Detail -│ │ ├── Goal Edit -│ │ └── Goal Milestones -│ │ -│ └── TAB 5: More (Stack) -│ ├── More Menu (grid: Investments, Simulations, Transfers, Bills, Reports, Profile) -│ ├── Profile → sub-screens -│ ├── Investments → sub-screens -│ ├── Simulations → sub-screens -│ ├── Transfers → sub-screens -│ ├── Bills → sub-screens -│ └── Reports → sub-screens -│ -├── MODAL STACK (Presented modally over everything) -│ ├── Transfer Confirm -│ ├── Transfer Success -│ ├── Biometric Prompt -│ ├── PIN Entry -│ ├── QR Scanner -│ └── Amount Keypad (Bottom Sheet) -│ -└── NOTIFICATION CENTER (Stack — accessible from any screen via bell icon) - ├── Notification List - └── Alert Detail -``` - -### 8.2 Bottom Tab Bar Design - -``` -┌──────────────────────────────────────────────────────┐ -│ │ -│ 🏠 📊 ✨ 🎯 ⋯ │ -│ Home Transactions AI Chat Goals More │ -│ (raised) │ -└──────────────────────────────────────────────────────┘ -``` - -- **AI Chat tab** is the center tab with a **raised circular button** (accent yellow `#F5C518`, 56px) -- Other tabs: 48px icon, 10px label -- Active state: filled icon + accent color -- Inactive state: outline icon + muted gray - -### 8.3 Unified Flow — Indian Context Journey - -#### New User Flow (First-time Indian user) - -``` -1. SPLASH → Welcome Carousel (3 slides: "Your AI Money Coach", "See Your Full Picture", "Plan with Confidence") - ↓ -2. LANGUAGE → Select Hindi / English - ↓ -3. SIGN UP → Enter 10-digit mobile number - ↓ -4. OTP → 6-digit OTP (auto-read via SMS permission) - ↓ -5. CREATE PIN → 4-digit numeric PIN - ↓ -6. BIOMETRIC → Enable fingerprint/Face ID (skippable) - ↓ -7. KYC LITE → PAN number + Name + DOB (Indian compliance) - ↓ -8. BANK LINKING → Select bank from list → Account Aggregator consent flow - ↓ -9. FINANCIAL PROFILE → - - Monthly income range (dropdown: ₹10K-25K, ₹25K-50K, ₹50K-1L, ₹1L-3L, ₹3L+) - - Primary goals (multi-select: Emergency Fund, Home, Car, Retirement, Travel, Education) - - Risk appetite (slider: Conservative → Moderate → Aggressive) - ↓ -10. HOME DASHBOARD → "Welcome! Let me analyze your finances..." - ↓ -11. AI DAILY BRIEF (auto-shown first time) → "Here's your first financial snapshot" -``` - -#### Returning User Flow - -``` -1. SPLASH (< 1 sec) → PIN / Biometric / Face ID - ↓ -2. HOME DASHBOARD (with fresh data) -``` - -#### Key Interaction Flows - -**Flow A: "Can I afford a home loan?" (Chat → Simulation)** - -``` -HOME → Tap AI Chat → Type "Can I afford ₹50L home loan?" - → AI asks clarifying questions (tenure, city, down payment) - → AI runs loan simulation automatically - → Shows EMI impact card + affordability score - → "View Full Simulation" → opens Loan Affordability Simulator - → "Add as Goal" → creates Home Purchase goal -``` - -**Flow B: Anomaly Alert → Action** - -``` -PUSH NOTIFICATION → "Unusual spending detected: ₹15,000 at electronics store" - → Tap → Notification Center → Alert Detail - → Shows spending context + deviation from normal - → Recommended actions: "Set budget alert" / "Categorize correctly" / "Ask AI" - → User taps "Ask AI" → Chat opens with context pre-filled -``` - -**Flow C: Monthly Review Ritual** - -``` -HOME → "Your monthly review is ready" card - → Monthly Summary screen - → Income vs Expense comparison - → Top spending categories - → Goal progress updates - → AI recommendations - → "Share Report" / "Export PDF" / "Discuss with AI" -``` - -**Flow D: Send Money via UPI (Indian Context)** - -``` -HOME → Quick Action "Transfer" → Transfer Home - → Choose UPI / Bank Transfer / Scan QR - → UPI: Enter UPI ID → Amount Keypad → Note - → Review screen (Transfer Confirm) - → Biometric/PIN authentication - → Transfer Success → Receipt + Share -``` - -**Flow E: SIP Planning Flow** - -``` -GOALS → Create Goal → "Retirement" - → Enter target corpus (₹2Cr) - → Set timeline (retire at 55, you're 28) - → AI calculates required monthly SIP - → Shows 3 scenarios (Conservative/Moderate/Aggressive) - → "Start SIP" → Investment platform integration → Confirmation -``` - ---- - -## 9. SCREEN-BY-SCREEN SPECIFICATION - -### 9.1 Splash Screen (1.1) - -**Purpose:** Brand impression + auth state check - -**Layout:** -``` -┌─────────────────────────────┐ -│ │ -│ │ -│ [Nivesh Logo] │ -│ "Your AI Financial │ -│ Strategist" │ -│ │ -│ [Loading dot anim] │ -│ │ -│ │ -└─────────────────────────────┘ -Background: beige gradient -Duration: 1.5s-2s (auth check happens in parallel) -``` - -**Animation:** Logo fades in → tagline slides up → loading dots pulse - ---- - -### 9.2 Welcome Carousel (1.2) - -**Purpose:** Value proposition storytelling — emotional connection - -**Slides:** - -| Slide | Headline | Subtext | Illustration | -|-------|----------|---------|-------------| -| 1 | "Your Money, Finally Clear" | "See your complete financial picture in one place" | Person looking at clear dashboard | -| 2 | "AI That Understands Finance" | "Ask anything — get decisions, not just data" | AI chat with financial charts | -| 3 | "Plan Your Future, Your Way" | "Simulate, plan, and track your life goals" | Person on path toward goals | - -**Layout:** -``` -┌─────────────────────────────┐ -│ │ -│ [Illustration] │ -│ │ -│ "Headline" │ -│ "Subtext description" │ -│ │ -│ ● ○ ○ │ -│ │ -│ [Get Started] (yellow) │ -│ Skip │ -└─────────────────────────────┘ -``` - -**Interactions:** Swipe between slides; dots indicate progress; "Get Started" on any slide proceeds - ---- - -### 9.3 Home Dashboard (2.1) - -**Purpose:** Financial overview + AI nudge + quick actions — THE primary screen - -**Layout:** -``` -┌─────────────────────────────┐ -│ Welcome back, │ -│ Akmal ₿ 🔔 │ -├─────────────────────────────┤ -│ ┌─────────────────────────┐ │ -│ │ Your Balance │ │ -│ │ ₹4,05,000.80 👁 │ │ -│ │ ****9934 Exp: 05/28 │ │ -│ │ [VISA] │ │ -│ └───────┬─────────────────┘ │ -│ │ (swipeable cards) │ -│ ● ○ │ -├─────────────────────────────┤ -│ [Request] [Transfer] [+] │ -│ │ -├─────────────────────────────┤ -│ ┌─────────────────────────┐ │ -│ │ 🤖 AI Insight │ │ -│ │ "Your food spending is │ │ -│ │ 18% higher this month. │ │ -│ │ Tap to explore." │ │ -│ └─────────────────────────┘ │ -├─────────────────────────────┤ -│ Transaction View all│ -│ TODAY │ -│ ↗ Transfer to Ravi -₹20 │ -│ 04:03 PM │ -│ ↙ Salary from Co. +₹1,300 │ -│ 02:15 PM │ -├─────────────────────────────┤ -│ 🏠 📊 ✨ 🎯 ⋯ │ -│ Home Trans AI Goals More │ -└─────────────────────────────┘ -``` - -**Key Components Used:** -- `AccountCarousel` (balance cards) -- `QuickAction` row (Request, Transfer, +) -- `AIInsightCard` (dismissible, tappable) -- `TransactionList` (recent 5) -- `BottomTabBar` - -**Data Requirements:** -- User profile (name, avatar) -- Account balances (aggregated) -- Recent transactions (last 5) -- AI insight (from backend reasoning engine) -- Unread notification count - ---- - -### 9.4 AI Chat Screen (3.1) - -**Purpose:** Primary interaction surface — conversational finance - -**Layout:** -``` -┌─────────────────────────────┐ -│ ← AI Assistant ⋯ │ -├─────────────────────────────┤ -│ │ -│ [AI Avatar - Concentric │ -│ rings with sparkle] │ -│ │ -│ "Ask Nivesh anything about │ -│ your savings and financial │ -│ improvement." │ -│ │ -├─────────────────────────────┤ -│ [✨ Ask AI anything 📎 ➤] │ -├─────────────────────────────┤ -│ Suggested │ -│ ┌─────────────────────────┐ │ -│ │ How can I build an │ │ -│ │ emergency fund? │ │ -│ ├─────────────────────────┤ │ -│ │ What's the best │ │ -│ │ budgeting method? │ │ -│ ├─────────────────────────┤ │ -│ │ How do I reduce my │ │ -│ │ spending? │ │ -│ ├─────────────────────────┤ │ -│ │ Can I afford ₹50L │ │ -│ │ home loan? │ │ -│ └─────────────────────────┘ │ -└─────────────────────────────┘ -``` - -**Chat Conversation Layout:** -``` -┌─────────────────────────────┐ -│ ← AI Assistant ⋯ │ -├─────────────────────────────┤ -│ [User bubble - right] │ -│ "Help me plan savings to │ -│ buy a ₹10L car by │ -│ January next year" │ -│ │ -│ [AI bubble - left] │ -│ "Here's a simplified plan: │ -│ 1. Set the Goal │ -│ 2. Analyze Your Budget │ -│ 3. Cut Costs │ -│ 4. Boost Income │ -│ 5. Monitor Progress" │ -│ │ -│ [📊 View Simulation] │ -│ [🎯 Create Goal] │ -│ [🔊 Read aloud] [📋 Copy] │ -├─────────────────────────────┤ -│ [✨ Ask me 📎 ➤] │ -│ Suggested: │ -│ [How much monthly SIP?] │ -│ [Show me scenarios] │ -└─────────────────────────────┘ -``` - -**Rich Content Types in AI Responses:** -1. **Text** — formatted markdown -2. **Chart** — inline chart (line, bar, donut) -3. **Action Buttons** — "Create Goal", "Start SIP", "Set Budget" -4. **Explainability Panel** — expandable assumptions/risks -5. **Table** — comparison data (scenarios) -6. **Amount Card** — highlighted financial figure -7. **Link** — deep link to relevant screen - ---- - -### 9.5 Transfer Flow (8.1–8.8) - -**Transfer Home:** -``` -┌─────────────────────────────┐ -│ ← Transfer │ -├─────────────────────────────┤ -│ Destination │ -│ ┌───────────────────────┐ │ -│ │ 🏦 Bank / UPI / QR │ │ -│ └───────────────────────┘ │ -│ Account/UPI ID │ -│ ┌───────────────────────┐ │ -│ │ 8009665142887 │ │ -│ └───────────────────────┘ │ -│ │ -│ [ Continue ] │ -│ │ -│ Last transfer │ -│ (👤)(👤)(👤)(👤)(👤) │ -│ Amara Ridho Safira Inara │ -│ │ -│ Transfer list │ -│ [All] [Friends] [Fav] │ -│ ┌─────────────────────┐ │ -│ │ 🔍 Search │ │ -│ ├─────────────────────┤ │ -│ │ Adam S. BCA │ │ -│ │ 900764... ⋯ │ │ -│ │ Agung H. BRI │ │ -│ │ ... │ │ -│ └─────────────────────┘ │ -└─────────────────────────────┘ -``` - -**Transfer Confirmation:** -``` -┌─────────────────────────────┐ -│ ← Confirm │ -├─────────────────────────────┤ -│ Transfer from │ -│ ┌───────────────────────┐ │ -│ │ 🏦 ****9934 VISA │ │ -│ │ Balance: ₹4,05,000 │ │ -│ └───────────────────────┘ │ -│ │ -│ Transfer to │ -│ ┌───────────────────────┐ │ -│ │ LS Lanaya Sehrina │ │ -│ │ BCA - 800966... [Chg]│ │ -│ └───────────────────────┘ │ -│ │ -│ Amount: ₹1,350.00 │ -│ │ -│ [ Continue ] │ -└─────────────────────────────┘ -``` - -**Authentication Modal (Bottom Sheet):** -``` -┌─────────────────────────────┐ -│ │ -│ Touch ID sensor to verify │ -│ transaction │ -│ │ -│ "Please confirm your │ -│ identity by using Touch ID │ -│ to continue the │ -│ transaction." │ -│ │ -│ [👆 Fingerprint] │ -│ │ -│ Or Use PIN │ -│ │ -│ [Cancel] │ -└─────────────────────────────┘ -``` - -**Success Screen:** -``` -┌─────────────────────────────┐ -│ │ -│ ✅ │ -│ Successfully Sent! │ -│ │ -│ Send ₹1,350.00 to │ -│ Lanaya Sehrina │ -│ │ -│ [ Back to Home ] │ -│ [ Share Receipt ] │ -│ │ -└─────────────────────────────┘ -``` - ---- - -### 9.6 Notification Screen (9.1) - -**Layout:** -``` -┌─────────────────────────────┐ -│ ← Notification ⋯ │ -├─────────────────────────────┤ -│ Today │ -│ ┌─────────────────────────┐│ -│ │ 🟨 You Get Cashback! ││ -│ │ You got ₹10 cashback ││ -│ │ from payment ││ -│ └─────────────────────────┘│ -│ │ -│ Yesterday │ -│ ┌─────────────────────────┐│ -│ │ 🟪 New Service Available ││ -│ │ Check out NPS tracking ││ -│ ├─────────────────────────┤│ -│ │ 🎵 Music Subscription ││ -│ │ ₹99 auto-debit upcoming ││ -│ ├─────────────────────────┤│ -│ │ 🟢 UPI Linked! ││ -│ │ Your UPI is connected ││ -│ └─────────────────────────┘│ -│ │ -│ October 20, 2025 │ -│ ┌─────────────────────────┐│ -│ │ ...more notifications ││ -│ └─────────────────────────┘│ -└─────────────────────────────┘ -``` - ---- - -### 9.7 Profile Screen (10.1) - -**Layout:** -``` -┌─────────────────────────────┐ -│ ← My Profile │ -├─────────────────────────────┤ -│ │ -│ [Avatar] │ -│ Akmal Nasrulloh │ -│ akmal@gmail.com │ -│ [Edit Profile] │ -│ │ -├─────────────────────────────┤ -│ Settings │ -│ ┌─────────────────────────┐│ -│ │ 🔔 Notification 🔵 ││ -│ ├─────────────────────────┤│ -│ │ 🌐 Language › ││ -│ ├─────────────────────────┤│ -│ │ 💳 Transactions › ││ -│ ├─────────────────────────┤│ -│ │ 🔒 Security & PIN › ││ -│ ├─────────────────────────┤│ -│ │ 📊 Linked Accounts › ││ -│ ├─────────────────────────┤│ -│ │ 📥 Export & Reports › ││ -│ ├─────────────────────────┤│ -│ │ 🛡️ Privacy & Data › ││ -│ ├─────────────────────────┤│ -│ │ ❓ Help & Support › ││ -│ ├─────────────────────────┤│ -│ │ 🚪 Logout › ││ -│ └─────────────────────────┘│ -└─────────────────────────────┘ -``` - ---- - -### 9.8 Simulation Screen — Loan Affordability (7.3) - -**Layout:** -``` -┌─────────────────────────────┐ -│ ← Loan Affordability │ -├─────────────────────────────┤ -│ │ -│ Loan Amount │ -│ ₹50,00,000 │ -│ ├────────●─────────┤ │ -│ ₹5L ₹2Cr │ -│ │ -│ Tenure │ -│ 20 years │ -│ ├──────────●───────┤ │ -│ 5 yrs 30 yrs │ -│ │ -│ Interest Rate │ -│ 8.5% │ -│ ├───●──────────────┤ │ -│ 6% 15% │ -│ │ -├─────────────────────────────┤ -│ Monthly EMI │ -│ ₹43,391 │ -│ │ -│ ┌─────────────────────────┐│ -│ │ [Line Chart] ││ -│ │ Principal vs Interest ││ -│ │ over tenure ││ -│ └─────────────────────────┘│ -│ │ -│ Affordability Score: 72/100│ -│ "You can afford this if │ -│ you reduce dining by 20%" │ -│ │ -│ [Save Simulation] │ -│ [Ask AI for Advice] │ -└─────────────────────────────┘ -``` - ---- - -### 9.9 Spending Analytics (4.5) - -**Layout:** -``` -┌─────────────────────────────┐ -│ ← Analytics │ -├─────────────────────────────┤ -│ [Week] [Month●] [Quarter] │ -├─────────────────────────────┤ -│ ↑ Money in ↓ Money out│ -│ ₹14,000 ₹1,996 │ -│ │ -│ ┌─────────────────────────┐│ -│ │ [Bar Chart] ││ -│ │ Jun Jul Aug Sep Oct Nov││ -│ │ Monthly comparison ││ -│ └─────────────────────────┘│ -│ │ -│ Top 3 spends Sep │ -│ "Cooking and eating in │ -│ will help you save more │ -│ money 😊" │ -│ │ -│ 🍕 ₹210.57 → Food │ -│ ☕ ₹73.20 → Beverages │ -│ 🎬 ₹63.10 → Entertainment│ -│ │ -│ [Ask AI about spending] │ -└─────────────────────────────┘ -``` - ---- - -### 9.10 Goals Detail Screen (5.4) - -**Layout:** -``` -┌─────────────────────────────┐ -│ ← Car Saving │ -├─────────────────────────────┤ -│ │ -│ [Car Illustration] │ -│ │ -│ Car Saving │ -│ ₹2,300 of ₹10,00,000 │ -│ │ -│ ┌──────────────────────┐ │ -│ │ [Progress Ring 23%] │ │ -│ └──────────────────────┘ │ -│ │ -│ [Percents][Withdraw] │ -│ [Analytics][Convert] │ -│ [Receipt] │ -│ │ -│ Recent Activity │ -│ 🏦 Withdraw -₹2,300 14/09│ -│ 🏦 Top Up +₹500 14/09│ -│ │ -│ AI Recommendation: │ -│ "Increase monthly SIP by │ -│ ₹2,000 to reach goal │ -│ 2 months earlier" │ -│ │ -│ [Top Up] [Edit Goal] │ -└─────────────────────────────┘ -``` - ---- - -## 10. MICRO-INTERACTIONS & ANIMATION GUIDE - -### 10.1 Animation Library - -Use **`react-native-reanimated`** (v3) + **`react-native-gesture-handler`** for all animations. - -### 10.2 Animation Catalog - -| Interaction | Animation | Duration | Easing | -|-------------|-----------|----------|--------| -| Screen transition | Slide from right (push), fade (modal) | 300ms | `Easing.bezier(0.25, 0.1, 0.25, 1)` | -| Card press | Scale down to 0.97 + mild shadow reduce | 100ms | Spring (damping: 15) | -| Card release | Scale back to 1.0 | 200ms | Spring (damping: 12) | -| Pull to refresh | Custom spinner with Nivesh icon rotation | Continuous | Linear | -| Balance reveal | Number count-up animation | 600ms | Decelerate | -| Amount input | Character scale-in + subtle bounce | 150ms | Spring | -| Tab switch | Cross-fade content + icon fill transition | 200ms | Ease-in-out | -| Bottom sheet | Spring-based drag + snap to detents | Dynamic | Spring (damping: 20, stiffness: 300) | -| Success checkmark | Path draw animation (SVG) | 800ms | Ease-in-out | -| Progress ring | Arc draw from 0 to value | 1000ms | Decelerate | -| AI typing | 3-dot pulse animation | Loop (600ms) | Ease-in-out | -| Notification badge | Scale pop + number update | 300ms | Spring (bounce) | -| Chip selection | Background color fade + check icon appear | 200ms | Ease-in | -| Error shake | Horizontal oscillation (3 cycles) | 400ms | Elastic | -| Skeleton loading | Shimmer gradient sweep (left→right) | 1500ms loop | Linear | -| Toast = slide in | Slide from top + auto dismiss | 300ms in, 200ms out | Decelerate / Accelerate | - -### 10.3 Gesture Interactions - -| Gesture | Where | Action | -|---------|-------|--------| -| Swipe left/right | Account carousel | Switch between accounts | -| Swipe down | Transaction list, Chat | Pull to refresh | -| Swipe left | Transaction item | Quick actions (categorize, hide) | -| Long press | Transaction item | Context menu (copy, share, details) | -| Pinch | Charts | Zoom in/out | -| Pan | Simulation sliders | Adjust values | -| Double tap | Balance | Toggle show/hide balance | -| Bottom sheet drag | Modal sheets | Expand, collapse, dismiss | - ---- - -## 11. ACCESSIBILITY STANDARDS - -### 11.1 Requirements - -- **WCAG 2.1 Level AA** compliance -- Minimum contrast ratio: 4.5:1 (text), 3:1 (large text) -- All interactive elements: minimum 44x44px touch target -- Screen reader labels for all icons and images -- `accessibilityRole`, `accessibilityLabel`, `accessibilityHint` on all components -- Support for Dynamic Type (iOS) / Font scaling (Android) -- Reduced Motion support: disable animations when system preference is on -- High Contrast mode support - -### 11.2 Financial Accessibility - -- Amount values always have `accessibilityLabel` with full spoken form: "Rupees forty thousand five hundred and eighty paise" -- Color-coded values (green/red) also have text indicators (+/-) -- Charts provide text alternatives (summary data table) -- Complex flows (transfer, SIP) have step indicators for screen readers - ---- - -## 12. PROJECT STRUCTURE & FILE ORGANIZATION - -``` -mobile/ -├── app.json # Expo app configuration -├── babel.config.js -├── tsconfig.json -├── package.json -├── eas.json # EAS Build configuration -├── metro.config.js -│ -├── assets/ -│ ├── fonts/ -│ │ ├── Inter-Regular.ttf -│ │ ├── Inter-Medium.ttf -│ │ ├── Inter-SemiBold.ttf -│ │ ├── Inter-Bold.ttf -│ │ ├── Inter-ExtraBold.ttf -│ │ └── NotoSansDevanagari-*.ttf -│ ├── images/ -│ │ ├── logo.png -│ │ ├── onboarding/ -│ │ ├── illustrations/ -│ │ └── flags/ -│ ├── icons/ -│ │ └── custom-icons/ # Indian financial custom icons -│ └── animations/ -│ ├── splash.json # Lottie splash animation -│ ├── success.json # Lottie success checkmark -│ └── loading.json # Lottie loading spinner -│ -├── src/ -│ ├── app/ # Expo Router file-based routing -│ │ ├── _layout.tsx # Root layout (providers, theme) -│ │ ├── index.tsx # Splash / entry point -│ │ │ -│ │ ├── (auth)/ # Auth group (no tabs) -│ │ │ ├── _layout.tsx -│ │ │ ├── welcome.tsx -│ │ │ ├── language.tsx -│ │ │ ├── signup.tsx -│ │ │ ├── otp.tsx -│ │ │ ├── create-pin.tsx -│ │ │ ├── confirm-pin.tsx -│ │ │ ├── biometric.tsx -│ │ │ ├── kyc.tsx -│ │ │ ├── link-bank.tsx -│ │ │ ├── fin-profile.tsx -│ │ │ └── login.tsx -│ │ │ -│ │ ├── (tabs)/ # Main tab navigator group -│ │ │ ├── _layout.tsx # Tab bar configuration -│ │ │ │ -│ │ │ ├── home/ -│ │ │ │ ├── _layout.tsx -│ │ │ │ ├── index.tsx # Home Dashboard -│ │ │ │ ├── health.tsx -│ │ │ │ ├── net-worth.tsx -│ │ │ │ ├── summary.tsx -│ │ │ │ └── brief.tsx -│ │ │ │ -│ │ │ ├── transactions/ -│ │ │ │ ├── _layout.tsx -│ │ │ │ ├── index.tsx # All Transactions -│ │ │ │ ├── [id].tsx # Transaction Detail -│ │ │ │ ├── category/ -│ │ │ │ │ └── [id].tsx -│ │ │ │ ├── search.tsx -│ │ │ │ ├── analytics.tsx -│ │ │ │ ├── recurring.tsx -│ │ │ │ └── export.tsx -│ │ │ │ -│ │ │ ├── chat/ -│ │ │ │ ├── _layout.tsx -│ │ │ │ ├── index.tsx # AI Chat Home -│ │ │ │ ├── [id].tsx # Conversation -│ │ │ │ ├── voice.tsx -│ │ │ │ ├── history.tsx -│ │ │ │ └── explain/ -│ │ │ │ └── [id].tsx -│ │ │ │ -│ │ │ ├── goals/ -│ │ │ │ ├── _layout.tsx -│ │ │ │ ├── index.tsx # Goals Overview -│ │ │ │ ├── create.tsx -│ │ │ │ ├── setup.tsx -│ │ │ │ ├── [id]/ -│ │ │ │ │ ├── index.tsx # Goal Detail -│ │ │ │ │ ├── edit.tsx -│ │ │ │ │ └── milestones.tsx -│ │ │ │ └── compare.tsx -│ │ │ │ -│ │ │ └── more/ -│ │ │ ├── _layout.tsx -│ │ │ ├── index.tsx # More Menu Grid -│ │ │ │ -│ │ │ ├── investments/ -│ │ │ │ ├── index.tsx -│ │ │ │ ├── analytics.tsx -│ │ │ │ ├── [id].tsx -│ │ │ │ ├── sip.tsx -│ │ │ │ ├── rebalance.tsx -│ │ │ │ ├── tax.tsx -│ │ │ │ ├── new.tsx -│ │ │ │ └── history.tsx -│ │ │ │ -│ │ │ ├── simulate/ -│ │ │ │ ├── index.tsx -│ │ │ │ ├── retirement.tsx -│ │ │ │ ├── loan.tsx -│ │ │ │ ├── sip.tsx -│ │ │ │ ├── life-event.tsx -│ │ │ │ └── result/ -│ │ │ │ └── [id].tsx -│ │ │ │ -│ │ │ ├── transfer/ -│ │ │ │ ├── index.tsx -│ │ │ │ ├── upi.tsx -│ │ │ │ ├── bank.tsx -│ │ │ │ ├── scan.tsx -│ │ │ │ ├── request.tsx -│ │ │ │ ├── amount.tsx -│ │ │ │ ├── confirm.tsx -│ │ │ │ ├── success.tsx -│ │ │ │ ├── history.tsx -│ │ │ │ └── beneficiaries.tsx -│ │ │ │ -│ │ │ ├── bills/ -│ │ │ │ ├── index.tsx -│ │ │ │ ├── [id].tsx -│ │ │ │ ├── add.tsx -│ │ │ │ ├── subscriptions.tsx -│ │ │ │ └── pay/ -│ │ │ │ └── [id].tsx -│ │ │ │ -│ │ │ ├── reports/ -│ │ │ │ ├── index.tsx -│ │ │ │ ├── monthly.tsx -│ │ │ │ ├── annual.tsx -│ │ │ │ └── custom.tsx -│ │ │ │ -│ │ │ ├── profile/ -│ │ │ │ ├── index.tsx -│ │ │ │ ├── edit.tsx -│ │ │ │ ├── security.tsx -│ │ │ │ ├── language.tsx -│ │ │ │ ├── notifications.tsx -│ │ │ │ ├── accounts.tsx -│ │ │ │ ├── privacy.tsx -│ │ │ │ └── help.tsx -│ │ │ │ -│ │ │ └── notifications/ -│ │ │ ├── index.tsx -│ │ │ ├── [id].tsx -│ │ │ ├── preferences.tsx -│ │ │ └── smart.tsx -│ │ │ -│ │ └── (modals)/ # Modal group -│ │ ├── biometric-prompt.tsx -│ │ ├── pin-entry.tsx -│ │ └── amount-keypad.tsx -│ │ -│ ├── components/ -│ │ ├── atoms/ -│ │ │ ├── NText.tsx -│ │ │ ├── NButton.tsx -│ │ │ ├── NIcon.tsx -│ │ │ ├── NInput.tsx -│ │ │ ├── NAvatar.tsx -│ │ │ ├── NBadge.tsx -│ │ │ ├── NDivider.tsx -│ │ │ ├── NChip.tsx -│ │ │ ├── NSwitch.tsx -│ │ │ ├── NCheckbox.tsx -│ │ │ ├── NRadio.tsx -│ │ │ ├── NProgressBar.tsx -│ │ │ ├── NProgressRing.tsx -│ │ │ ├── NSkeleton.tsx -│ │ │ ├── NSpinner.tsx -│ │ │ └── index.ts -│ │ │ -│ │ ├── molecules/ -│ │ │ ├── AmountDisplay.tsx -│ │ │ ├── BalanceCard.tsx -│ │ │ ├── TransactionItem.tsx -│ │ │ ├── GoalCard.tsx -│ │ │ ├── AlertItem.tsx -│ │ │ ├── QuickAction.tsx -│ │ │ ├── AccountSelector.tsx -│ │ │ ├── CurrencySelector.tsx -│ │ │ ├── ContactAvatar.tsx -│ │ │ ├── StatCard.tsx -│ │ │ ├── ChipGroup.tsx -│ │ │ ├── SearchBar.tsx -│ │ │ ├── OTPInput.tsx -│ │ │ ├── PINInput.tsx -│ │ │ ├── BiometricPrompt.tsx -│ │ │ ├── DateRangePicker.tsx -│ │ │ ├── AmountKeypad.tsx -│ │ │ ├── SuggestionChip.tsx -│ │ │ ├── InstrumentBadge.tsx -│ │ │ └── index.ts -│ │ │ -│ │ ├── organisms/ -│ │ │ ├── AccountCarousel.tsx -│ │ │ ├── TransactionList.tsx -│ │ │ ├── GoalGrid.tsx -│ │ │ ├── ChatBubble.tsx -│ │ │ ├── ChatInputBar.tsx -│ │ │ ├── SimulationSlider.tsx -│ │ │ ├── SimulationChart.tsx -│ │ │ ├── NotificationGroup.tsx -│ │ │ ├── SpendingBreakdown.tsx -│ │ │ ├── IncomeExpenseBar.tsx -│ │ │ ├── NetWorthTimeline.tsx -│ │ │ ├── InvestmentPortfolio.tsx -│ │ │ ├── BillReminderCard.tsx -│ │ │ ├── FinancialHealthScore.tsx -│ │ │ ├── AIInsightCard.tsx -│ │ │ ├── ExplainabilityPanel.tsx -│ │ │ ├── QuickTransferBar.tsx -│ │ │ └── index.ts -│ │ │ -│ │ ├── templates/ -│ │ │ ├── AuthScreenTemplate.tsx -│ │ │ ├── DashboardTemplate.tsx -│ │ │ ├── DetailScreenTemplate.tsx -│ │ │ ├── ChatScreenTemplate.tsx -│ │ │ ├── SettingsScreenTemplate.tsx -│ │ │ ├── ModalTemplate.tsx -│ │ │ ├── BottomSheetTemplate.tsx -│ │ │ └── index.ts -│ │ │ -│ │ └── navigation/ -│ │ ├── BottomTabBar.tsx -│ │ ├── HeaderBar.tsx -│ │ └── index.ts -│ │ -│ ├── theme/ -│ │ ├── colors.ts # Color tokens (light + dark) -│ │ ├── typography.ts # Type scale definitions -│ │ ├── spacing.ts # Spacing scale -│ │ ├── shadows.ts # Shadow definitions -│ │ ├── borders.ts # Border radius tokens -│ │ ├── gradients.ts # Gradient definitions -│ │ ├── animations.ts # Animation presets (spring configs, durations) -│ │ ├── ThemeProvider.tsx # Theme context + dark mode switching -│ │ ├── useTheme.ts # Custom hook to consume theme -│ │ └── index.ts # Re-export all theme tokens -│ │ -│ ├── hooks/ -│ │ ├── useAuth.ts # Authentication state + actions -│ │ ├── useBalance.ts # Account balance fetching -│ │ ├── useTransactions.ts # Transaction list + filtering -│ │ ├── useGoals.ts # Goals CRUD operations -│ │ ├── useChat.ts # Chat messages + WebSocket -│ │ ├── useSimulation.ts # Simulation calculations -│ │ ├── useNotifications.ts # Push notification handling -│ │ ├── useBiometric.ts # Biometric authentication -│ │ ├── useAmountFormatter.ts # Indian ₹ formatting hook -│ │ ├── useKeyboard.ts # Keyboard height + visibility -│ │ ├── useRefresh.ts # Pull-to-refresh logic -│ │ ├── useAnalytics.ts # Screen tracking, event logging -│ │ └── index.ts -│ │ -│ ├── services/ -│ │ ├── api/ -│ │ │ ├── client.ts # Axios instance + interceptors -│ │ │ ├── auth.api.ts # Auth endpoints -│ │ │ ├── user.api.ts # User profile endpoints -│ │ │ ├── transactions.api.ts # Transaction endpoints -│ │ │ ├── goals.api.ts # Goals endpoints -│ │ │ ├── chat.api.ts # Chat/AI endpoints -│ │ │ ├── investments.api.ts # Investment endpoints -│ │ │ ├── simulations.api.ts # Simulation endpoints -│ │ │ ├── transfers.api.ts # Transfer endpoints -│ │ │ ├── notifications.api.ts # Notification endpoints -│ │ │ └── index.ts -│ │ ├── websocket/ -│ │ │ ├── socket.ts # WebSocket connection manager -│ │ │ └── events.ts # Event type definitions -│ │ ├── storage/ -│ │ │ ├── secure.ts # Secure storage (keychain) for tokens/PIN -│ │ │ └── async.ts # AsyncStorage for preferences -│ │ ├── biometric/ -│ │ │ └── biometric.ts # Fingerprint/FaceID service -│ │ ├── push/ -│ │ │ └── notifications.ts # Push notification registration + handling -│ │ └── analytics/ -│ │ └── tracker.ts # Analytics event tracking -│ │ -│ ├── store/ # State management (Zustand) -│ │ ├── authStore.ts -│ │ ├── userStore.ts -│ │ ├── transactionStore.ts -│ │ ├── goalStore.ts -│ │ ├── chatStore.ts -│ │ ├── investmentStore.ts -│ │ ├── notificationStore.ts -│ │ ├── settingsStore.ts # Theme, language, preferences -│ │ └── index.ts -│ │ -│ ├── utils/ -│ │ ├── formatAmount.ts # ₹ Indian formatting (lakhs/crores) -│ │ ├── formatDate.ts # Date formatting (Indian standards) -│ │ ├── validators.ts # PAN, Aadhaar, IFSC, UPI ID validation -│ │ ├── constants.ts # App constants -│ │ ├── indianBanks.ts # Bank list with logos -│ │ ├── investmentTypes.ts # MF/SIP/FD/PPF/NPS definitions -│ │ ├── categories.ts # Spending categories with icons -│ │ └── index.ts -│ │ -│ ├── i18n/ -│ │ ├── index.ts # i18n configuration (react-i18next) -│ │ ├── en.json # English translations -│ │ ├── hi.json # Hindi translations -│ │ ├── ta.json # Tamil (future) -│ │ └── te.json # Telugu (future) -│ │ -│ └── types/ -│ ├── user.ts -│ ├── transaction.ts -│ ├── goal.ts -│ ├── chat.ts -│ ├── investment.ts -│ ├── simulation.ts -│ ├── notification.ts -│ ├── navigation.ts -│ └── index.ts -│ -├── __tests__/ # Test files mirror src/ structure -│ ├── components/ -│ ├── hooks/ -│ ├── utils/ -│ └── screens/ -│ -└── .storybook/ # Storybook for component development - ├── main.ts - ├── preview.tsx - └── stories/ - ├── atoms/ - ├── molecules/ - └── organisms/ -``` - ---- - -## 13. IMPLEMENTATION PHASES - -### Phase 1: Foundation (Week 1–2) - -**Goal:** Project setup + design system + core components - -| # | Task | Deliverable | -|---|------|-------------| -| 1.1 | Initialize Expo project with TypeScript | Working Expo app with bare workflow | -| 1.2 | Configure Metro, Babel, ESLint, Prettier | Clean dev environment | -| 1.3 | Set up Expo Router file-based routing | Basic navigation working | -| 1.4 | Implement theme system (colors, typography, spacing) | `ThemeProvider` + `useTheme` hook | -| 1.5 | Install and configure fonts (Inter, Noto Sans Devanagari) | Fonts loading correctly | -| 1.6 | Build all Atom components (NText through NSpinner) | 16 atom components | -| 1.7 | Set up Storybook for component development | Storybook running with atom stories | -| 1.8 | Configure i18n (English + Hindi) | Language switching working | -| 1.9 | Set up secure storage + async storage | Token/PIN storage ready | -| 1.10 | Configure API client (Axios + interceptors) | API service layer ready | - -### Phase 2: Authentication & Onboarding (Week 3–4) - -**Goal:** Complete auth flow + onboarding experience - -| # | Task | Deliverable | -|---|------|-------------| -| 2.1 | Build `AuthScreenTemplate` | Reusable auth layout | -| 2.2 | Build Splash screen with Lottie animation | Animated splash | -| 2.3 | Build Welcome Carousel (3 slides) | Smooth swipeable carousel | -| 2.4 | Build Language Selection screen | Working language picker | -| 2.5 | Build Sign Up screen (phone input) | Phone validation + auto-format | -| 2.6 | Build OTP verification (6-digit, auto-read) | OTP with SMS auto-read | -| 2.7 | Build PIN creation + confirmation | Secure PIN flow | -| 2.8 | Build Biometric setup prompt | Fingerprint/FaceID enrollment | -| 2.9 | Build KYC Lite (PAN + details) | PAN validation, Indian format | -| 2.10 | Build Bank Linking flow | Bank selection + consent UI | -| 2.11 | Build Financial Profile wizard | Multi-step form completion | -| 2.12 | Build Login screen (PIN/Biometric/OTP) | Multi-method login | -| 2.13 | Implement auth state management (Zustand) | Persistent auth state | -| 2.14 | Connect to backend auth APIs | End-to-end auth working | - -### Phase 3: Home & Core Dashboard (Week 5–6) - -**Goal:** Home dashboard + transaction list + bottom navigation - -| # | Task | Deliverable | -|---|------|-------------| -| 3.1 | Build custom `BottomTabBar` with raised center | Tab navigation with AI button | -| 3.2 | Build `DashboardTemplate` | Scrollable dashboard layout | -| 3.3 | Build `AccountCarousel` | Swipeable account balance cards | -| 3.4 | Build `QuickAction` row | Request, Transfer, + buttons | -| 3.5 | Build `AIInsightCard` | Tappable AI nudge card | -| 3.6 | Build `TransactionItem` | Single transaction row | -| 3.7 | Build `TransactionList` with date grouping | Grouped list with pull-to-refresh | -| 3.8 | Build Home Dashboard screen | Complete home screen | -| 3.9 | Build Financial Health Score screen | Animated score gauge | -| 3.10 | Build Monthly Summary screen | Income/expense/savings breakdown | -| 3.11 | Build All Transactions screen | Full list + search + filters | -| 3.12 | Build Transaction Detail screen | Single txn view | -| 3.13 | Build Spending Analytics screen | Charts (bar, donut) | -| 3.14 | Implement pull-to-refresh + skeleton loading | Polish loading states | - -### Phase 4: AI Chat & Assistant (Week 7–8) - -**Goal:** Conversational AI interface — the killer feature - -| # | Task | Deliverable | -|---|------|-------------| -| 4.1 | Build `ChatScreenTemplate` | Keyboard-aware chat layout | -| 4.2 | Build `ChatBubble` (user + AI variants) | Rich chat bubbles | -| 4.3 | Build `ChatInputBar` (text + voice + send) | Input with suggestion chips | -| 4.4 | Build `SuggestionChip` component | Tappable quick prompts | -| 4.5 | Build AI typing indicator | 3-dot pulse animation | -| 4.6 | Build rich content rendering (charts, actions, tables) | Inline chart/action support | -| 4.7 | Build `ExplainabilityPanel` | Expandable assumptions/risks | -| 4.8 | Build Chat Home screen | AI avatar + suggestions layout | -| 4.9 | Build Chat Conversation screen | Full conversation with history | -| 4.10 | Build Voice Input screen | Recording + transcription UI | -| 4.11 | Build Chat History screen | Past conversations list | -| 4.12 | Connect WebSocket for real-time chat | Live AI responses | -| 4.13 | Implement chat message persistence | Offline support | - -### Phase 5: Goals & Simulations (Week 9–10) - -**Goal:** Goal planning + scenario simulations - -| # | Task | Deliverable | -|---|------|-------------| -| 5.1 | Build `GoalCard` with progress ring | Animated progress indicator | -| 5.2 | Build `GoalGrid` | Goals overview layout | -| 5.3 | Build Create Goal wizard | Multi-step goal creation | -| 5.4 | Build Goal Detail screen | Full goal view with AI recs | -| 5.5 | Build `SimulationSlider` | Interactive range slider | -| 5.6 | Build `SimulationChart` (react-native-chart-kit or Victory) | Interactive charts | -| 5.7 | Build Simulation Hub screen | Available simulations grid | -| 5.8 | Build Retirement Simulator | Sliders + projection chart | -| 5.9 | Build Loan Affordability Simulator | EMI calculator + impact | -| 5.10 | Build SIP Growth Simulator | Compound growth visualization | -| 5.11 | Build Life Event Simulator | Impact analysis screens | -| 5.12 | Build Simulation Result screen | 3-scenario comparison + save | - -### Phase 6: Transfers, Bills & Payments (Week 11–12) - -**Goal:** Complete money movement flows - -| # | Task | Deliverable | -|---|------|-------------| -| 6.1 | Build Transfer Home screen | Destination + contacts UI | -| 6.2 | Build UPI Transfer flow | UPI ID → Amount → Confirm | -| 6.3 | Build `AmountKeypad` | Custom numeric keypad | -| 6.4 | Build QR Scanner (Scan & Pay) | Camera QR scanning | -| 6.5 | Build Transfer Confirm screen | Review + auth | -| 6.6 | Build `BiometricPrompt` modal | Fingerprint/FaceID prompt | -| 6.7 | Build Transfer Success screen | Animated success | -| 6.8 | Build Beneficiary Management | Add/edit/remove contacts | -| 6.9 | Build Bills Dashboard | Upcoming/overdue bills | -| 6.10 | Build Subscription Tracker | Auto-detected subscriptions | - -### Phase 7: Investments, Profile & Polish (Week 13–14) - -**Goal:** Portfolio views + settings + production polish - -| # | Task | Deliverable | -|---|------|-------------| -| 7.1 | Build Portfolio Overview screen | Allocation donut + list | -| 7.2 | Build `InvestmentPortfolio` organism | Holdings list component | -| 7.3 | Build SIP Manager screen | Active SIPs management | -| 7.4 | Build Rebalancing Advisor | AI suggestions | -| 7.5 | Build Profile Home screen | Settings list | -| 7.6 | Build Security Settings | PIN change, biometric toggle | -| 7.7 | Build Linked Accounts management | Bank add/remove | -| 7.8 | Build Notification Center | Grouped notifications | -| 7.9 | Build Reports Hub + Monthly Report | Report generation | -| 7.10 | Build Privacy & Data screen | Export, delete controls | -| 7.11 | Build Help & Support screen | FAQ, contact | - -### Phase 8: Testing, Accessibility & Launch (Week 15–16) - -**Goal:** Production readiness - -| # | Task | Deliverable | -|---|------|-------------| -| 8.1 | Component unit tests (Jest + React Native Testing Library) | 80% coverage on components | -| 8.2 | Screen integration tests | Key flow coverage | -| 8.3 | E2E tests (Detox) | Auth, transfer, chat flows | -| 8.4 | Accessibility audit (Axe, manual screen reader) | WCAG 2.1 AA pass | -| 8.5 | Performance audit (FlipperHeapInspector, React profiler) | < 100ms interaction delay | -| 8.6 | Dark mode QA | All screens verified in dark | -| 8.7 | Hindi language QA | Full Hindi experience verified | -| 8.8 | EAS Build configuration (iOS + Android) | Production builds | -| 8.9 | App Store / Play Store screenshots + metadata | Store listings ready | -| 8.10 | Beta release (TestFlight / Internal Testing Track) | Beta deployed | - ---- - -## 14. QUALITY CHECKLIST - -### Per-Component Checklist - -- [ ] Renders correctly in light mode -- [ ] Renders correctly in dark mode -- [ ] Accessibility labels present -- [ ] Touch targets ≥ 44x44px -- [ ] Loading/skeleton state defined -- [ ] Error states handled -- [ ] Empty states designed -- [ ] Storybook story written -- [ ] Unit test written -- [ ] Hindi text doesn't break layout - -### Per-Screen Checklist - -- [ ] Safe area handling (notch, home indicator) -- [ ] Keyboard avoidance working -- [ ] Pull-to-refresh implemented (data screens) -- [ ] Skeleton loading on initial fetch -- [ ] Error state with retry -- [ ] Empty state with illustration -- [ ] Back navigation works -- [ ] Deep linking configured -- [ ] Analytics screen view event fires -- [ ] Matches approved Figma design - -### Pre-Launch Checklist - -- [ ] All 83 screens built and tested -- [ ] ₹ Indian number formatting works everywhere -- [ ] PAN/Aadhaar/IFSC/UPI validators work correctly -- [ ] Biometric auth works on iOS + Android -- [ ] Push notifications configured (FCM + APNs) -- [ ] Offline mode graceful (cached data shown, queued actions) -- [ ] App size < 50MB (initial download) -- [ ] Cold start < 2 seconds -- [ ] Memory usage < 200MB in normal use -- [ ] No PII in logs or analytics -- [ ] SSL certificate pinning configured for API -- [ ] App Transport Security configured -- [ ] ProGuard rules configured (Android) -- [ ] App Store / Play Store guidelines met -- [ ] Privacy policy and terms of service linked -- [ ] RBI compliance disclosures present - ---- - -## DEPENDENCY MANIFEST - -### Core Dependencies - -```json -{ - "expo": "~52.0.0", - "expo-router": "~4.0.0", - "react": "18.3.x", - "react-native": "0.76.x", - "typescript": "~5.3.0", - - "react-native-reanimated": "~3.16.0", - "react-native-gesture-handler": "~2.20.0", - "react-native-screens": "~4.4.0", - "react-native-safe-area-context": "~4.12.0", - - "@gorhom/bottom-sheet": "^4", - "react-native-svg": "~15.8.0", - "lottie-react-native": "^7.0.0", - "react-native-chart-kit": "^6.12.0", - "victory-native": "^41.0.0", - - "zustand": "^5.0.0", - "@tanstack/react-query": "^5.0.0", - "axios": "^1.7.0", - "socket.io-client": "^4.8.0", - - "react-i18next": "^15.0.0", - "i18next": "^24.0.0", - - "expo-secure-store": "~14.0.0", - "@react-native-async-storage/async-storage": "~2.1.0", - "expo-local-authentication": "~15.0.0", - "expo-camera": "~16.0.0", - "expo-notifications": "~0.29.0", - - "phosphor-react-native": "^2.1.0", - "expo-font": "~13.0.0", - "expo-splash-screen": "~0.29.0", - - "react-hook-form": "^7.54.0", - "zod": "^3.23.0", - "@hookform/resolvers": "^3.9.0", - - "date-fns": "^4.1.0" -} -``` - -### Dev Dependencies - -```json -{ - "jest": "^29.7.0", - "@testing-library/react-native": "^12.8.0", - "detox": "^20.0.0", - "@storybook/react-native": "^8.0.0", - "eslint": "^9.0.0", - "prettier": "^3.4.0", - "@typescript-eslint/eslint-plugin": "^8.0.0" -} -``` - ---- - -## APPENDIX A: INDIAN FINANCIAL CONTEXT CONSTANTS - -### Investment Instruments - -| Instrument | Abbreviation | Icon | Color | -|-----------|-------------|------|-------| -| Mutual Fund | MF | 📊 | `#4F46E5` | -| Systematic Investment Plan | SIP | 🔄 | `#059669` | -| Fixed Deposit | FD | 🏦 | `#D97706` | -| Public Provident Fund | PPF | 🏛️ | `#7C3AED` | -| National Pension System | NPS | 🧓 | `#2563EB` | -| Recurring Deposit | RD | 📅 | `#DC2626` | -| Employee Provident Fund | EPF | 🏢 | `#0891B2` | -| Equity (Stocks) | EQ | 📈 | `#16A34A` | -| Gold/SGBs | GOLD | 🥇 | `#CA8A04` | -| Real Estate | RE | 🏠 | `#9333EA` | - -### Transaction Categories (Indian Context) - -| Category | Icon | Color | -|----------|------|-------| -| Groceries & Kirana | 🛒 | `#059669` | -| Food & Dining | 🍕 | `#EA580C` | -| Transport & Auto | 🚗 | `#4F46E5` | -| Medical & Health | 🏥 | `#DC2626` | -| Education & Tuition | 📚 | `#7C3AED` | -| Rent & Housing | 🏠 | `#0891B2` | -| Utilities (Electricity/Gas/Water) | ⚡ | `#D97706` | -| Mobile & Internet | 📱 | `#2563EB` | -| Entertainment & OTT | 🎬 | `#DB2777` | -| Shopping & Fashion | 🛍️ | `#9333EA` | -| Travel & Holiday | ✈️ | `#0D9488` | -| Insurance Premium | 🛡️ | `#1D4ED8` | -| EMI & Loan Payment | 🏦 | `#B91C1C` | -| Salary | 💰 | `#059669` | -| Freelance/Side Income | 💼 | `#4F46E5` | -| Investment Returns | 📈 | `#16A34A` | -| Gift / Shagun | 🎁 | `#DB2777` | -| Religious / Charity | 🙏 | `#CA8A04` | - -### Indian Tax Context - -| Item | Value | -|------|-------| -| Fiscal Year | April 1 – March 31 | -| Tax Filing Deadline | July 31 (non-audit) | -| Section 80C Limit | ₹1,50,000 | -| Section 80D Limit | ₹25,000/₹50,000 (senior) | -| NPS Additional Deduction | ₹50,000 (80CCD(1B)) | -| Standard Deduction | ₹50,000 | -| New Tax Regime Default | Yes (from FY 2023-24) | - ---- - -## APPENDIX B: STORYBOOK STORY STRUCTURE - -Every component gets a story file: - -``` -.storybook/stories/ -├── atoms/ -│ ├── NButton.stories.tsx # All button variants -│ ├── NText.stories.tsx # All typography variants -│ ├── NInput.stories.tsx # Text, password, amount, OTP -│ ├── NProgressRing.stories.tsx # Various progress states -│ └── ... -├── molecules/ -│ ├── AmountDisplay.stories.tsx # ₹ format, +/-, abbreviated -│ ├── BalanceCard.stories.tsx # VISA, Mastercard, hidden balance -│ ├── TransactionItem.stories.tsx # Income, expense, pending -│ └── ... -└── organisms/ - ├── AccountCarousel.stories.tsx # Multi-account, single account - ├── ChatBubble.stories.tsx # Text, chart, actions, loading - ├── TransactionList.stories.tsx # With data, empty, loading - └── ... -``` - ---- - -*This SOP document serves as the single source of truth for the Nivesh mobile app frontend development. All screens, components, flows, and design tokens are defined here. Any deviation requires a design review and SOP update.* - -**Document Owner:** UI/UX Lead -**Review Cycle:** Bi-weekly during active development -**Approval Required From:** Product Owner + Engineering Lead diff --git a/mobile_design/src/theme/ThemeProvider.tsx b/mobile_design/src/theme/ThemeProvider.tsx deleted file mode 100644 index d592621..0000000 --- a/mobile_design/src/theme/ThemeProvider.tsx +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Nivesh Design System — Theme Provider - * Manages light/dark theme switching with React Context - */ - -import React, { createContext, useContext, useState, useCallback, useMemo } from 'react'; -import { useColorScheme } from 'react-native'; -import { lightTheme, darkTheme, type ThemeColors } from './colors'; -import { typeScale, fontFamily } from './typography'; -import { spacing, borderRadius, iconSize } from './spacing'; -import { shadows } from './shadows'; - -type ThemeMode = 'light' | 'dark' | 'system'; - -interface ThemeContextValue { - colors: ThemeColors; - typography: typeof typeScale; - fonts: typeof fontFamily; - spacing: typeof spacing; - borderRadius: typeof borderRadius; - iconSize: typeof iconSize; - shadows: typeof shadows; - isDark: boolean; - mode: ThemeMode; - setMode: (mode: ThemeMode) => void; -} - -const ThemeContext = createContext(null); - -interface ThemeProviderProps { - children: React.ReactNode; - initialMode?: ThemeMode; -} - -export function ThemeProvider({ children, initialMode = 'system' }: ThemeProviderProps) { - const systemScheme = useColorScheme(); - const [mode, setMode] = useState(initialMode); - - const isDark = mode === 'system' ? systemScheme === 'dark' : mode === 'dark'; - - const value = useMemo( - () => ({ - colors: isDark ? darkTheme : lightTheme, - typography: typeScale, - fonts: fontFamily, - spacing, - borderRadius, - iconSize, - shadows, - isDark, - mode, - setMode, - }), - [isDark, mode], - ); - - return {children}; -} - -export function useTheme(): ThemeContextValue { - const context = useContext(ThemeContext); - if (!context) { - throw new Error('useTheme must be used within a ThemeProvider'); - } - return context; -} diff --git a/mobile_design/src/theme/animations.ts b/mobile_design/src/theme/animations.ts deleted file mode 100644 index 0d9eaf0..0000000 --- a/mobile_design/src/theme/animations.ts +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Nivesh Design System — Animation Presets - * Used with react-native-reanimated - */ - -import { Easing } from 'react-native-reanimated'; - -export const animationDuration = { - instant: 100, - fast: 150, - normal: 200, - slow: 300, - slower: 600, - slowest: 1000, -} as const; - -export const springConfigs = { - /** Gentle spring for card press/release */ - gentle: { - damping: 15, - stiffness: 150, - mass: 1, - }, - /** Responsive spring for most interactions */ - responsive: { - damping: 20, - stiffness: 300, - mass: 1, - }, - /** Bouncy spring for success/celebration */ - bouncy: { - damping: 12, - stiffness: 200, - mass: 1, - }, - /** Snappy for bottom sheet drag */ - snappy: { - damping: 20, - stiffness: 400, - mass: 0.8, - }, -} as const; - -export const easingPresets = { - standard: Easing.bezier(0.25, 0.1, 0.25, 1), - decelerate: Easing.out(Easing.cubic), - accelerate: Easing.in(Easing.cubic), - sharp: Easing.bezier(0.4, 0, 0.2, 1), -} as const; - -export const skeletonTiming = { - duration: 1500, - easing: Easing.linear, -} as const; diff --git a/mobile_design/src/theme/colors.ts b/mobile_design/src/theme/colors.ts deleted file mode 100644 index 56a6fa8..0000000 --- a/mobile_design/src/theme/colors.ts +++ /dev/null @@ -1,262 +0,0 @@ -/** - * Nivesh Design System — Color Tokens - * Based on Beige Tetradic Palette + Functional Colors - */ - -export const palette = { - // === PRIMARY BEIGE PALETTE === - beige: { - 50: '#FAF8F0', - 100: '#F5F0E1', - 200: '#EDE8D0', - 300: '#E0D9BF', - 400: '#C9C1A4', - 500: '#A89E7E', - 600: '#8A8064', - 700: '#6B624D', - 800: '#4D4537', - 900: '#2F2A22', - }, - - // === MINT (Success / Income / Positive) === - mint: { - 50: '#F0FAF3', - 100: '#E8F5EC', - 200: '#D0EDDA', - 300: '#A8D9B8', - 400: '#7CC498', - 500: '#4DAF75', - 600: '#2E9E5A', - 700: '#1F7A43', - 800: '#155A31', - 900: '#0D3B20', - }, - - // === LAVENDER (AI / Analytics / Info) === - lavender: { - 50: '#F0F1FA', - 100: '#E8E9F5', - 200: '#D0D5ED', - 300: '#B0B8D9', - 400: '#8E99C7', - 500: '#6E7BB5', - 600: '#5563A0', - 700: '#424E82', - 800: '#313A63', - 900: '#212745', - }, - - // === ROSE (Alerts / Expenses / Negative) === - rose: { - 50: '#FAF0F5', - 100: '#F5E8EE', - 200: '#EDD0E4', - 300: '#D9A8C4', - 400: '#C780A5', - 500: '#B55A88', - 600: '#9E3D6E', - 700: '#7D2F56', - 800: '#5C223F', - 900: '#3D162A', - }, - - // === ACCENT YELLOW (CTAs / Primary Actions) === - yellow: { - 50: '#FFFEF5', - 100: '#FFF9DB', - 200: '#FFF0A8', - 300: '#FFE676', - 400: '#FFD84D', - 500: '#F5C518', - 600: '#E0B200', - 700: '#B88E00', - 800: '#8A6B00', - 900: '#5C4700', - }, - - // === NEUTRALS === - neutral: { - 0: '#FFFFFF', - 50: '#FAFAFA', - 100: '#F5F5F5', - 200: '#E5E5E5', - 300: '#D4D4D4', - 400: '#A3A3A3', - 500: '#737373', - 600: '#525252', - 700: '#404040', - 800: '#262626', - 900: '#171717', - 1000: '#000000', - }, - - // === SEMANTIC === - income: '#2E9E5A', - expense: '#D64545', - warning: '#E0A800', - info: '#4F7BD6', - error: '#D64545', - success: '#2E9E5A', -} as const; - -export const lightTheme = { - // === BACKGROUNDS === - background: palette.beige[50], - backgroundSecondary: palette.beige[100], - surface: palette.neutral[0], - surfaceElevated: palette.neutral[0], - - // === TEXT === - textPrimary: '#1A1A2E', - textSecondary: '#6B6B80', - textTertiary: '#9E9EB0', - textInverse: '#FFFFFF', - textLink: palette.lavender[600], - - // === ACCENT === - accent: palette.yellow[500], - accentPressed: palette.yellow[600], - accentLight: palette.yellow[100], - - // === STATUS === - income: palette.mint[600], - incomeBackground: palette.mint[100], - expense: '#D64545', - expenseBackground: palette.rose[100], - warning: palette.yellow[600], - warningBackground: palette.yellow[100], - info: palette.lavender[600], - infoBackground: palette.lavender[100], - success: palette.mint[600], - successBackground: palette.mint[100], - error: '#D64545', - errorBackground: '#FFF0F0', - - // === BORDERS & DIVIDERS === - border: palette.neutral[200], - borderLight: palette.neutral[100], - divider: palette.neutral[200], - - // === INTERACTIVE === - buttonPrimary: palette.yellow[500], - buttonPrimaryText: '#1A1A2E', - buttonSecondary: palette.beige[200], - buttonSecondaryText: '#1A1A2E', - buttonGhost: 'transparent', - buttonGhostText: '#1A1A2E', - buttonDanger: '#D64545', - buttonDangerText: '#FFFFFF', - buttonDisabled: palette.neutral[200], - buttonDisabledText: palette.neutral[400], - - // === NAVIGATION === - tabBarBackground: palette.neutral[0], - tabBarActive: palette.yellow[500], - tabBarInactive: palette.neutral[400], - tabBarBorder: palette.neutral[200], - - // === AI / CHAT === - aiBackground: palette.lavender[100], - aiBubble: palette.lavender[100], - userBubble: palette.beige[200], - chatBackground: palette.beige[50], - - // === CARDS === - cardBackground: palette.neutral[0], - cardBorder: palette.neutral[200], - - // === OVERLAY === - overlay: 'rgba(0,0,0,0.5)', - overlayLight: 'rgba(0,0,0,0.1)', - - // === SKELETON === - skeletonBase: palette.neutral[200], - skeletonHighlight: palette.neutral[100], -} as const; - -export const darkTheme: typeof lightTheme = { - // === BACKGROUNDS === - background: '#0D0D1A', - backgroundSecondary: '#15152A', - surface: '#1A1A2E', - surfaceElevated: '#222240', - - // === TEXT === - textPrimary: '#F5F0E1', - textSecondary: '#A0A0B0', - textTertiary: '#6B6B80', - textInverse: '#1A1A2E', - textLink: palette.lavender[300], - - // === ACCENT === - accent: palette.yellow[500], - accentPressed: palette.yellow[600], - accentLight: 'rgba(245,197,24,0.15)', - - // === STATUS === - income: '#4ADE80', - incomeBackground: 'rgba(74,222,128,0.15)', - expense: '#F87171', - expenseBackground: 'rgba(248,113,113,0.15)', - warning: palette.yellow[400], - warningBackground: 'rgba(245,197,24,0.15)', - info: palette.lavender[300], - infoBackground: 'rgba(176,184,217,0.15)', - success: '#4ADE80', - successBackground: 'rgba(74,222,128,0.15)', - error: '#F87171', - errorBackground: 'rgba(248,113,113,0.15)', - - // === BORDERS & DIVIDERS === - border: '#2A2A3E', - borderLight: '#222240', - divider: '#2A2A3E', - - // === INTERACTIVE === - buttonPrimary: palette.yellow[500], - buttonPrimaryText: '#1A1A2E', - buttonSecondary: '#2A2A3E', - buttonSecondaryText: '#F5F0E1', - buttonGhost: 'transparent', - buttonGhostText: '#F5F0E1', - buttonDanger: '#F87171', - buttonDangerText: '#1A1A2E', - buttonDisabled: '#2A2A3E', - buttonDisabledText: '#6B6B80', - - // === NAVIGATION === - tabBarBackground: '#1A1A2E', - tabBarActive: palette.yellow[500], - tabBarInactive: '#6B6B80', - tabBarBorder: '#2A2A3E', - - // === AI / CHAT === - aiBackground: 'rgba(176,184,217,0.1)', - aiBubble: '#222240', - userBubble: '#2A2A3E', - chatBackground: '#0D0D1A', - - // === CARDS === - cardBackground: '#1A1A2E', - cardBorder: '#2A2A3E', - - // === OVERLAY === - overlay: 'rgba(0,0,0,0.7)', - overlayLight: 'rgba(0,0,0,0.3)', - - // === SKELETON === - skeletonBase: '#2A2A3E', - skeletonHighlight: '#222240', -} as const; - -export const gradients = { - card: ['#F5F0E1', '#FAF8F0'], - hero: ['#EDE8D0', '#D0EDDA'], - ai: ['#D0D5ED', '#E8E9F5'], - alert: ['#EDD0E4', '#F5E8EE'], - accent: ['#F5C518', '#FFD84D'], - cardDark: ['#1A1A2E', '#222240'], - heroDark: ['#0D0D1A', '#15152A'], -} as const; - -export type ThemeColors = typeof lightTheme; diff --git a/mobile_design/src/theme/index.ts b/mobile_design/src/theme/index.ts deleted file mode 100644 index 8a299f5..0000000 --- a/mobile_design/src/theme/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Nivesh Design System — Theme Barrel Export - */ - -export { palette, lightTheme, darkTheme, gradients, type ThemeColors } from './colors'; -export { fontFamily, typeScale, type TypeVariant } from './typography'; -export { spacing, borderRadius, iconSize, type Spacing, type BorderRadius, type IconSize } from './spacing'; -export { shadows } from './shadows'; -export { animationDuration, springConfigs, easingPresets, skeletonTiming } from './animations'; -export { ThemeProvider, useTheme } from './ThemeProvider'; diff --git a/mobile_design/src/theme/shadows.ts b/mobile_design/src/theme/shadows.ts deleted file mode 100644 index 2331fe6..0000000 --- a/mobile_design/src/theme/shadows.ts +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Nivesh Design System — Shadow Definitions - */ - -import { Platform, ViewStyle } from 'react-native'; - -type ShadowStyle = Pick< - ViewStyle, - 'shadowColor' | 'shadowOffset' | 'shadowOpacity' | 'shadowRadius' | 'elevation' ->; - -export const shadows = { - none: { - shadowColor: 'transparent', - shadowOffset: { width: 0, height: 0 }, - shadowOpacity: 0, - shadowRadius: 0, - elevation: 0, - } as ShadowStyle, - - sm: Platform.select({ - ios: { - shadowColor: '#000000', - shadowOffset: { width: 0, height: 1 }, - shadowOpacity: 0.04, - shadowRadius: 2, - }, - android: { - elevation: 1, - }, - }) as ShadowStyle, - - md: Platform.select({ - ios: { - shadowColor: '#000000', - shadowOffset: { width: 0, height: 2 }, - shadowOpacity: 0.06, - shadowRadius: 8, - }, - android: { - elevation: 3, - }, - }) as ShadowStyle, - - lg: Platform.select({ - ios: { - shadowColor: '#000000', - shadowOffset: { width: 0, height: 4 }, - shadowOpacity: 0.08, - shadowRadius: 16, - }, - android: { - elevation: 6, - }, - }) as ShadowStyle, - - xl: Platform.select({ - ios: { - shadowColor: '#000000', - shadowOffset: { width: 0, height: 8 }, - shadowOpacity: 0.12, - shadowRadius: 24, - }, - android: { - elevation: 12, - }, - }) as ShadowStyle, -} as const; diff --git a/mobile_design/src/theme/spacing.ts b/mobile_design/src/theme/spacing.ts deleted file mode 100644 index 40ee367..0000000 --- a/mobile_design/src/theme/spacing.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Nivesh Design System — Spacing, Borders, Shadows - */ - -export const spacing = { - xs: 4, - sm: 8, - md: 12, - base: 16, - lg: 20, - xl: 24, - '2xl': 32, - '3xl': 40, - '4xl': 48, - '5xl': 64, -} as const; - -export const borderRadius = { - xs: 4, - sm: 8, - md: 12, - lg: 16, - xl: 20, - '2xl': 24, - full: 9999, -} as const; - -export const iconSize = { - xs: 16, - sm: 20, - md: 24, - lg: 32, - xl: 40, - hero: 64, -} as const; - -export type Spacing = keyof typeof spacing; -export type BorderRadius = keyof typeof borderRadius; -export type IconSize = keyof typeof iconSize; diff --git a/mobile_design/src/theme/typography.ts b/mobile_design/src/theme/typography.ts deleted file mode 100644 index b03a234..0000000 --- a/mobile_design/src/theme/typography.ts +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Nivesh Design System — Typography Tokens - * Font: Inter (primary) + Noto Sans Devanagari (Hindi fallback) - */ - -export const fontFamily = { - regular: 'Inter-Regular', - medium: 'Inter-Medium', - semiBold: 'Inter-SemiBold', - bold: 'Inter-Bold', - extraBold: 'Inter-ExtraBold', - hindi: 'NotoSansDevanagari-Regular', - hindiBold: 'NotoSansDevanagari-Bold', -} as const; - -export const typeScale = { - displayLarge: { - fontFamily: fontFamily.extraBold, - fontSize: 40, - lineHeight: 48, - }, - displayMedium: { - fontFamily: fontFamily.bold, - fontSize: 32, - lineHeight: 40, - }, - displaySmall: { - fontFamily: fontFamily.bold, - fontSize: 28, - lineHeight: 36, - }, - headingLarge: { - fontFamily: fontFamily.semiBold, - fontSize: 24, - lineHeight: 32, - }, - headingMedium: { - fontFamily: fontFamily.semiBold, - fontSize: 20, - lineHeight: 28, - }, - headingSmall: { - fontFamily: fontFamily.semiBold, - fontSize: 18, - lineHeight: 24, - }, - bodyLarge: { - fontFamily: fontFamily.regular, - fontSize: 16, - lineHeight: 24, - }, - bodyMedium: { - fontFamily: fontFamily.regular, - fontSize: 14, - lineHeight: 20, - }, - bodySmall: { - fontFamily: fontFamily.regular, - fontSize: 12, - lineHeight: 16, - }, - labelLarge: { - fontFamily: fontFamily.medium, - fontSize: 14, - lineHeight: 20, - }, - labelMedium: { - fontFamily: fontFamily.medium, - fontSize: 12, - lineHeight: 16, - }, - labelSmall: { - fontFamily: fontFamily.medium, - fontSize: 10, - lineHeight: 14, - }, -} as const; - -export type TypeVariant = keyof typeof typeScale; diff --git a/mobile_design/src/utils/categories.ts b/mobile_design/src/utils/categories.ts deleted file mode 100644 index 6c6ecf9..0000000 --- a/mobile_design/src/utils/categories.ts +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Nivesh — Indian Spending Categories - * With icons, colors, and Hindi translations - */ - -export interface SpendingCategory { - id: string; - name: string; - nameHi: string; - icon: string; - color: string; - type: 'expense' | 'income' | 'transfer'; -} - -export const categories: SpendingCategory[] = [ - // === EXPENSES === - { id: 'groceries', name: 'Groceries & Kirana', nameHi: 'किराना', icon: 'ShoppingCart', color: '#059669', type: 'expense' }, - { id: 'food', name: 'Food & Dining', nameHi: 'खाना', icon: 'ForkKnife', color: '#EA580C', type: 'expense' }, - { id: 'transport', name: 'Transport & Auto', nameHi: 'यातायात', icon: 'Car', color: '#4F46E5', type: 'expense' }, - { id: 'medical', name: 'Medical & Health', nameHi: 'स्वास्थ्य', icon: 'FirstAidKit', color: '#DC2626', type: 'expense' }, - { id: 'education', name: 'Education & Tuition', nameHi: 'शिक्षा', icon: 'GraduationCap', color: '#7C3AED', type: 'expense' }, - { id: 'rent', name: 'Rent & Housing', nameHi: 'किराया', icon: 'House', color: '#0891B2', type: 'expense' }, - { id: 'utilities', name: 'Utilities', nameHi: 'बिजली/पानी/गैस', icon: 'Lightning', color: '#D97706', type: 'expense' }, - { id: 'mobile', name: 'Mobile & Internet', nameHi: 'मोबाइल/इंटरनेट', icon: 'DeviceMobile', color: '#2563EB', type: 'expense' }, - { id: 'entertainment', name: 'Entertainment & OTT', nameHi: 'मनोरंजन', icon: 'FilmSlate', color: '#DB2777', type: 'expense' }, - { id: 'shopping', name: 'Shopping & Fashion', nameHi: 'खरीदारी', icon: 'Bag', color: '#9333EA', type: 'expense' }, - { id: 'travel', name: 'Travel & Holiday', nameHi: 'यात्रा', icon: 'Airplane', color: '#0D9488', type: 'expense' }, - { id: 'insurance', name: 'Insurance Premium', nameHi: 'बीमा', icon: 'Shield', color: '#1D4ED8', type: 'expense' }, - { id: 'emi', name: 'EMI & Loan Payment', nameHi: 'EMI/लोन', icon: 'Bank', color: '#B91C1C', type: 'expense' }, - { id: 'gift', name: 'Gift / Shagun', nameHi: 'शगुन/उपहार', icon: 'Gift', color: '#DB2777', type: 'expense' }, - { id: 'religious', name: 'Religious / Charity', nameHi: 'धार्मिक/दान', icon: 'HandHeart', color: '#CA8A04', type: 'expense' }, - { id: 'personal', name: 'Personal Care', nameHi: 'व्यक्तिगत', icon: 'User', color: '#6366F1', type: 'expense' }, - - // === INCOME === - { id: 'salary', name: 'Salary', nameHi: 'वेतन', icon: 'Wallet', color: '#059669', type: 'income' }, - { id: 'freelance', name: 'Freelance / Side Income', nameHi: 'फ्रीलांस', icon: 'Briefcase', color: '#4F46E5', type: 'income' }, - { id: 'investment_return', name: 'Investment Returns', nameHi: 'निवेश लाभ', icon: 'TrendUp', color: '#16A34A', type: 'income' }, - { id: 'rental_income', name: 'Rental Income', nameHi: 'किराये से आय', icon: 'Buildings', color: '#0891B2', type: 'income' }, - { id: 'interest', name: 'Interest Income', nameHi: 'ब्याज आय', icon: 'Percent', color: '#7C3AED', type: 'income' }, - { id: 'refund', name: 'Refund', nameHi: 'वापसी', icon: 'ArrowCounterClockwise', color: '#2563EB', type: 'income' }, - - // === TRANSFERS === - { id: 'self_transfer', name: 'Self Transfer', nameHi: 'स्वयं ट्रांसफर', icon: 'ArrowsLeftRight', color: '#6B7280', type: 'transfer' }, - { id: 'upi_transfer', name: 'UPI Transfer', nameHi: 'UPI ट्रांसफर', icon: 'QrCode', color: '#4F46E5', type: 'transfer' }, -]; - -export function getCategoryById(id: string): SpendingCategory | undefined { - return categories.find((c) => c.id === id); -} - -export function getCategoriesByType(type: SpendingCategory['type']): SpendingCategory[] { - return categories.filter((c) => c.type === type); -} diff --git a/mobile_design/src/utils/constants.ts b/mobile_design/src/utils/constants.ts deleted file mode 100644 index 5af3d0e..0000000 --- a/mobile_design/src/utils/constants.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Nivesh — App Constants - */ - -export const APP_NAME = 'Nivesh'; -export const APP_TAGLINE = 'Your AI Financial Strategist'; - -/** Indian fiscal year: April 1 – March 31 */ -export const FISCAL_YEAR_START_MONTH = 3; // April (0-indexed) -export const FISCAL_YEAR_END_MONTH = 2; // March (0-indexed) - -/** Tax constants (FY 2025-26) */ -export const TAX = { - SECTION_80C_LIMIT: 150000, - SECTION_80D_SELF: 25000, - SECTION_80D_SENIOR: 50000, - NPS_80CCD_1B: 50000, - STANDARD_DEDUCTION: 50000, -} as const; - -/** Animation durations (ms) */ -export const SPLASH_DURATION = 1500; -export const TOAST_DURATION = 3000; -export const DEBOUNCE_SEARCH = 300; -export const OTP_RESEND_TIMER = 30; -export const PIN_LENGTH = 4; -export const OTP_LENGTH = 6; - -/** API */ -export const API_TIMEOUT = 15000; -export const REFRESH_INTERVAL = 60000; // 1 minute - -/** Pagination */ -export const PAGE_SIZE = 20; - -/** Bottom Tab */ -export const TAB_BAR_HEIGHT = 56; -export const TAB_CENTER_BUTTON_SIZE = 56; - -/** Investment Instruments */ -export const INSTRUMENTS = { - MF: { label: 'Mutual Fund', abbr: 'MF', color: '#4F46E5' }, - SIP: { label: 'SIP', abbr: 'SIP', color: '#059669' }, - FD: { label: 'Fixed Deposit', abbr: 'FD', color: '#D97706' }, - PPF: { label: 'PPF', abbr: 'PPF', color: '#7C3AED' }, - NPS: { label: 'NPS', abbr: 'NPS', color: '#2563EB' }, - RD: { label: 'Recurring Deposit', abbr: 'RD', color: '#DC2626' }, - EPF: { label: 'EPF', abbr: 'EPF', color: '#0891B2' }, - EQ: { label: 'Equity', abbr: 'EQ', color: '#16A34A' }, - GOLD: { label: 'Gold/SGBs', abbr: 'GOLD', color: '#CA8A04' }, - RE: { label: 'Real Estate', abbr: 'RE', color: '#9333EA' }, -} as const; diff --git a/mobile_design/src/utils/formatAmount.ts b/mobile_design/src/utils/formatAmount.ts deleted file mode 100644 index 4b2a3c8..0000000 --- a/mobile_design/src/utils/formatAmount.ts +++ /dev/null @@ -1,103 +0,0 @@ -/** - * Nivesh — Indian Amount Formatting Utility - * Formats numbers in the Indian numbering system (lakhs, crores) - */ - -/** - * Format a number in the Indian numbering system with ₹ symbol. - * Examples: - * formatAmount(40500.80) → "₹40,500.80" - * formatAmount(100000) → "₹1,00,000" - * formatAmount(25000000) → "₹2,50,00,000" - */ -export function formatAmount( - value: number, - options?: { - showSign?: boolean; - decimals?: number; - symbol?: string; - }, -): string { - const { showSign = false, decimals = 2, symbol = '₹' } = options ?? {}; - - const isNegative = value < 0; - const absValue = Math.abs(value); - - const [intPart, decPart] = absValue.toFixed(decimals).split('.'); - - // Indian grouping: first group of 3 from right, then groups of 2 - const formatted = formatIndianGrouping(intPart); - const decimal = decimals > 0 ? `.${decPart}` : ''; - - const sign = showSign ? (isNegative ? '-' : '+') : isNegative ? '-' : ''; - - return `${sign}${symbol}${formatted}${decimal}`; -} - -/** - * Format a number with Indian grouping (e.g., 1,00,000). - */ -function formatIndianGrouping(numStr: string): string { - if (numStr.length <= 3) return numStr; - - const lastThree = numStr.slice(-3); - const remaining = numStr.slice(0, -3); - - // Group remaining digits in pairs from the right - const pairs = remaining.replace(/\B(?=(\d{2})+(?!\d))/g, ','); - - return `${pairs},${lastThree}`; -} - -/** - * Abbreviate large amounts (Indian style: L for Lakhs, Cr for Crores). - * Examples: - * abbreviateAmount(150000) → "₹1.5L" - * abbreviateAmount(25000000) → "₹2.5Cr" - * abbreviateAmount(5000) → "₹5,000" - */ -export function abbreviateAmount(value: number, symbol = '₹'): string { - const absValue = Math.abs(value); - const sign = value < 0 ? '-' : ''; - - if (absValue >= 10000000) { - const crores = absValue / 10000000; - return `${sign}${symbol}${formatDecimal(crores)}Cr`; - } - if (absValue >= 100000) { - const lakhs = absValue / 100000; - return `${sign}${symbol}${formatDecimal(lakhs)}L`; - } - if (absValue >= 1000) { - const thousands = absValue / 1000; - return `${sign}${symbol}${formatDecimal(thousands)}K`; - } - - return `${sign}${symbol}${absValue}`; -} - -function formatDecimal(num: number): string { - if (Number.isInteger(num)) return num.toString(); - return num.toFixed(1).replace(/\.0$/, ''); -} - -/** - * Speak amount for accessibility (screen readers). - * Returns: "Rupees forty thousand five hundred and eighty paise" - */ -export function spokenAmount(value: number): string { - const rupees = Math.floor(Math.abs(value)); - const paise = Math.round((Math.abs(value) - rupees) * 100); - - const parts: string[] = []; - - if (value < 0) parts.push('minus'); - parts.push('Rupees'); - parts.push(rupees.toLocaleString('en-IN')); - - if (paise > 0) { - parts.push(`and ${paise} paise`); - } - - return parts.join(' '); -} diff --git a/mobile_design/src/utils/index.ts b/mobile_design/src/utils/index.ts deleted file mode 100644 index 2151a22..0000000 --- a/mobile_design/src/utils/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export { formatAmount, abbreviateAmount, spokenAmount } from './formatAmount'; -export { isValidPAN, isValidAadhaar, isValidIFSC, isValidUPI, isValidMobile, isValidAccountNumber, maskPAN, maskAadhaar, maskMobile } from './validators'; -export { categories, getCategoryById, getCategoriesByType, type SpendingCategory } from './categories'; -export * from './constants'; diff --git a/mobile_design/src/utils/validators.ts b/mobile_design/src/utils/validators.ts deleted file mode 100644 index ca06e2e..0000000 --- a/mobile_design/src/utils/validators.ts +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Nivesh — Indian Financial Validators - * PAN, Aadhaar, IFSC, UPI ID, Mobile Number validation - */ - -/** Validate Indian PAN number (e.g., ABCDE1234F) */ -export function isValidPAN(pan: string): boolean { - return /^[A-Z]{5}[0-9]{4}[A-Z]$/.test(pan.toUpperCase()); -} - -/** Validate Aadhaar number (12 digits, basic Verhoeff check omitted for speed) */ -export function isValidAadhaar(aadhaar: string): boolean { - const cleaned = aadhaar.replace(/\s/g, ''); - return /^[2-9]\d{11}$/.test(cleaned); -} - -/** Validate IFSC code (e.g., SBIN0001234) */ -export function isValidIFSC(ifsc: string): boolean { - return /^[A-Z]{4}0[A-Z0-9]{6}$/.test(ifsc.toUpperCase()); -} - -/** Validate UPI ID (e.g., user@upi, number@paytm) */ -export function isValidUPI(upi: string): boolean { - return /^[\w.\-]+@[\w]+$/.test(upi); -} - -/** Validate Indian mobile number (10 digits starting with 6-9) */ -export function isValidMobile(mobile: string): boolean { - const cleaned = mobile.replace(/[\s\-+]/g, ''); - // With country code - if (cleaned.startsWith('91') && cleaned.length === 12) { - return /^91[6-9]\d{9}$/.test(cleaned); - } - // Without country code - return /^[6-9]\d{9}$/.test(cleaned); -} - -/** Validate Indian bank account number (9-18 digits) */ -export function isValidAccountNumber(account: string): boolean { - const cleaned = account.replace(/\s/g, ''); - return /^\d{9,18}$/.test(cleaned); -} - -/** Format PAN for display (ABCDE1234F → ABCDE****F for masking) */ -export function maskPAN(pan: string): string { - if (pan.length !== 10) return pan; - return `${pan.slice(0, 5)}****${pan.slice(9)}`; -} - -/** Format Aadhaar for display (1234 5678 9012 → XXXX XXXX 9012) */ -export function maskAadhaar(aadhaar: string): string { - const cleaned = aadhaar.replace(/\s/g, ''); - if (cleaned.length !== 12) return aadhaar; - return `XXXX XXXX ${cleaned.slice(8)}`; -} - -/** Format mobile for display (9876543210 → ****3210) */ -export function maskMobile(mobile: string): string { - if (mobile.length < 4) return mobile; - return `****${mobile.slice(-4)}`; -}