Services Marketplace

A PWA marketplace connecting service discovery, role-based workflows, data, and production infrastructure.

9 min read
ReactTypeScriptNestJSPostgreSQLTypeORMRedis
Original conceptual illustration. Product identity, interface, and customer data are omitted under NDA.

I built this confidential marketplace as one connected system: a mobile-first customer product, the domain workflows behind bookings and rewards, an administration layer, and the infrastructure that runs it.

The Challenge

A marketplace for local services has to coordinate two different experiences. Customers need a direct path from discovering a business to making an appointment. Operators need to manage locations, schedules, bookings, staff, and offers without losing control of the data underneath.

I worked across the full stack: the React PWA, NestJS API, PostgreSQL model, booking and loyalty workflows, notifications, administration, and container-based delivery. The original visual identity and UI remain confidential.

  • React PWA and TypeScript client
  • NestJS modular backend
  • PostgreSQL, TypeORM, Redis, and Docker
  • Booking, loyalty, administration, and notifications

System Architecture

The repository is organized as a monorepo with two applications: a React client built with Vite and a modular NestJS backend. TypeORM maps the persistent domain to PostgreSQL, while Redis holds shared throttle state. Nginx routes traffic to separate frontend and API containers.

The backend separates identity, businesses and branches, calendars, favorites, promotions, users, notifications, push subscriptions, and administration into modules. Users, branches, appointments, bonus transactions, coupons, promotions, and notifications stay connected through persistent records rather than disconnected client state.

Conceptual request path. Internal endpoints, identifiers, and infrastructure addresses are omitted.

React PWA

Vite and TypeScript

NestJS domain modules

Authoritative product workflows

IdentityBookingsRewardsNotificationsAdmin

PostgreSQL

Persistent domain

Redis

Shared throttle state

Web Push

External delivery

The Product Experience

The customer application is mobile-first but runs in the browser. It combines service discovery, category and text search, business profiles, selectable services and specialists, available time slots, personal appointments, favorites, and an account area.

A Progressive Web App was a practical fit. The Vite PWA setup provides an installable shell, an explicit update flow, a custom service worker, image caching, selected read-only API caching, and an offline fallback. Booking transactions still require a server connection.

The service worker also receives Web Push events and can open the relevant appointment when a notification is selected, connecting an operating-system event back to a specific in-app task.

Conceptual customer journey. No product screens or customer records are shown.

Discover

Search and categories

Compare

Businesses and services

Select

Service and specialist

Choose time

Available schedule

Manage

Appointment context

The browser-based journey stays mobile-first from discovery through appointment management.

Booking as a Domain Workflow

Booking is where independent parts of the product interact. The client selects a business, services, an optional specialist, and an appointment time. The API reads branch data, checks for an existing conflict, calculates the service total, evaluates applicable promotions or coupons, and creates an appointment.

A database transaction groups booking creation with coupon application and bonus-point redemption. The record retains its selected services, customer and branch references, price adjustment, optional promotional reference, and lifecycle state: active, completed, or canceled.

Availability is derived from schedules, specialists, and existing orders. The API checks for conflicts during creation instead of trusting state that was previously displayed in the client. This is an important boundary, although the current locking strategy is not presented as a complete guarantee against simultaneous bookings into an initially empty slot.

A conceptual booking decision path. It describes verified workflow boundaries, not a claim of complete concurrency protection.

Availability

Schedule and conflicts

Benefits

Price and eligibility

Transaction

Persistent change

Appointment

Lifecycle state

A valid request creates an appointment with its related booking changes.Failure paths

Loyalty Is Part of the Booking Model

Rewards are connected to domain events rather than presented as a decorative profile balance. Customers have a points balance, transaction history, coupons, and promotions. Some services can be redeemed with points, while promotions and coupons reduce the monetary part of a booking.

The system distinguishes available points from points pending approval. A booking can calculate a pending reward, but a separate administrative action confirms it and adds it to the customer balance. Coupon purchase and redemption, promotional codes, and birthday offers add eligibility and repeat-use rules that stay aligned with booking state.

