All projects
Web AppWebLive

EliteCrew — Home services marketplace

Book verified professionals for AC, electrical, plumbing and more, then track them on a live map.

Open live siteView on GitHub
0 stars0 forksUpdated a month ago

A three-sided marketplace in one Next.js app: customers book and pay, professionals onboard and manage jobs, and admins approve providers, manage the catalog and answer support in real time. Socket.IO powers notifications, support chat and live location.

19
service categories
3
roles: customer, professional, admin
40+
pages
7
realtime events

What it does

Book in a few taps

Browse categories with upfront prices, pick a service and pay online.

Live tracking

A Leaflet map follows the professional using location updates over Socket.IO.

Realtime support

Tickets and messages update live for both the customer and the admin.

Location-aware

City detection falls back from cache to GPS to IP lookup, cached for six hours.

Admin console

Provider approvals, service catalog, coupons, blog, careers and contact inbox.

Cookie-based auth

Calls go through a same-origin rewrite, so the httpOnly cookie is never read by JavaScript.

Architecture at a glance

  1. 1Browser → /api/* rewrite in next.config.mjs → Express API, with the httpOnly cookie forwarded.
  2. 2Socket.IO uses a short-lived ws token from /api/auth/ws-token and refreshes it on auth errors.
  3. 3Razorpay: the server creates the order and verifies the payment; the client only opens checkout.
  4. 4lib/services.js holds the service catalog (prices, durations, inclusions) used across home and category pages.

Architecture notes

Written from the repository's source code: how it is structured, how it talks to the backend and how to run it.

ARCHITECTURE.md · Gautam5514/service_provider_frontend

EliteCrew — Home services marketplace

The web app for EliteCrew, a home-services marketplace. Customers book verified professionals for AC, fridge, electrical, plumbing, cleaning and more. Professionals manage their jobs, and admins run the whole platform, all from one Next.js app with three role-based areas.


What it does

CustomerProfessionalAdmin
Browse 19 service categories with upfront pricesRegister and complete onboardingReview and approve professionals
Smart search and location-aware resultsSee and manage assigned jobsManage the service catalog
Book a service and pay onlineShare live location while on the wayCreate coupons and offers
Track the professional on a live mapMaintain a public profileHandle support tickets in real time
Rate the job after it is donePublish blog posts and job openings
Raise and follow support ticketsRead contact messages and applications

Tech stack

PieceToolUsed for
FrameworkNext.js 16 (App Router)Pages, rewrites, metadata, sitemap
UIReact 19Components
StylingTailwind CSS 4, shadcn/ui on Base UIDesign system and primitives
MotionFramer MotionPage and component animation
HTTPAxiosAPI client
RealtimeSocket.IO clientNotifications, support chat, live location
MapsLeafletLive tracking and location picker
PaymentsRazorpay CheckoutOnline payment for bookings

The Express backend is a separate project and is not part of this repository.


Architecture

flowchart LR
  B["Browser"] -- "/api/* (same origin)" --> N["Next.js rewrite"]
  N -- "httpOnly cookie forwarded" --> API["Express API"]
  B <-- "Socket.IO + short-lived ws token" --> API
  B -- "checkout.js" --> RZ["Razorpay"]
  B -- "geolocation, reverse geocode" --> GEO["Nominatim / IP lookup"]

The browser only ever calls /api/... on the site's own origin. A rewrite in next.config.mjs forwards those calls (and /uploads/...) to the backend. Because the request stays same-origin, the httpOnly auth cookie is sent automatically and no token is ever read by client-side JavaScript.

lib/api.js is a small Axios instance with withCredentials: true. Its only interceptor clears the cached user when the API answers 401, so an expired session logs the user out cleanly.

Realtime without exposing the session

Socket.IO connects straight to the backend, so it cannot use the httpOnly cookie. Instead:

  1. The app asks /api/auth/ws-token for a short-lived socket token.
  2. The token is passed in the Socket.IO handshake.
  3. If the connection is rejected for an expired token, the client fetches a fresh one and reconnects on its own.

Events the UI listens for:

EventUsed by
notification:newNotification bell
provider:location:updateLive tracking map
support:ticket:created, support:ticket:status, support:message:newSupport chat for customers and admins
contact:message:new, career:application:newAdmin badges and toasts

Location, with fallbacks

lib/location.js finds the customer's city in this order and caches the answer for six hours:

  1. Cached value in localStorage
  2. Browser Geolocation, reverse-geocoded with Nominatim
  3. IP-based lookup
  4. A default city

Payments

lib/razorpay.js loads Razorpay's checkout script once and reuses it.

  1. POST /payments/order with the booking id. The server decides the amount.
  2. The checkout modal opens with that order.
  3. On success the app calls POST /payments/verify. The booking is marked paid only after the server verifies the payment.

Folder structure

app/
  page.js                     home: categories, search, offers
  services/[category]/        services in a category
  book/[serviceSlug]/         booking flow
  bookings/  bookings/[id]/   booking list, detail and live tracking
  bookings/[id]/rate/         rating after the job
  providers/  offers/         browse professionals and offers
  support/  support/[ticketId]/   customer support tickets
  login/  register/  forgot-password/  profile/
  professional/login/  professional/register/
  provider/  provider/onboarding/    professional area
  dashboard/customer/  dashboard/provider/
  admin/                      admin console
    providers/  approved/  services/  coupons/
    support/  blog/  careers/  contact/
  blog/  careers/  about/  how-it-works/  help/  contact/  privacy/  terms/
  sitemap.js  robots.js  manifest.js

components/
  LiveTrackingMap.jsx   LocationPicker.jsx   LocationBar.jsx
  SmartSearch.jsx       NotificationBell.jsx
  SupportWidget.jsx     SupportBot.jsx
  admin-sidebar.jsx     provider-sidebar.jsx
  auth/  blog/  careers/  contact/
  ui/                   shadcn/ui primitives (button, sheet, sidebar, map …)

lib/
  api.js        Axios client that goes through the /api rewrite
  auth.js       session helpers
  socket.js     Socket.IO connection and ws-token refresh
  location.js   city detection and caching
  razorpay.js   checkout loader and payment flow
  services.js   service catalog: categories, prices, durations, inclusions
  seo.js        site URL and canonical helpers

Run it locally

You need Node.js 20+ and the EliteCrew backend running (port 8080 by default).

git clone https://github.com/Gautam5514/service_provider_frontend.git
cd service_provider_frontend
npm install

Create .env.local:

NEXT_PUBLIC_API_URL=http://localhost:8080
NEXT_PUBLIC_SITE_URL=http://localhost:3000

Then start the dev server:

npm run dev      # http://localhost:3000
CommandWhat it does
npm run devStart the app for local development
npm run buildBuild the production version
npm startRun the production build
npm run lintLint with ESLint