Modules / los-webv1

los-webv1 TECH

The borrower-facing loan-application SPA — a white-labelled, multi-brand onboarding & repayment funnel used directly by loan applicants and their guarantors.

Ground truth as of 2026-09-30 · package name quapay-webv1 · PM2 app name qualoan-webv1 · ~1,193 commits to src/ since the last doc refresh (2026-04-07)
How to read this page This document was rebuilt directly from the current codebase (router.tsx, Redux slices, service layer, git history) rather than from older internal notes. Where the previous documentation conflicted with the code, the code won — the biggest conflict is called out immediately below.
Correction to the old docs los-webv1 is the borrower-facing app, not a staff console. The legacy site's page list for this repo (leads, CAM, sanctions, collections, credit-exec, loan-ops, admin, reports, global search…) does not exist anywhere in this codebase — it actually describes the sibling repo los-partner, which is the internal staff/DSA CRM. los-webv1 has no dashboard and no staff role model; it is a phone-OTP-gated, white-labelled loan-application funnel that borrowers and guarantors use on their own devices. This page and its Product & flows companion document what the repo actually is.

01 Stack & architecture

A single React SPA, statically built and served behind nginx, talking to the web auth surface of los-backend plus a handful of KYC and payment vendors directly from the browser.

Framework
React 19 + Vite 6
@vitejs/plugin-react-swc, TypeScript 5.7
Styling
Tailwind CSS 4
@tailwindcss/vite + Headless UI + custom src/common/ui primitives
Routing
react-router-dom v7
useRoutes, code-split via React.lazy + Suspense
State
Redux Toolkit
No RTK-Query — plain axios calls in src/services/api/*, pushed into slices manually
Forms
No form library
Controlled components + custom per-step hooks (useSignup, useGrievanceForm)
Animation / UI
Framer Motion, react-icons
+ dayjs, string-similarity for fuzzy bank/lender search
KYC vendors
AWS Amplify Liveness, Digilocker
Face liveness (ui-react-liveness) + Digilocker via Digitap v2 / Signzy, plus react-webcam and FingerprintJS device fingerprinting
Payments
Cashfree, Razorpay
@cashfreepayments/pg-react SDK; Razorpay is redirect/status-callback only (no SDK dep). PaymentMethodEnum also lists PAYTRING, MANUAL
Bot/fraud defense
Cloudflare Turnstile
@marsidev/react-turnstile gates OTP login and complaint forms
Dead dependency Clerk is listed as a dependency but is unused in code — a leftover from an earlier/abandoned auth approach, not part of the live login flow.
High-level architecture
graph TB subgraph Client BROWSER["Borrower / guarantor browser
(brand hostname)"] end subgraph los-webv1 [los-webv1 — React SPA] ROUTER["router.tsx
ProtectedRoutes / BorrowerOnlyRoutes"] REDUX["Redux Toolkit store
user, workflow, employment, bankAccount,
documents, aaConsentRequests, geoLocation"] AXIOS["services/axios.ts
401 refresh-and-retry interceptor
apiV1 / apiV2 / apiV3"] WORKFLOW["features/workflow
~13 onboarding sub-features"] THEME["theamProvider
runtime brand theme"] end BACKEND["los-backend
app/web/** (AuthType: web)"] KYC["KYC vendors
AWS Amplify Liveness · Digitap · Signzy"] PAY["Payment vendors
Cashfree · Razorpay"] TURN["Cloudflare Turnstile"] BROWSER --> ROUTER ROUTER --> REDUX ROUTER --> WORKFLOW WORKFLOW --> REDUX REDUX --> AXIOS THEME --> ROUTER AXIOS -- "domain header = hostname
(brand resolution)" --> BACKEND WORKFLOW --> KYC WORKFLOW --> PAY ROUTER --> TURN

02 Module / folder map

src/ top-level directories and what lives in each.

DirectoryPurpose
src/pages/*Thin route wrappers (autoLogin, cashfee, contactUs, grievanceComplaint, loans/loanRequest, phoneVerification, profile/specificProfile, referral, rejected, repaynow, review, whistleblowerComplaint) — mostly just wrap a features/* component in MainLayout.
src/features/workflowThe core multi-step onboarding wizard — by far the largest feature. ~13 sub-features: aadhaarKYC, alternateNumbers, bankAccount, documents, employmentInfo, existingLoans, geo-location, guarantors, income-proof (bank-statement upload + Account Aggregator consent), pan-kyc-details, photoAndVideo (liveness), underwriting-evaluation, plus brand-template variant folders common/v8|v16|v19|v24|v29.
src/features/loan, loanApplicationThe /apply amount & tenure form (borrower-only).
src/features/loanRequestRe-loan / top-up request against an existing loan id.
src/features/profile, specificProfileProfile viewing + repay section.
src/features/review, rejectionSoft/hard-reject terminal screens.
src/features/paytering, cashfeePayment status-sync / Razorpay-status / Cashfree callback handling.
src/features/phoneVerification, emailVerification, alternatePhoneNumberOTP flows.
src/features/grievanceComplaint, whistleblowerComplaintTurnstile-gated compliance forms, open to anyone.
src/features/theamProviderRuntime brand ThemeProvider (directory name is a typo for "theme").
src/redux/slicesuser, userDetails, workflow, employment, bankAccount, documents, loanCredibility, aaConsentRequests, alternatePhoneNumbers, userGeoLocation, plus index (brand/app bootstrap — theme, logo, workflow step config, tracking).
src/services/api/*.tsOne file per backend resource: auth, workflow, kyc, employment, document, other-documents, user-bank-account, user-details, user-devices, guarantors, underwriting, aa, digilocker, consolidation-lines, loans, payment, referral, common, alternate-numbers, web, plus grievance.service.ts / whistleblower.service.ts.
src/services/axios.tsBase axios client + apiV2/apiV3 versioned clients, shared 401-refresh interceptor.
src/common/ui, dialog, Security, GeolocationPromptShared UI primitives, modal/dialog system, device/session integrity component, geolocation-permission prompt.
src/hooksuseDevice (device registration), useAwsSignedUrl, useBrandMeta, useAccountLabel, useQueryParams, handelLogout, useV6CardAutoscroll.
src/configbrand-ui.config.ts, brand-version.config.ts (the StepCode → t1…t30 UI-template resolver), support-faq.config.ts.
src/constant/enum.tsUserRoleEnum (used) + vestigial PartnerUserRoleEnum (unused, see §05).
Stray scaffold folder A top-level ./features/loan/ui directory exists outside src/ — only two levels deep and not referenced anywhere in router.tsx. It appears to be a leftover or work-in-progress scaffold, not part of the live app. Safe to ignore when navigating the codebase, but worth cleaning up.

03 Full route inventory

From src/router.tsx. There is no leads/CAM/collections/reports/admin/global-search surface anywhere in this app — see the correction callout above.

Public / unauthenticated

RoutePurpose
/HomeRedirect — token present → /loan-application, else → /phone-verification
/phone-verificationOTP login/signup, Turnstile-gated
/repay-nowPublic repayment entry (also duplicated as an always-open route outside the public group)
/auto-loginMachine/deep-link auto-login
/r/:codeReferral landing page
/contact-usContact form
/grievance_redressal_complaintGrievance complaint form, Turnstile-gated
/complaintWhistleblower complaint form, Turnstile-gated
/digitap/digilocker/redirect/:brandId/:userId/:onboardingStepDigitap Digilocker KYC redirect callback (no auth gate, ID-scoped by URL params)
/signzy/digilocker/redirect/..., /signzy/digilocker/failed/...Signzy Digilocker redirect / failure callbacks
/signzy/cibil/successSignzy CIBIL callback
/payment/cashfree, /payment/status-sync, /payment/razorpay-statusPayment gateway redirect/status-reconciliation callbacks

Authenticated (ProtectedRoutes, requires Redux accessToken)

RoutePurpose
/loan-applicationThe step-wizard (WorkflowPage) — the main onboarding journey
/applyAmount & tenure submission → create-loan. BorrowerOnlyRoutes-gated (backend also 400s for guarantors)
/loan/:loanId/requestRe-loan/top-up request against a specific existing loan
/profile, /profile/:profileIdProfile viewing + repay section
/rejectedShown when loan status is HARD_REJECTED / BRE_REJECTED / DELETED, or user is_blocked
/reviewShown when loan status is SOFT_REJECTED (manual review pending)
* (catch-all)Redirect to /phone-verification

04 Auth flow & route protection

  • Login — phone-number OTP (/phone-verification), Turnstile-captcha-gated, via src/features/phoneVerification (useSignup hook). On success the backend issues an access token (+ refresh, cookie-based via withCredentials: true) stored in Redux (state.user.accessToken) — not directly read from localStorage by app logic, though the axios failure path does localStorage.clear().
  • 401 refresh-and-retry — src/services/axios.ts implements a single shared interceptor: queues concurrent failed requests while one refreshToken() call is in flight; on refresh failure it force-navigates to /phone-verification, clears localStorage, and calls logout(). Two versioned instances (apiV2, apiV3) share identical interceptor logic for endpoints versioned differently from the default v1.
  • Route protection — purely token-presence based (ProtectedRoutes/PublicRoutes in router.tsx), plus one narrow business-rule guard, BorrowerOnlyRoutes (checks selectIsGuarantor), which blocks guarantors from the create-loan /apply form. There is no broader permission/role matrix.
  • InternalPages bootstrap — the router root component does app bootstrap on mount: fetches the brand index config (theme/logo/workflow steps/tracking), fetches getUser() when a token exists and redirects to /rejected or /review based on loan status, and enforces a minimum web-version check (ensureLatestWebVersion) — a forced-reload-on-stale-build mechanism (see §07/UX quirks on the Product page).
  • Brand resolution — every axios request sends a domain header (window.location.host); the backend uses this to resolve which lender brand is making the request. Multi-tenant by hostname, not by path or subdomain convention alone.

05 Role/permission model

This is not an RBAC system. The only role distinction the app actually implements is borrower-vs-guarantor; everything else that looks like "permissions" is really a brand/template/status resolver.

  • UserRoleEnum { BORROWER = 93, GUARANTOR = 94 } — the only role enum consumed anywhere in src. Drives selectIsGuarantor and the BorrowerOnlyRoutes guard, which is the sole role-based branch in the entire app.
  • All other UI branching is driven by loan status (selectUserStatus: HARD_REJECTED/BRE_REJECTED/DELETED → /rejected; SOFT_REJECTED → /review) and by brand config (workflow_steps, web_template_version → which of ~30 UI templates render per onboarding step, per lender brand).
Dead code — vestigial staff-role enum src/constant/enum.ts also declares PartnerUserRoleEnum (SUPER_ADMIN, ADMIN, LOANS, LOAN_OPS, COLLECTIONS, SANCTION_MANAGER, SANCTION_HEAD, CREDIT_EXECUTIVE, COMPLETED_LOANS, REPORT, VIEW_DASHBOARD, …) — a copy-paste of the backend's staff-role enum that is declared and never referenced anywhere else in src. It implements nothing in this app; treat it as dead code left over from a shared type file, not evidence of staff functionality here.

06 Multi-brand white-label architecture

The single biggest architectural fact about this repo: one codebase serves roughly 15 lender brands at runtime, via a brand config fetched from the backend at bootstrap — not via separate builds or deploys per brand.

On app load, InternalPages fetches the brand index config keyed off the request hostname (the domain header). That config supplies the theme (colors, logo — CSS-variable tokens documented in docs/thems.md: primaryColor, secondaryColor, backgroundColor, surfaceColor, primaryTextColor, secondaryTextColor, successColor, warningColor, errorColor → mapped to Tailwind tokens like bg-primary, text-textPrimary), the ordered list of onboarding workflow_steps, and — per step — a web_template_version that selects which of up to ~30 alternate UI template implementations (t1…t30) renders that step. src/config/brand-version.config.ts is the StepCode → template resolver; several brand-variant folders exist directly under features/workflow/common/v8|v16|v19|v24|v29.

Toofan Loan
Active brand
Recent onboarding UI iteration in git history
Fins Panda
t16 template
"Revamped t16 UI for Fins Panda user journey"
MySalaryLoan
GTM tracking
Footer changes; GTM datalayer journey-event tracking added
Fastrupees
Callback field
Added collections-follow-up callback field, brand-specific
CredMyLoan
v8 template
Brand-specific variant under features/workflow/common/v8
What this means in practice A change requested as "fix the onboarding flow" is very often really "fix template t16 for Fins Panda" — most day-to-day frontend work in this repo is brand-specific UI variant work rather than a universal change to one canonical flow. Any diagram of "the" onboarding journey (see Product page §02) is really a diagram of a configurable flow whose concrete screens vary by brand.

07 Deployment & infrastructure

LayerDetail
Primary build/deployDockerfile.production — multi-stage node:20-alpine build → static dist/ served by nginx:stable-alpine, with a locked-down nginx.conf (X-Frame-Options SAMEORIGIN, HSTS, CSP allowing self + https).
Dev buildDockerfile.dev runs npm run dev in node:18-alpine.
Alternate deploy pathecosystem.config.cjs (PM2) runs npm run start → npx serve -l 5173 dist as app name qualoan-webv1 — a non-Docker deploy path that coexists with the Docker/nginx one.
Build resourcesBuild script bumps Node heap to 6GB (--max-old-space-size=6144) via tsc -b && vite build — a large/slow TS build, consistent with the many per-brand template folders.
ThemingBrand theme (colors/logo) is served from the backend brand-config endpoint and applied at runtime via ThemeProvider (src/features/theamProvider) — not hardcoded per deploy.

08 Recent activity since ~April 2026

~1,193 commits touching src/ since the last doc refresh (2026-04-07) — all thematically consistent with a borrower funnel under active per-brand iteration, not new staff features.

  • New/expanded lender brands and per-brand UI template work — Toofan Loan, Fins Panda (t16 revamp), MySalaryLoan, Fastrupees, CredMyLoan (v8) — plus GTM datalayer journey-event tracking added per brand.
  • PAN validation work culminating in a new template version (V29).
  • Pre-approved amount UI added to the loan-offer step.
  • Debt-consolidation / "Existing Loan" step improvements — lender-search debounce, fallback-continue if existing-loan lookup fails.
  • Guarantor/employment-details refinements — optional business-photo requirement, father's-name mandatory field, pincode-lookup-miss no longer treated as blocking.
  • Status-model refactor — moved from a numeric status_id to loan-based status tracking (selectUserStatus), a meaningful backend-contract shift reflected in the user slice.
  • Manual bank-transfer visibility now brand-config-driven rather than hardcoded.
  • Repay-now flow expanded — added a "repay now" section on the profile page; a collections-follow-up callback-time field added for specific brands.