How anmolsukki/rex-crm works
Project Type & Purpose
– This is a front-end React single-page application (SPA) focused on Role Management. It doesn’t include its own backend code; instead it consumes external RESTful APIs for authentication and data (departments, HR candidacy, performance, sales, time logs, user profiles).
– State management is handled via Redux. Styling and assets live under public and src/assets. Routing and private-route guards enforce role-based access.
Main Components
A. Browser / Client
• Hosts the compiled bundle and service worker (PWA).
B. Presentation Layer (React)
• src/App.js, src/views/, src/UserRoles/, src/containers/**
• nav.js, userRoutes.js, routes.js define routing and role-based routes.
C. State Management (Redux)
• Actions: src/Redux/Actions/** (CalculationAction, LoginAction, etc.)
• Reducers: src/Redux/Reducers/**
• Store: src/Redux/Store/store.js
• ActionConstants & ActionTypes hold constants/enums.
D. API Layer
• src/Config/APIurl/connection.js defines base URLs and axios/fetch wrappers.
• AuthHeader.js injects JWT or tokens into every request.
E. Static Assets & Themes
• public/themes (CSS, JS, fonts, images)
• src/assets (CSS modules, SCSS, images)
F. Service Worker
• src/serviceWorker.js for PWA offline caching.
Component Relationships & Data Flow
– User interacts with React components → dispatches Redux Action
– Action creator calls API via connection.js, attaching AuthHeader
– External REST API responds → action dispatches SUCCESS/FAILURE
– Reducers update Redux Store → connected React components re-render
– Service worker caches assets/responses for offline use
Key Architectural Patterns
– Flux/Redux for unidirectional data flow
– Container/Presentational split (DefaultLayout container vs. view components)
– Role-based routing (PrivateRoute, userRoutes.js)
– Theming via static assets under public/themes
– Progressive Web App (service worker integration)