How subrata-2002/fiverr-freelance works
1. This repository is a two-tier marketplace app, split into a Node/Express-style API under api/ and a React/Vite client under client/. The domain is clearly a Fiverr-like freelance platform: users publish gigs, buyers place orders, messages flow through conversations, and reviews are attached to completed work.
2. The backend is organized as a classic layered API boundary: routes define HTTP endpoints, controllers hold request handling logic, models define the persisted domain entities, and middleware/jwt.js enforces authenticated access where needed. utils/createError.js is the shared error-construction helper used across controllers.
3. The core backend domain model is centered on user, gig, order, review, conversation, and message. That tells you the system supports marketplace discovery, transactional ordering, post-delivery feedback, and a built-in inbox/messaging subsystem rather than just a catalog of listings.
4. The backend entrypoint is api/index.js, which likely wires the app together: route registration, middleware, and server startup. The route files map to the main resource groups: auth, users, gigs, orders, reviews, conversations, and messages. That separation is the primary API boundary an architecture diagram should show.
5. Authentication is a first-class subsystem. auth.route.js and auth.controller.js handle login/register-type flows, while middleware/jwt.js suggests token-based request protection for private resources such as order management, messaging, and profile-owned gig operations.
6. The client is a single-page React app built with Vite (client/vite.config.js, main.jsx, App.jsx). The UI is organized by route-level pages in src/pages and reusable visual components in src/components, with SCSS co-located beside each component/page for styling. This is a presentation layer sitting fully separate from the API.
7. The client pages reflect the marketplace workflow: home/discovery (Home, Gigs, Gig), account access (Login, Register), seller tools (Add, MyGigs), buyer workflows (Orders, Pay, Success), and communication (Messages, Message). Error is the fallback route. This gives the frontend a clear navigation and business-process structure.
8. There is a dedicated payment step in the frontend (Pay, CheckoutForm, Success), which indicates checkout is a distinct flow rather than embedded inside ordering. Even without seeing the payment provider code, the architecture includes a checkout boundary between order creation and completion.
9. Client-side state and API access are intentionally separated into utilities and reducers. utils/newRequest.js is the HTTP client wrapper for calling the API, utils/getCurrentUser.jsx handles session/user lookup on the client, utils/upload.js suggests file/image upload support, and reducers/gigReducer.jsx indicates at least some marketplace state is managed centrally.
10. The visual UI is composed from reusable marketplace widgets such as Navbar, Footer, Featured, TrustedBy, category cards, gig cards, project cards, and reviews. These are presentational components that support the home/discovery experience and individual gig detail pages.
11. Hosting and routing are also part of the architecture: client/public/_redirects implies the SPA is deployed to a static host that needs client-side route fallback. That matters because the frontend relies on browser routing while the backend remains a separate API service.
12. From an architecture-diagram perspective, the important flows are: user authentication through the API, gig discovery and creation through the gig endpoints, order/payment flow through order and pay pages, and buyer-seller communication through conversation/message endpoints. The main system boundary is the API-backed data layer versus the React SPA, with JWT-based access control connecting them.
Main entry points: pages Pages · routes API routes · gig.route.js Marketplace routes · gig.controller.js Marketplace logic
Components 20
API
Node/Express backend with routes, controllers, models, and shared middleware.
- Server entry · Bootstraps the API server, registers middleware and routes, and starts the backend.
api/index.js - API routes · Resource-level HTTP boundaries for auth, users, gigs, orders, reviews, conversations, and messages.
api/routes - Controllers · Business logic layer for API requests and responses.
api/controllers - Models · Persisted marketplace entities for users, gigs, orders, reviews, conversations, and messages.
api/models - JWT guard · Protects private API endpoints with token-based access control.
api/middleware/jwt.js - Error helper · Shared helper for constructing API errors in controllers.
api/utils/createError.js - Auth route · Login and registration entrypoints.
api/routes/auth.route.js - Marketplace routes · Routes for users, gigs, orders, reviews, conversations, and messages.
api/routes/gig.route.js - Auth logic · Handles account creation and sign-in flows.
api/controllers/auth.controller.js - Marketplace logic · Coordinates gig discovery, ordering, reviews, user profiles, conversations, and messages.
api/controllers/gig.controller.js
Client
React/Vite single-page app with pages, components, and client utilities.
- SPA shell · Vite-powered React application root and client-side router shell.
client/src/App.jsx - Pages · Route-level screens for discovery, account access, seller tools, checkout, orders, and messaging.
client/src/pages - UI components · Reusable marketplace widgets for navigation, discovery, gig cards, reviews, and footers.
client/src/components - Checkout UI · Dedicated checkout component used by the payment flow.
client/src/components/checkoutForm/CheckoutForm.jsx - Client state · Centralized client-side request helpers, session lookup, uploads, and gig state.
client/src/utils - Home · Landing and marketplace discovery experience.
client/src/pages/home/Home.jsx - Gig flow · Gig browsing and detail views.
client/src/pages/gigs/Gigs.jsx - Seller flow · Gig creation and seller inventory management.
client/src/pages/add/Add.jsx - Buyer flow · Orders, payment, and success screens for completed purchases.
client/src/pages/orders/Orders.jsx - Inbox flow · Conversation list and individual message threads.
client/src/pages/messages/Messages.jsx
Connections 22
- Server entry → API routes: registers · The server entry mounts the route layer.
- Server entry → JWT guard: uses · Private endpoints rely on JWT protection.
- API routes → Auth route: includes · Auth endpoints are one route group.
- API routes → Marketplace routes: includes · Marketplace endpoints are grouped as resources.
- Auth route → Auth logic: delegates · Auth routing hands requests to auth controllers.
- Marketplace routes → Marketplace logic: delegates · Resource routing hands requests to marketplace controllers.
- Auth logic → Models: reads/writes · Auth logic operates on user records.
- Marketplace logic → Models: reads/writes · Marketplace controllers operate on all core domain entities.
- Marketplace logic → Error helper: throws · Shared error helper standardizes controller failures.
- Marketplace routes → JWT guard: protects · Authenticated resources are guarded by JWT middleware.
- SPA shell → Pages: routes to · The app shell renders route-level screens.
- SPA shell → UI components: composes · Pages are built from shared UI components.
- Pages → Home: includes · Home and discovery entrypoint.
- Pages → Gig flow: includes · Browsing and gig detail screens.
- Pages → Seller flow: includes · Seller creation and management screens.
- Pages → Buyer flow: includes · Order, pay, and success screens.
- Pages → Inbox flow: includes · Inbox and thread screens.
- Buyer flow → Checkout UI: uses · Checkout form powers the payment step.
- Client state → Server entry: calls · Client request helpers talk to the backend API.
- Client state → SPA shell: supports · Session, upload, and state utilities support the app shell and pages.
- UI components → Home: supports · Reusable widgets support discovery pages.
- UI components → Gig flow: supports · Cards and reviews support gig detail and listing views.