How rautishz/rfp works
Project type and purpose
• This is a full-stack RFP (Request for Proposal) management web application.
• The provided repo contains the frontend (React + Vite); the backend API is external but required for full functionality (JWT-based authentication, RFP/Vendor endpoints).
File structure
• Top-level:
• public/, index.html
• src/ (all React code)
• vite.config.js, eslint.config.js
• src/ breakdown:
• assets/: static CSS, fonts, images, third-party libs
• components/: UI components, split into auth, layout, ui
• pages/: route-level views (Login, Dashboard, RFP, Vendors, etc.)
• services/: API service wrappers (api.js, authService, rfpService, vendorService), userState, utils
• constants/: environment and application constants
• App.jsx + main.jsx: SPA entrypoint, routing, root component
README for additional insights
• Technology stack: React 19, React Router, Bootstrap 5, Axios, React-Toastify, Vite
• Authentication: JWT stored in localStorage, user roles (Admin, Vendor)
• Workflow: Admin actions vs. Vendor actions
• External dependencies: backend REST API (base URL in services/api.js)
Main components
a. Frontend (Browser / React SPA)
• Entrypoint (main.jsx → App.jsx)
• Routing (React Router)
• Layout layer: Header, Sidebar, Footer (MainLayout)
• Auth layer: Login/Register pages, ProtectedRoute
• Pages: Dashboard, RFP list/detail, Vendor list, Quote submission
• UI components: Buttons, Tables, Modals, Forms
• State management: React Hooks + Context (userState)
• Service layer: Axios API client (api.js) + service wrappers (authService, rfpService, vendorService)
b. Backend REST API (external)
• Authentication endpoints (login, register, token refresh)
• Vendor endpoints (CRUD, approval)
• RFP endpoints (create, list, invite, close)
• Quote endpoints (submit, list, review)
• Uses JWT Bearer tokens for authorization
c. Database (external)
• Stores users (admin, vendor), RFP records, vendor registrations, quotes
d. External services / integrations
• React-Toastify (notifications)
• Bootstrap CSS
Relationships and interactions
• User (Admin or Vendor) interacts via Browser → React SPA
• SPA routes to pages → calls service layer → Axios issues HTTPS requests to Backend API
• API validates JWT → fetches/writes to Database → returns JSON
• SPA updates UI, dispatches notifications via React-Toastify
• Authentication flow: login → receive JWT → store in localStorage → attach to subsequent requests
• ProtectedRoute component inspects userState → restricts page access
Architectural patterns and principles
• Component-based UI (React)
• Container/presentation separation: pages vs. UI components
• Service layer abstraction over HTTP (api.js + service modules)
• Client-side routing and protected routes
• Token-based stateless authentication (JWT)
• Clear separation of concerns: assets vs. components vs. services vs. constants
1. User initiates action (e.g., “Create RFP” button)
2. Page component gathers form data
3. Calls rfpService.createRfp() → Axios.post(…api/rfps)
4. Backend Auth middleware validates JWT → Controller → Service → DB
5. Response propagates back → UI updates table → Toast notification