How disha-satpute/scholarhub works
Project type and purpose
• This is a full-stack web application (“ScholarHub”) for student scholarship discovery and management.
• The frontend is built in React.js, the backend in Node.js/Express, and it uses PostgreSQL for storage. Users can browse, filter, save, and apply for scholarships; admins can manage scholarships and users.
File structure
• Top-level split:
• backend/ – Node.js REST API
• frontend/ – React single-page application
• ScholarHub.sql – database schema
• backend/ substructure:
• config/ – database connection and environment settings
• middleware/ – JWT authentication handler
• models/ – ORM/entity definitions (Admin, User)
• routes/ – REST endpoints (auth, admin, scholarship, email)
• server.js – Express app bootstrap
• frontend/ substructure:
• public/ – static assets and index.html
• src/ – React source code, including components, pages, styles
• src/pages/ – React Router pages (Login, Register, Dashboard, etc.)
• src/components/ – UI pieces (Header, Footer, Navbar)
• Config files: package.json in both layers, plus .env instructions in README.
Key insights from README
• Uses JWT for authentication (stateless tokens).
• PostgreSQL CRM database holds Users, Admins, Scholarships.
• All client-server interaction is via HTTP/JSON REST endpoints.
• No microservices: single API server.
• Email routes indicate an external SMTP service integration.
a. Main components
1. User’s Browser (React SPA)
2. React Frontend (components + pages)
3. Express Backend (REST API)
4. PostgreSQL Database
5. External Email Service (SMTP or third-party)
b. Relationships & data flow
1. Browser ↔ Frontend: user clicks cause HTTP requests to the React app (served from public/index.html).
2. Frontend → Backend: REST API calls (fetch/axios) for auth, data retrieval, CRUD on scholarships.
3. Backend ↔ Database: ORM or query layer in config/db.js performs SQL operations on Users, Admins, Scholarships tables.
4. Backend → Email Service: email route invokes SMTP client to send notifications (password reset, confirmations).
c. Architectural patterns / design principles
• Client-Server: clear separation of UI and API.
• MVC-ish on backend: routes (controllers) → models (data) → config/db (data access).
• JWT-based stateless authentication via authMiddleware.
• React Router for page navigation and state management with React Hooks.
d. Technologies & frameworks
• Frontend: React.js, React Router, Bootstrap/CSS for styling.
• Backend: Node.js, Express.js, JWT, Sequelize or pg module (based on config/db.js).
• Database: PostgreSQL.
• External: SMTP/email library (e.g., nodemailer).
Detailed capture of essential elements
• Where authMiddleware intercepts and verifies JWTs.
• Database schema’s main tables (from ScholarHub.sql) as a mini ERD inset.