How noblepay/web-app works
1. Repository shape
This repo is split into two main areas: a documentation-heavy noblepay-docs folder that describes the target system, and the actual application code under shadcn-ui. The runtime architecture is centered on a React frontend plus a Node/Express backend.
2. Frontend application boundary
The main user-facing app is a Vite + React + TypeScript single-page application in shadcn-ui/src. It uses shadcn/ui component primitives, Tailwind styling, and page-level screens for Index, Login, AuthCallback, BillPayment, MobileRecharge, and Remittance.
3. Feature-oriented UI structure
The UI is organized by business capability rather than by technical layer. There are dedicated component groups for bill payment, mobile recharge, and remittance, alongside top-level marketing/navigation sections like Hero, Header, Footer, and feature overview sections such as PaymentsSection and MarketplaceSection.
4. Client-side auth and route protection
Authentication is handled on the frontend through Supabase client/auth wrappers and a ProtectedRoute component. The UI has a clear auth boundary: unauthenticated users go through login and callback flow, while protected business views depend on an established session.
5. Backend API layer
The backend is an Express-based API in shadcn-ui/backend/src with route modules for auth, accounts, bills, countries, marketplace, mobileMoney, payments, remittance, transactions, and users. This is the main server-side boundary that the frontend calls for business operations.
6. Server-side security boundary
The backend includes an auth middleware, which suggests route-level access control and token/session validation. That makes the API the enforcement point for protected operations, separate from the frontend’s visual route gating.
7. Persistence and data model
Data storage is handled through Prisma with a SQLite database (prisma/noblepay.db) and migration history in prisma/migrations. The schema.prisma file is the canonical model definition for accounts, transactions, and related domain entities.
8. Domain flow by business capability
The main functional flows map directly to the API and UI modules: payments/bills, mobile money recharge, remittance, and general account/transaction management. Supporting modules like countries and marketplace likely provide reference data and partner/service catalogs used by those flows.
9. Integration and state management
Frontend-side integration lives in lib/api-client.ts, lib/supabase.ts, and lib/supabase-hooks.ts, which act as the bridge between React views and backend/auth services. This is where request/response handling and session-aware data access are centralized.
10. Infrastructure and supporting artifacts
The repo includes CI via .github/workflows/npm-grunt.yml, static assets under public, and a uploads directory containing a strategic-plan PDF. These are supporting pieces; they do not define the core runtime architecture.
11. Important duplication note
There are duplicated nested copies of backend and Supabase-related files under shadcn-ui/shadcn-ui/backend and shadcn-ui/backend/backend. For diagramming, treat the architecture as one frontend app plus one main Express/Prisma backend, with the nested copies appearing to be mirrored or generated artifacts rather than separate product subsystems.
12. Best diagram boundaries
A clear architecture diagram should show: user/browser → React SPA → Supabase auth/session layer and/or Express API → Prisma/SQLite persistence. Around that core, the major domain services are bill payment, mobile recharge, remittance, accounts, transactions, and reference-data lookups.
Main entry points: server.js API server · schema.prisma Prisma schema · main.tsx App shell · pages Screens
Components 18
Docs
Architecture and product documentation
- Docs set · System and product documentation in noblepay-docs
noblepay-docs
Frontend
React SPA and UI composition
- App shell · Frontend entrypoints and route composition
shadcn-ui/src/main.tsx - Screens · Top-level pages for index, login, auth callback, and business flows
shadcn-ui/src/pages - Feature UI · Hero, header/footer, payments, bills, mobile money, and remittance sections
shadcn-ui/src/components - Flow forms · Bill payment, recharge, and remittance forms and trackers
shadcn-ui/src/components/bill-payment - UI kit · Reusable UI primitives used across the app
shadcn-ui/src/components/ui
Backend
Express API and domain routes
- API server · Node/Express server entrypoint and middleware wiring
shadcn-ui/backend/server.js - API auth · Server-side access control and token/session validation
shadcn-ui/backend/src/middleware/auth.js - Account API · Accounts, users, and transactions endpoints
shadcn-ui/backend/src/routes/accounts.js - Payment API · Bills, payments, and mobile money endpoints
shadcn-ui/backend/src/routes/payments.js - Reference API · Countries and marketplace reference endpoints
shadcn-ui/backend/src/routes/countries.js - Remittance API · Remittance-specific endpoints
shadcn-ui/backend/src/routes/remittance.js
Data
Prisma schema, migrations, and SQLite storage
- Prisma schema · Canonical domain model for accounts, transactions, and related entities
shadcn-ui/backend/prisma/schema.prisma - Migrations · Database migration history
shadcn-ui/backend/prisma/migrations - SQLite DB · Local persistent datastore
shadcn-ui/backend/prisma/noblepay.db
Support
Shared auth and integration layers
- Auth UI · Protected route and Supabase auth provider for client-side gating
shadcn-ui/src/components/auth - API client · Typed client bridge to backend services
shadcn-ui/lib/api-client.ts - Supabase client · Supabase helpers and hooks used by the SPA
shadcn-ui/src/lib/supabase.ts
Connections 24
- Docs set → App shell: describes · Documentation defines the intended application structure
- Docs set → API server: describes · Documentation also covers backend and deployment architecture
- App shell → Screens: routes to · App shell renders page-level screens
- App shell → Feature UI: composes · Main app assembles marketing and business sections
- App shell → Auth UI: wraps · Client session gating surrounds protected views
- Screens → Flow forms: uses · Business pages embed transaction-specific forms and trackers
- Screens → Auth UI: guards · Login and callback flow feed protected routes
- Feature UI → UI kit: builds on · Sections are implemented with shared UI primitives
- Flow forms → UI kit: builds on · Forms and panels use shared shadcn components
- Auth UI → Supabase client: authenticates with · Auth provider and protected routes use Supabase session helpers
- API client → API server: calls · Frontend API client sends requests to the backend
- API client → Supabase client: shares session · Client requests are session-aware through Supabase helpers
- API server → API auth: enforces · Express server applies auth middleware to protected operations
- API server → Account API: mounts · Server exposes account and transaction routes
- API server → Payment API: mounts · Server exposes payment and bill-payment routes
- API server → Reference API: mounts · Server exposes lookup and marketplace routes
- API server → Remittance API: mounts · Server exposes remittance routes
- Account API → Prisma schema: reads/writes · Account and transaction routes persist through Prisma models
- Payment API → Prisma schema: reads/writes · Payment workflows are backed by the domain schema
- Remittance API → Prisma schema: reads/writes · Remittance workflows persist through the schema
- Reference API → Prisma schema: reads · Reference-data endpoints derive from stored models
- Prisma schema → Migrations: evolves via · Schema changes are tracked by migrations
- Prisma schema → SQLite DB: persists to · Prisma schema maps onto the SQLite database
- Migrations → SQLite DB: applies to · Migration history shapes the database file