Conceptual state transition. Values are symbolic and do not represent customer balances.
1

Booking

A domain event

2

Pending

Reward calculated

3

Approved

Staff confirmation

4

Available

Balance updated

5

Redeem

Coupon or service

Points progress through an explicit state change; they are not credited by the client.

Identity and Administrative Boundaries

Customer identity is based on phone verification, with SMS and call-verification flows supported by the API. Access uses short-lived JWTs, while refresh sessions are persisted on the backend and managed through an HttpOnly cookie. OTP requests also have resend cooldowns and rate-limit controls.

The administration system has its own responsibility model. Branch administrators work with their location's orders and customers, while manager-level and platform-administrator functions expose broader operations over businesses, branches, promotions, staff accounts, and settings. Authorization is checked on protected backend routes, not through hidden navigation alone.

Qualitative access scopes. It does not claim tenant isolation beyond the verified role boundaries.
Role
Appointments
Business
Platform
Branch admin
Manager
Platform admin

Access is enforced on protected API operations, not only in navigation.

Notifications and Re-Engagement

Appointments remain relevant after creation. The application includes persisted in-app notifications and a Web Push delivery path based on stored browser subscriptions and VAPID. Notification records can be scheduled, then a periodic backend task selects due items and attempts delivery.

Operational events such as appointment changes, bonus approval, and time-based promotions can feed this workflow. Push delivery remains a best-effort external operation, not proof that a user has seen a notification. Delivery attempts and subscription status are tracked separately from the appointment itself.

Conceptual notification lifecycle with a separate external delivery boundary.

Domain event

Appointment or reward

Record

Persisted notification

Scheduler

Due item selected

Web Push

Delivery attempt

Deep link

Booking context

A push attempt is tracked separately from a user's interaction with the notification.Failure paths

Operations and Delivery

The production configuration defines containers for the frontend, NestJS API, PostgreSQL, Redis, Nginx, and monitoring. PostgreSQL and uploaded media are backed by persistent Docker volumes; Compose declares service health checks and resource limits.

Nginx handles edge routing and TLS. Monitoring collects container resource signals and can send threshold-based Telegram alerts. A Redis-backed throttling mode exists in the API, although its automated activation path needs further verification before it can be described as a proven self-healing mechanism.

This deployment keeps the system understandable without implying multi-region failover, a distributed message broker, or fully automated recovery. Those are different operating guarantees and would require additional engineering and evidence.

Conceptual service topology. Server names, secrets, and environment values are omitted.

Nginx

Edge routing

React

Frontend

NestJS

API

PostgreSQL

Data

Redis

Throttle

Monitoring

Alerts

Containers and persistent volumes keep responsibilities explicit while the deployment remains single-server.

Engineering Decisions

The server owns business rules. Booking state, discounts, coupon eligibility, and point balances are not trusted to the client. Explicit backend workflows and persistent records keep those decisions together.

The PWA improves delivery without replacing the backend. Cached images and selected discovery data improve repeat visits, while appointments, identity, and rewards remain dependent on authoritative server state.

Operational complexity stays visible. The repository includes health checks, monitoring, notification scheduling, and explicit roles, while its limits remain clear: booking concurrency needs further hardening, a single-server deployment is not highly available, and push acceptance does not equal engagement.

The engineering work is in the contracts between screens: what is authoritative, what can be cached, what changes inside a transaction, and what happens when an external delivery step fails.

Outcome

The codebase brings together a customer-facing PWA, multi-location service discovery, appointment management, loyalty rules, administrative operations, notifications, and container-based infrastructure.

It demonstrates a stateful application whose features share persistent data and business rules. A booking can affect the calendar, account state, staff workflows, and later notifications.

No conversion uplift, active-user count, revenue increase, production latency, or load-test throughput is claimed here because those outcomes cannot be verified from the supplied source snapshot.

Next case study

EDS Group