Skip to main content

Architecture & Tech stack

Tech stack

LayerTechnology
FrameworkReact 18 + TypeScript 4.9
BuildCreate React App 5 + CRACO 7
Routingreact-router-dom v6
StylingTailwind CSS 3 + CSS variables
HTTPAxios 1.3
Formsreact-hook-form 7
Toastreact-hot-toast
Iconslucide-react
CAPTCHA@marsidev/react-turnstile
QR / Phoneqrcode, react-phone-number-input
Monorepo@kioskgaming/ui, @kioskgaming/page-loading
PWAService worker (no Capacitor)

Directory structure

kioskgaming_superagent/
├── src/
│ ├── index.tsx
│ ├── App.tsx
│ ├── config/env.ts
│ ├── constants/index.ts
│ ├── types/index.ts
│ ├── services/api.ts
│ ├── hooks/ # useAuth, ledger, zerox methods
│ ├── pages/
│ ├── components/
│ │ ├── auth/
│ │ ├── layout/ # AppLayout
│ │ ├── credits/ # Buy/distribute/withdraw credits
│ │ ├── dashboard/ # HierarchyMiniTree
│ │ ├── finance/
│ │ └── shops/
│ └── utils/
├── public/ # SPA fallback, manifest, sw.js
├── craco.config.js
├── vercel.json
└── package.json

State management

PatternLocationPurpose
React Contexthooks/useAuth.tsxAuth state
Local useStatePages/componentsUI state
Custom hooksuseAgentTransactions, useSuperAgentOnlineBalanceLedgerData fetching
localStorageagent_auth_token, agent_user_dataPersist auth
Custom Eventsagent-auth-token-changed, auth:unauthorizedCross-component sync
note

Storage keys use prefix agent_ (legacy naming) even though this is the Super Agent portal.


Environment variables

VariableDefaultDescription
REACT_APP_API_BASE_URLhttp://localhost:3001/apiBackend API
REACT_APP_TURNSTILE_ENABLEDfalseCloudflare Turnstile
REACT_APP_TURNSTILE_SITE_KEY''Site key
REACT_APP_APP_NAMEKiosk Gaming — AgentApp name
PORT3003Dev server port

Backend requires AGENT_FRONTEND_URL (or equivalent super agent URL) for payment return /payment/return.


Deploy

FilePlatform
vercel.jsonVercel SPA rewrite
public/_redirectsNetlify / Cloudflare Pages
public/.htaccessApache
public/web.configIIS

No Capacitor — pure web SPA/PWA.


Overview diagram

flowchart TB
subgraph Client["kioskgaming_superagent"]
App[App.tsx] --> Auth[AuthProvider]
Auth --> Router[React Router]
Router --> Protected[ProtectedRoute + Pages]
Protected --> Layout[AppLayout]
Layout --> API[services/api.ts]
end

subgraph Backend["kioskgaming_backend"]
API -->|Bearer token| SA["/super-agent/*"]
API --> AuthAPI["/super-agent-auth/*"]
end