How jakirul458/gfst-frontend works
Project type and purpose
• This is a full-stack MERN (MongoDB, Express.js, React.js, Node.js) financial management SPA.
• Purpose: allow village users to sign up/in, manage savings, loans, investments, donations, expenditures, view dashboards, and receive email notifications.
File structure
• Top-level frontend:
• index.html, public/ → static assets
• src/ → React application
• vite.config.js → build tool config
• vercel.json → deployment config
• src/ splits into:
• src/pages/… → feature pages (auth, savings, loan, investment, society)
• src/components/… → shared UI (Navbar, Footer, Sidebar)
• src/Route/… → Routing logic & protected routes
• src/context/AuthContext.jsx → global auth state (Context API)
• src/api/index.js → wrapper for HTTP calls to the backend
• src/store/ & src/util/ → local utilities
• README describes backend dependencies (Express, Mongoose, Nodemailer) but backend code is hosted separately or in another repo.
README for additional insights
• Highlights RESTful APIs for account, transaction, loan, investment, donation, expenditure.
• Email notifications via Nodemailer.
• Uses Mongoose schemas to interact with MongoDB.
a. Main components:
• Client (React SPA)
• API Gateway / Web Server (Express.js)
• Business-Logic Layer (Express routes + controllers + services)
• Database (MongoDB)
• External Service (Email / SMTP via Nodemailer)
• Deployment Platform (Vercel for frontend, Node host or Vercel Functions for API)
b. Relationships & interactions:
1. User’s Browser loads React SPA from Vercel.
2. SPA uses React Router and AuthContext to manage client-side routing and auth state.
3. On actions (signin, CRUD on accounts, transactions), SPA calls Express REST endpoints via src/api/index.js.
4. Express controllers validate requests, use Mongoose to read/write MongoDB collections (users, savings, loans, investments, donations, expenditures).
5. For events (deposit, withdrawal, donation), Node triggers Nodemailer service to send email through SMTP.
6. Responses flow back to SPA, updates UI.
c. Architectural patterns & principles:
• Layered architecture:
– Presentation Layer (React components/pages)
– Application Layer (client-side routing, context)
– API Layer (Express routes/controllers/services)
– Data Layer (MongoDB + Mongoose)
• Separation of concerns: UI vs API vs data persistence vs external integration.
• ProtectedRoute enforces frontend auth; server also enforces auth (JWT/session).
d. Relevant technologies & libraries:
– Frontend: React.js + Vite, React Router, Context API, Axios/fetch
– Backend: Node.js, Express.js, Mongoose, Nodemailer
– DB: MongoDB Atlas (cloud) or local
– Deployment: Vercel (frontend), Heroku/AWS/Vercel Functions (backend)