Kantuta POS is organized around a feature-module pattern: each domain of the business (Cajas, Ventas, Inventario, Recargas, etc.) lives in its own self-contained directory underDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Eleazarguitar18/kantuta_pos_front/llms.txt
Use this file to discover all available pages before exploring further.
src/modules/, while cross-cutting concerns like auth state, caja session state, theming, and routing live outside the modules in dedicated src/context/ and src/router/ directories. All state management uses React Context API — there is no Redux or Zustand in this codebase.
Directory Tree
Layer-by-Layer Breakdown
src/components — Shared UI
src/components — Shared UI
src/modules — Feature Modules
src/modules — Feature Modules
Each business domain gets its own subdirectory. The typical module layout is:The
Inventario module nests three sub-modules (Categorias, Compras, Productos), each following the same four-folder convention. The Recargas module adds a hooks/ folder for its own domain hooks and an api/ folder for its API wiring.src/context — Global State via Context API
src/context — Global State via Context API
Kantuta POS uses React Context for all shared state — no external state library is needed.
| Provider | Responsibility |
|---|---|
AuthContextProvider | JWT token, user object, login/logout, inactivity timer |
CajaProvider | Active cash-drawer session, open/close operations |
SocketProvider | Single socket.io-client instance for real-time events |
ThemeProvider | light / dark preference, persisted to localStorage |
SidebarProvider | Sidebar expanded/collapsed state, mobile drawer state |
AuthContextProvider is the outermost wrapper in App.tsx, followed by CajaProvider. SocketProvider, ThemeProvider, and SidebarProvider are mounted deeper in the component tree (inside AppLayout).src/hooks — Cross-Cutting Custom Hooks
src/hooks — Cross-Cutting Custom Hooks
Two hooks are shared across modules:
useRole reads from useAuth() and normalizes the role name to lowercase so that comparisons against "administrador" or "operador" are always case-insensitive.src/router — ProtectedRoute
src/router — ProtectedRoute
ProtectedRoute is a React Router v7 layout route used in two modes:- Auth guard only — placed at the root
<Route path="/">to redirect unauthenticated users to/signin. - Role guard — accepts an
allowedRolesprop (e.g.['Administrador']) and redirects users whose role doesn’t match back to/.
src/modules — Service Layer Pattern
src/modules — Service Layer Pattern
Every service file follows the same pattern: import The
axios and API_BASE_URL, define a local getHeaders() helper that reads the JWT from localStorage, then export a plain object of async functions.getHeaders() call is evaluated at the time each request fires, so it always picks up the most recent token value from storage.Provider Nesting in App.tsx
The provider order inApp.tsx is intentional: CajaProvider must be inside AuthContextProvider because it calls useAuth() to read the current user ID before querying the active session.
Auth Context
How JWT tokens are stored, validated, and cleaned up with the 45-minute inactivity timer.
Caja Context
How the active cash-drawer session is opened, closed, and persisted to localStorage.