How muntasir-wsx/lifeshield-client works
1. Repository shape
- This is a React/Vite single-page frontend for the Life Shield insurance platform.
- The repo is organized around role-specific screens and route guards, not around backend services. The actual API/business logic is expected to live in external endpoints consumed by this client.
2. Bootstrap and runtime
- src/main.jsx and src/App.jsx are the entry points that mount the app.
- Global styling comes from src/index.css and src/App.css, with UI behavior driven by React plus the styling stack described in the README: Tailwind CSS, DaisyUI, and Framer Motion.
3. Top-level routing architecture
- src/Router/Router.jsx is the central route map.
- src/Routes/PrivateRoutes.jsx, AdminRoutes.jsx, and AgentRoutes.jsx act as access-control boundaries around protected sections.
- The route structure splits cleanly into public marketing pages, auth pages, and dashboard pages for different roles.
4. Layout boundaries
- src/Layouts/MainLayouts.jsx is the shell for the public-facing site.
- src/Layouts/DashboardLayout.jsx is the shell for authenticated dashboard flows.
- Shared chrome is factored into src/SharedComponents/Navbar, Footer, LifeShieldLogo, and Loading, which keeps page components focused on content and workflows.
5. Authentication and identity
- src/Context/AuthProvider.jsx and src/Context/AuthContext.jsx hold the app-wide auth state.
- src/Hooks/useAuth.jsx exposes auth state to pages, while src/Firebase/Firebase.init.js contains client-side Firebase setup.
- This suggests Firebase is used for frontend auth/session integration, while the app’s role model is enforced through the app’s route guards and role hooks.
6. Role-based access model
- src/Hooks/useRole.jsx is the key abstraction for determining whether the current user is a Customer, Agent, or Admin.
- The dashboard is partitioned accordingly:
- Customer: policies, claims, payments
- Agent: assigned customers, blog publishing, policy clearance
- Admin: policy moderation, user management, applications, transactions, blogs
- This is the primary architectural boundary in the app.
7. API/data access layer
- src/Hooks/UseAxiosPublic.jsx and src/Hooks/UseAxiosSecure.jsx centralize HTTP access.
- The “secure” client likely carries auth credentials or tokens, while the “public” client is for unauthenticated reads.
- This separation is important because most pages are thin UI shells over backend resources such as policies, users, blogs, payments, claims, and transactions.
8. Public marketing and discovery flow
- The public site includes Home, AboutUs, AllPolicies, Blogs, and QuotePage.
- Home is composed from modular sections like Banner, PopularPolicies, Agents, Testimonials, Articles, Newsletter, indicating a marketing-oriented landing page built from reusable content blocks.
- AllPoliciesDetails.jsx and ArticleDetails.jsx represent drill-down detail views from list pages.
9. Customer workflow
- Customer-facing pages cover the core lifecycle: browse policy → request/quote → pay → view payment status → manage active policies → submit claim request.
- Key screens are under src/Pages/Customer/..., including MyPolicies, PaymentPage, PaymentStatus, and ClaimRequest.
- The payment flow includes CheckoutForm.jsx, and the README confirms Stripe is the external payment gateway.
10. Agent workflow
- Agent pages support back-office content and customer operations: AssignedCustomers, MyBlogs, and PolicyClearance.
- This indicates agents can both manage content and process operational insurance tasks for customers assigned to them.
- The agent dashboard is a distinct workspace rather than just a filtered version of the admin panel.
11. Admin control center
- Admin pages are concentrated under src/Pages/Admin/...: ManageUsers, ManagePolicies, ManageApplications, Transactions, and AllBlogs.
- This is the platform’s governance layer: approve/reject/delete content, promote roles, and monitor financial activity.
- The README’s RBAC description aligns with this structure: admin actions are broad and supervisory, not customer-facing.
12. Cross-cutting UI and content concerns
- Shared UI components are separated from page logic, and the codebase uses many small page components (Card, Details, Form) rather than monoliths.
- react-helmet-async is listed in the README, so pages likely manage document metadata per route.
- Notification and feedback flows are probably handled with SweetAlert2 and React Hot Toast, which are relevant because many dashboard actions are stateful and asynchronous.
13. External/infrastructure boundaries
- firebase.json, .firebaserc, and the .firebase directory show the app is configured for Firebase Hosting deployment.
- The frontend also depends on outside services for authentication, payments, and image hosting (per README: Firebase, Stripe, Cloudinary/ImgBB).
- No backend source is present here, so the architecture diagram should show this repo as the client-side presentation and orchestration layer connecting to those external services and to a separate API backend.
Main entry points: Router.jsx Router · UseAxiosSecure.jsx Secure API · DashboardLayout.jsx Dashboard layout · App.jsx App
Components 34
Bootstrap
App entry and global styling
Routing
Route map and access boundaries
- Router · Central route configuration
src/Router/Router.jsx - Private · Authenticated access boundary
src/Routes/PrivateRoutes.jsx - Admin guard · Admin-only access boundary
src/Routes/AdminRoutes.jsx - Agent guard · Agent-only access boundary
src/Routes/AgentRoutes.jsx
Identity
Auth state, role checks, and API clients
- Auth provider · App-wide auth state
src/Context/AuthProvider.jsx - Auth context · Auth context object
src/Context/AuthContext.jsx - useAuth · Auth state consumer hook
src/Hooks/useAuth.jsx - useRole · Role resolution for customer, agent, admin
src/Hooks/useRole.jsx - Public API · Unauthenticated API access
src/Hooks/UseAxiosPublic.jsx - Secure API · Authenticated API access
src/Hooks/UseAxiosSecure.jsx
Public site
Marketing and discovery pages
- Home · Marketing landing page
src/Pages/Home/Home.jsx - Policies · Public policy browsing
src/Pages/AllPolicies/AllPolicies.jsx - Policy details · Policy drill-down view
src/Pages/AllPolicies/AllPoliciesDetails.jsx - Blogs · Public blog listing
src/Pages/Blogs/Blogs.jsx - Article details · Blog/article drill-down view
src/Pages/Home/Article/ArticleDetails.jsx - Quote · Quote and application entry
src/Pages/QuotePage/QuotePage.jsx
Customer
Customer dashboard workflows
- My policies · Customer policy management
src/Pages/Customer/MyPolicies/MyPolicies.jsx - Payment · Customer payment flow
src/Pages/Customer/PaymentPage/PaymentPage.jsx - Checkout · Stripe checkout form
src/Pages/Customer/PaymentPage/CheckoutForm.jsx - Payment status · Payment and invoice status
src/Pages/Customer/PaymentStatus/PaymentStatus.jsx - Invoice · Invoice view
src/Pages/Customer/PaymentStatus/Invoice.jsx - Claim request · Customer claim submission
src/Pages/Customer/ClaimRequest/ClaimRequest.jsx
Agent
Agent workspace
- Assigned customers · Agent customer assignments
src/Pages/Agent/Assigned Customers/AssignedCustomers.jsx - My blogs · Agent-authored content management
src/Pages/Agent/My Blogs/MyBlogs.jsx - Policy clearance · Agent policy processing
src/Pages/Agent/Policy Clearance/PolicyClearance.jsx
Shared UI
Reusable chrome and utilities
- Main layout · Public-facing page shell
src/Layouts/MainLayouts.jsx - Dashboard layout · Authenticated workspace shell
src/Layouts/DashboardLayout.jsx - Navbar · Top navigation
src/SharedComponents/Navbar/Navbar.jsx - Footer · Site footer
src/SharedComponents/Footer/Footer.jsx - Logo · Brand mark component
src/SharedComponents/LifeShieldLogo/LifeShieldLogo.jsx - Loading · Loading indicator
src/SharedComponents/Loading/Loading.jsx
External services
Hosting and third-party platform dependencies
- Firebase init · Client Firebase setup
src/Firebase/Firebase.init.js
Connections 47
- main → App: mounts · Bootstraps the React app
- App → Router: uses · Delegates page selection to the route map
- App → Auth provider: wraps · Provides auth state to the tree
- Auth provider → Auth context: publishes · Exposes shared auth context
- useAuth → Auth context: consumes · Reads current auth state
- useRole → useAuth: builds on · Derives role from auth identity
- Auth provider → Firebase init: integrates · Uses Firebase client setup
- Router → Private: protects · Wraps authenticated sections
- Router → Admin guard: restricts · Applies admin-only access
- Router → Agent guard: restricts · Applies agent-only access
- Router → Main layout: renders · Public shell for marketing routes
- Router → Dashboard layout: renders · Authenticated dashboard shell
- Main layout → Navbar: includes · Shared public chrome
- Main layout → Footer: includes · Shared public chrome
- Dashboard layout → Navbar: includes · Shared workspace chrome
- Dashboard layout → Loading: uses · Loading state feedback
- Navbar → Logo: shows · Brand identity
- Router → Home: routes to · Landing experience
- Router → Policies: routes to · Public policy catalog
- Router → Policy details: routes to · Policy detail view
- Router → Blogs: routes to · Public content list
- Router → Article details: routes to · Article detail view
- Router → Quote: routes to · Quote application entry
- Router → My policies: routes to · Customer policy workspace
- Router → Payment: routes to · Customer checkout flow
- Payment → Checkout: contains · Payment form step
- Router → Payment status: routes to · Payment status view
- Payment status → Invoice: contains · Invoice rendering
- Router → Claim request: routes to · Customer claim submission
- Router → Assigned customers: routes to · Agent customer operations
- Router → My blogs: routes to · Agent content workspace
- Router → Policy clearance: routes to · Agent policy processing
- Private → useAuth: checks · Requires signed-in user
- Admin guard → useRole: checks · Requires admin role
- Agent guard → useRole: checks · Requires agent role
- Home → Public API: reads · Fetches public content
- Policies → Public API: reads · Loads policy catalog
- Blogs → Public API: reads · Loads blog content
- Quote → Secure API: submits · Authenticated application data
- My policies → Secure API: reads · Loads customer records
- Payment → Secure API: submits · Creates payment intent or order
- Claim request → Secure API: submits · Creates claim request
- Assigned customers → Secure API: reads · Loads assigned customer data
- My blogs → Secure API: writes · Publishes agent content
- Policy clearance → Secure API: updates · Processes policy actions
- Admin guard → Dashboard layout: hosts · Admin workspace routes
- Agent guard → Dashboard layout: hosts · Agent workspace routes