How perfectionist7/abb-online-bidding-system works
Project type and purpose
• This is a full‑stack online bidding (auction) system.
• Frontend: React + Vite single‑page application.
• Backend: Node.js + Express REST API.
• Database: MongoDB.
• Authentication: JWT for token‑based auth and bcrypt for password hashing.
File structure
• Top‑level split: /frontend and /backend.
• Backend
• index.js – entry point.
• routes/ – Express route handlers (auth.js, user.js).
• models/ – Mongoose schemas (user.js).
• db.js – MongoDB connection logic.
• .env – configuration (DB URI, JWT secret).
• Frontend
• src/pages – route‑level React pages (Home, Bidding, GetStarted, SignUpSuccess).
• src/components – reusable UI components (Buttons, Inputs, Product cards, Dropdowns, Portals).
• index.html + index.jsx – SPA bootstrapping.
• vite.config.mjs – build‑server configuration.
Key insights from the README
• REST API endpoints:
• POST /api/user -> register new user
• POST /api/auth -> login & return JWT
• Dev workflow: run backend server, run Vite dev server, frontend calls API.
• Tech stack: React, Vite, Express, Node, MongoDB, JWT, bcrypt.
a. Frontend Application
b. API Layer / Backend
• Express server (Node.js runtime).
• Controllers/Routes (auth.js, user.js).
• Business logic and middleware (JWT verification, password hashing).
c. Data Layer
• MongoDB cluster/instance.
• Mongoose ORM (models/user.js).
d. External Services
• Email or notification service (optional if in future).
• CDN or static file host for production build.
Relationships and data flows
1. User (browser) interacts with React UI.
2. UI issues HTTP requests (axios/fetch) to https://<backend-host>/api/....
3. Express routes parse requests, call controllers, validate JWT (if protected).
4. Controllers use Mongoose to query/update MongoDB.
5. Responses (JSON + JWT tokens on login) flow back to SPA.
6. React stores JWT (e.g., localStorage) and uses it for subsequent secured API calls.
Architectural patterns and design principles
• Frontend: Component‑based UI, client‑side routing.
• Backend: MVC‑inspired separation (Routes → Controllers/Services → Models).
• Stateless REST API with token‑based authentication (JWT).
• One‐way data flow on frontend: UI dispatches actions → API calls → state updates.
• Single database for all data (could evolve to microservices & polyglot DBs).
Technologies and frameworks
• React, Vite, JSX, CSS modules.
• Node.js, Express, dotenv, nodemon (dev).
• MongoDB (hosted or local), Mongoose.
• JWT for auth, bcrypt for password hashing.