The multi-tenant back-office CRM used by each lending brand's own staff — sales, credit, sanctioning, disbursement ops, collections and HR — across the full loan lifecycle.
los-partner is the internal staff back-office CRM — the app that the original Documentation site's Frontend and User Functions pages describe. Its name suggests an external partner portal, but "partner" here means each lending brand (QuaLoan, jhatpatcash, FastSalary, CredNidhi, MinutesLoan, PaisaPop, Salary4Sure, SalaryBaba, ShubLakshmi, ZeptoFinance, FastRupees) is a partner/tenant of the 8byte platform; the people using this app are that brand's own employees — sales, credit, sanction, disbursement ops, collections and HR staff. The genuinely external-facing app is the sibling repo los-webv1 (the borrower/customer app). The team's earlier assumption that a different repo (los-webv1) was the staff console was incorrect; los-webv1 is the borrower-facing app, and los-partner is the staff console.
partner auth surface.
A React SPA, one per brand at runtime (brand resolved by hostname), talking exclusively to los-backend's partner-scoped API surface.
@vitejs/plugin-react-swc@tailwindcss/vite, tailwind-merge, clsxuseRoutes, brand-scoped :brandId/... paths, one central route table in routes.tsxbrand, common, partnerUser, user, plus state.authshared/services/axios.ts, base /api/v1@svg-maps/india for the users-by-location dashboard cardThis SPA is served per-brand (identity resolved by hostname via getBrandInfo(domain)) and every authenticated route is scoped :brandId/.... Dev server runs on port 5174 — distinct from the unrelated LOS Customer App (the borrower-facing app, dev port 5200). Build is tsc -b && vite build with a 6GB heap allotted via NODE_OPTIONS, reflecting the size of the codebase (~45 feature directories, ~70 API service files).
src/ top-level directories, ~45 feature dirs paired 1:1 with most pages/ entries.
| Directory | Purpose |
|---|---|
App.tsx, routes.tsx | Root app shell and the single central route table (react-router v7 useRoutes). |
features/* | Business-logic modules: login, leads, customers, customerDetails, loans, loanCollection/collectionV2, loanCompleted, loanCreditExecutive, loanSanctionManager, loansOps, disbursedCases, awaitingLoanAgreement, mandateQueue, estampQueue, pdLink (personal-discussion link), fieldVisit, telephony, chatbot, callRequests, globalSearch, dashboard/dashboardV2/dashboardV3, msiReport, partnerUsers, admin, adminSettings, settings, coinWallet/coinAdmin/coinApprovals/coinLeaderboard, referralLink, payment, repeatLoans, lastLoanCompleted, lendbox, helpCenter, Reminders/failedReminders, bugcatch, profile. |
pages/* | Thin route-target wrappers around features/* — page-level composition, mirroring feature names 1:1. |
shared/services/api/* | ~70 files, one per backend domain: loan.api.ts, customer.api.ts, collection.api.ts, bre.api.ts, evaluation.api.ts/evaluationV2.api.ts, coins.api.ts, report.api.ts, partner-user.api.ts, global-search.api.ts, disbursement-batch.api.ts, plus settings/ (20+ files), external/, leads/ sub-folders. No react-query/SWR — components call these directly and manage their own loading state. |
shared/redux/ | Store + slices (brand.slice.ts, common.ts, partnerUser.slice.ts, user.ts) wired in store.ts/middleware.ts. |
shared/bre/ | BRE engine registry — single file, breEngines.ts. See §06. |
common/ | Shared presentational primitives: ui/ (buttons, tables, badges, PII-mask toggle, column-visibility dropdown, pagination), dialog/ (modal system), filter/, sidebar/. |
components/ProtectedRoute.tsx | Reusable component-level role/permission gate (allowedRoles, allowedPermissions props) — separate from the route-level guards in routes.tsx. |
layout/ (+ layout/sidebar/) | App shell chrome — top nav, side nav. |
context/ | roleContext.tsx, permissionContext.tsx (current effective role/permission), toastContext. |
constant/enum.ts | Huge central enum file — loan/charge/BRE/role/permission/status enums. |
lib/ | role.ts (isAdmin, isSuperAdmin, isOtherRoles, isValidRole), getCurrentRoleAndPermissions.ts, utils.ts (PII masking: maskPan, maskEmail, maskPhone). |
hooks/ | useDevice (device registration/fingerprint), useVersionGuard (forces refresh on stale build), useServerIdentity. |
templates/, styles/ | Per-brand theme/branding scaffolding, consistent with multi-tenant brand.slice.ts. |
From src/routes.tsx. Unauthenticated routes are top-level; everything else lives under ProtectedRoutes and, unless noted, is scoped :brandId/....
| Route | Notes |
|---|---|
pd/:token | Standalone personal-discussion link page, opened outside the authenticated shell. |
/login | Multi-step login, per-brand themed variant. |
/reset-password | Password reset via emailed token. |
/ | HomeRedirect — computes a role/permission-driven landing route (see Product page). |
:brandId/dashboard | Legacy — redirects to v1/v2/v3 per brand config. |
:brandId/dashboard-v1, -v2 (flag-gated via VITE_ENABLE_DASHBOARD_V2), -v3 | Dashboard version variants. |
:brandId/global-search | Cross-entity search — loan tasks, KYC, legal, stage details. |
:brandId/help-center, /blogs | Internal help content and blog management. |
:brandId/reports | Large permission-gated report catalog. |
:brandId/customers, /call-requests | Customer list and call-request queue. |
:brandId/leads | Gated by LeadsAccessRoute (ALL/LEADS/RELOCATE_LEAD permission), not the generic guard. |
:brandId/:fallbackpage/customers/:customerId, .../loan/:loanId | Customer/loan detail — the fallback-page param lets the detail view "return" to whichever list it was opened from. |
:brandId/repeat-loans, /last-loan-completed | Reloan-eligible customer surfacing. |
:brandId/credit-executive, /sanction-manager | Underwriting and final-sanction queues. |
:brandId/sales-queue, /credit-queue, /field-visits, /collection-field-visits | Field-visit workflows across sales, credit and collection. |
:brandId/esign-pending | Awaiting loan agreement (e-sign) queue. |
:brandId/estamp-queue | E-stamp processing queue. |
:brandId/mandate-queue | NACH/UPI Autopay mandate setup queue. |
:brandId/loans-ops/pending-disbursement, /payment-approval, /payment-rejected, /payment-approved, /no-due-pending | LOAN_OPS disbursement and payment-review queues. |
:brandId/disbursed-cases | Completed disbursements list. |
:brandId/collection/all, /pre-collection, /post-collection, /npa-collection, /legal-action-collection, /follow-up-calendar | Stage-segmented collection queues. :brandId/npa-collection redirects to collection/npa-collection. |
:brandId/completed, /completed/all, /completed/closed, /completed/settled, /completed/writeoff | Closed-loan buckets. |
:brandId/partner-users, /partner-users/create, /partner-users/:userId/edit | Org user management. |
:brandId/coin-wallet, /coin-leaderboard, /coin-approvals, /coin-admin | All additionally gated by CoinBetaRoute (private beta, server-decided access). |
:brandId/referral-link | Referral-link generation utility for staff. |
:brandId/reminders, /failed-reminders | Reminder management/failure queue. |
:brandId/settings, /settings/:settingId | Brand configuration (~20 sub-areas). |
admin (SUPER_ADMIN only) | Cross-brand admin — not brand-scoped. |
admin/settings (SUPER_ADMIN only) | Cross-brand platform settings. |
* | Redirect to /. |
Two independent guard layers, plus five distinct credential methods spread across eight visual login-page variants.
routes.tsx) — ProtectedRoutes checks state.auth.accessToken presence and redirects to /login if absent. Nested guard components (SuperAdminRoute, AdminOrPermissionRoute, DashboardVersionRoute, LeadsAccessRoute, CoinBetaRoute) further restrict by role/permission/brand-config before rendering a page.src/components/ProtectedRoute.tsx, a reusable wrapper (allowedRoles, allowedPermissions props) driven by useRole()/usePermission() contexts, for gating UI within a page rather than the whole route.Login (src/features/login/, auth.api.ts) supports five identifier + credential flows via useLoginController.ts/useSteppedLogin.ts, rendered by whichever of loginV1…loginV8 the brand's loginVersions.ts/loginTheme.ts selects — eight parallel visual implementations for the same underlying logic.
| Method | Mechanism |
|---|---|
| Password | POST /auth/partner/login with {identifier, password, deviceId}. |
| OTP | POST /auth/partner/send-login-otp → POST /auth/partner/verify-login-otp. |
| TOTP (authenticator app) | POST /auth/partner/totp-status → if unenrolled, verify-totp-setup (QR code) → verify-totp-login. |
| Sign-in code | POST /auth/partner/verify-sign-in-code with {code, deviceId} — see detail below. |
| Reset | send-reset-password-email → reset-password (token + new password); change-password while authenticated. |
XXXX-XXXX-XXXX, ~59 bits entropy), expiry chosen at issue time (15 min default / 1 hour / 24 hours), single-use and single-live-per-user (issuing a new one revokes the old), revocable by an admin, and explicitly blocked for ADMIN/SUPER_ADMIN accounts to prevent privilege-escalation via code sharing. Backend stores only a SHA-256 hash; plaintext is shown once. Documented in depth on los-backend's own docs — see los-backend §03.
sessionStorage.getItem("access_token"), injected as Authorization: Bearer <token> on every axios request via a request interceptor.sessionStorage and hard-redirects to /login.attendance:punch-in-required window event; an attendance context intercepts and blocks the UI until the user punches in (brand-configurable attendance gate).deviceId; useDevice() also calls postRegisterUserDevice() on every authenticated app load.getBrandInfo(domain) resolves brand config by hostname (dedup'd in-flight via a shared promise); the app is served per-brand subdomain, and theming/config loads before/around login. useServerIdentity() and useVersionGuard() run on every authenticated load.Two enums in src/constant/enum.ts: a coarse PartnerUserRoleEnum and a much larger, fine-grained PartnerUserPermissionEnum (~100 values).
| Enum | Contents |
|---|---|
PartnerUserRoleEnum | OTHER, SUPER_ADMIN (cross-brand platform admin, sees /admin), ADMIN (brand admin), LOAN_OPS, COLLECTION_EXECUTIVE, COLLECTION_MANAGER, COLLECTION_HEAD, SANCTION_MANAGER, SANCTION_HEAD, CREDIT_EXECUTIVE, SALES, SALES_MANAGER, SALES_HEAD, NPA_EXECUTIVE, HR, plus legacy/overlap values (BRAND_SETTINGS, CUSTOMER, VIEW_DASHBOARD, REPORT, PARTNER_USER_MANAGEMENT, LOANS). |
PartnerUserPermissionEnum | ~100 fine-grained values grouped by comment banner: SUPER_ADMIN (ALL), CUSTOMER (status-specific, e.g. CUSTOMER_PENDING, CUSTOMER_BRE_REJECTED), LEADS (LEADS, RELOCATE_LEAD), LOANS (LOAN_CREATE, LOAN_EVALUATION, LOAN_AGREEMENT, LOAN_FORCE_BYPASS, CAM_CALCULATOR), LOAN OPERATIONS, CREDIT/SANCTION, DISBURSEMENT (SEND_TO_DISBURSEMENT, DISBURSE_LOAN, BULK_DISBURSEMENT), PAYMENTS, COLLECTIONS (NPA_COLLECTION, LEGAL_ACTION_COLLECTION, FIELD_VISIT), ALLOCATION, PARTNER/USER MANAGEMENT, DASHBOARDS (V1/V2/V3 variants + VIEW_EXECUTIVE_TARGET_SNAPSHOT), a large REPORTS block (dozens of named permissions), BLOG_MANAGEMENT, MARKETPLACE_SSO, LENDBOX_WORKFLOW_SYNC, and internal API-access flags (DASHBOARD_V2_API, USER_WORKFLOW_API, LOANWALLE_API). |
The ALLOCATION permission group encodes three distinct capabilities per work type (fresh vs. repeat), not one: FRESH_ALLOCATION/REPEAT_ALLOCATION (can receive work), ALLOCATE_FRESH/ALLOCATE_REPEAT (can assign unowned work to someone), and REALLOCATE_FRESH/REALLOCATE_REPEAT (can move already-owned work). The same three-tier pattern repeats on the collection side (desk = SALES|COLLECTION).
role[] and permissions[] arrays live on state.auth.data (Redux). RoleProvider/PermissionProvider (src/context/) resolve a single effective role/permission via getCurrentRoleAndPermissions() for the component-level ProtectedRoute.isValidRole()/isAdmin()/isSuperAdmin()/isOtherRoles() (lib/role.ts) plus direct permissions.includes(...) checks — ALL is a super-permission that satisfies almost every check.role-group.api.ts/partner-permissions.api.ts and the :brandId/partner-users and :brandId/settings UI.PartnerUserRoleEnum contains several values (BRAND_SETTINGS, CUSTOMER, VIEW_DASHBOARD, REPORT, PARTNER_USER_MANAGEMENT, LOANS) that duplicate names in PartnerUserPermissionEnum — early role/permission conflation still left in the enum. When documenting or extending the permission model, don't assume role and permission are cleanly separated concepts here.
src/shared/bre/breEngines.ts defines a small registry of credit-eligibility engines — an internal underwriting tool for credit staff, not a customer-facing instant-approval widget.
// shared/bre/breEngines.ts — engine registry SMART_BRE // autoRun: true CRIF_BRE // autoRun: true NEETIX_BRE // autoRun: true MARKETING_ANALYSIS // autoRun: false
Each engine has an enabledKey checked per-brand (BreEngines type from bre-engine.api.ts) — a brand can turn individual engines on or off. bre.api.ts / bre-engine.api.ts / evaluation.api.ts / evaluationV2.api.ts together implement the credit team's underwriting workflow: fetch bureau reports (Equifax, CRIF ProV2/V1, TotalEkycCrif, TruLens CRIF, Digitap CRIF), initiate CIBIL consent via Signzy, and run/upsert an evaluation per loan — a checklist of items each markable ELIGIBLE/NOT_ELIGIBLE, with an override flag and comments for a human underwriter to override the automated verdict.
This is used by CREDIT_EXECUTIVE/SANCTION_MANAGER-permissioned staff on the customer/loan detail page during underwriting. Reports on BRE outcomes are surfaced via the CIC/BRE/AUDIT report permission group (SMART_BRE_REPORT, CIC_REPORT, TRANSUNION_REPORT, EQUIFAX_CIC_BETA_REPORT, CUSTOMER_AUDIT_REPORT).
| Layer | Detail |
|---|---|
| Docker | Dockerfile.production — multi-stage: node:20-alpine build stage (npm install --legacy-peer-deps, npm run build) → nginx:stable-alpine serving /dist via nginx.conf. Dockerfile.dev for dev container use. |
| nginx | SPA fallback (try_files ... /index.html), strict CSP, HSTS, and a CORS allow-origin hardcoded to https://console.acefone.in (telephony/IVR provider); form-action also whitelists *.acefone.in. |
| PM2 | ecosystem.config.js/.cjs — app name qualoan-partner, runs npm run start → npx serve -l 5174 dist (static file server, single instance, autorestart). |
| Dev server | Vite, port 5174, manual chunk-splitting configured for vendor-react/router/state/ui/charts. |
| Env config | src/shared/services/config.ts — VITE_APP_MODE=local switches to http://localhost:4002; otherwise VITE_NODE_URL is the backend base URL. VITE_ENABLE_DASHBOARD_V2 feature-flags dashboard v2. |
npx serve process (app name literally qualoan-partner — a single brand's name leaking into what's meant to be a multi-tenant app's own ops tooling) both exist in the repo. Worth confirming with the team which is actually current in production and retiring the other.
pr/ucic-report (feat(reports): add UCIC report to report list, src/features/msiReport/components/reportList.tsx) — a trivial 7-line addition of one new catalog entry. Confirms the generic async-report lifecycle (triggerAsyncReport/getAsyncReportStatus/listAsyncReportsForUser/getVisibleReportCatalog) is the right extension point for new report types, and that most "add a report" backend PRs need only a matching one-line frontend PR.feat(globalSearch): show loan tasks, KYC, legal and stage details — recently extended to surface loan tasks/KYC/legal/stage info in one search, beyond its original scope.callexConfigModal and related), alongside the pre-existing Acefone/Sphoro voice integration.