petherson.
← All projects

Academic full-stack project

Service Marketplace

Requests, quotes and bookings, with overlapping time slots blocked by the database. The public demo does not use real payments.

Next.js · TypeScript · React · PostgreSQL · Prisma · Zod

Service MarketplaceService schedule

The real problem

Customers need to find a provider, request a quote and book a time. The system must prevent two customers from booking the same provider at overlapping times.

What I built

I evolved a Next.js interface into a system with Prisma, PostgreSQL, session authentication, requests, quotes, bookings and reviews. I implemented an isolated demo, password recovery and write rate limits.

Evidence and tests

Automated API, database and browser tests passed. The screenshots show a booking with fictional data in disposable PostgreSQL. The public demo does not use real payments; a hosted database has not been confirmed.

Project screenshots

Advanced technical details

Technical decisions: audited states

Request transitions are validated and recorded in StatusEvent with actor and timestamp. A partial unique index allows only one accepted quote.

Technical decisions: concurrency and money

Transactions and a GiST exclusion constraint prevent overlapping active bookings per provider while permitting adjacent slots. Prices use integer cents. Demo mode is selected without a configured database; configured database failures never silently switch to demo data. Password reset emails require configured Resend.

System design

Interactive architecture

Select a component to inspect its responsibility and trade-offs. The diagram represents documented behavior.

Next.js · React

Catalog

Demo mode uses local data; database mode queries PostgreSQL.

Decision and trade-off

Explicit separation avoids confusing demo with production.

Interactive experience

From selection to checkout

Illustrative demo checkout, separate from database mode with persistent requests and bookings. No real payment.

Documented flow1/4

Next.js · React

Catalog

The user browses categories and finds a provider profile.

Infrastructure / CI

Infrastructure and deployment

Documented topology, not a live inventory. Select a component to inspect the source.

GitHub Actions → Next.jsNext.js → VercelNext.js → PostgreSQLPostgreSQL → Booking

Quality · PostgreSQL

GitHub Actions

CI passed: lint, tests, build, audit and ephemeral database integration.

Inspect source ↗

API / HTTP

API reference

Read-only contract examples verified against source code and tests. No requests are sent. Tokens and IDs are placeholders; responses may be partial.

Reads the session in database mode; unauthenticated example.

Authorization: Session cookie

Request

GET /api/auth/session

Expected response

200 OK
{"user":null}
Inspect contract source ↗

Architecture Decision Records

Architecture decisions

Retrospective records based on the implemented code. Alternatives are analytical comparisons, not a claimed historical shortlist.

ADR-01 · Audited states
Context
Quote acceptance and transitions require consistency.
Options compared
Local state versus a persistent state machine.
Decision
StatusEvent records transitions; partial unique index ensures one acceptance.
Consequences and trade-offs
Traceability; requires transactions, migrations and authorization tests.
Inspect source ↗
ADR-02 · Booking concurrency
Context
Concurrent requests may book conflicting slots.
Options compared
Application check versus an additional database guarantee.
Decision
Transaction and GiST exclusion by provider and active time range.
Consequences and trade-offs
Protects integrity; requires PostgreSQL and specific migrations.
Inspect source ↗

Technical dossier · Miguel Petherson Silva

https://petherson-dev.vercel.app/en/projetos/marketplace-de-servicos

Infrastructure

GitHub Actions: CI passed: lint, tests, build, audit and ephemeral database integration.

Next.js: Isolated browser demo or database mode; route handlers, password recovery and write limits.

Vercel: Public demo deployment; hosted database not confirmed.

PostgreSQL: Sessions, states, quotes and bookings; integrity constraints.

Booking: Excludes overlapping active time ranges per provider.

API

GET /api/auth/session

Reads the session in database mode; unauthenticated example.

GET /api/auth/session

200 OK
{"user":null}

https://github.com/pethersonzada/marketplace-services/blob/324dc41c692e5886f8dddce7f0a554d738ff64a0/Code/marketplace_services_nextjs/src/app/api/auth/session/route.ts

POST /api/requests/{id}/booking

Partial response: requires bookingSchema validation and a scheduling transaction. No request is sent.

POST /api/requests/{id}/booking
Content-Type: application/json
Cookie: <session>
Origin: <app-origin>

201 Created
{ request: ... }

https://github.com/pethersonzada/marketplace-services/blob/324dc41c692e5886f8dddce7f0a554d738ff64a0/Code/marketplace_services_nextjs/src/app/api/requests/[id]/booking/route.ts

ADRs

ADR-01 · Audited states

Context: Quote acceptance and transitions require consistency.

Options: Local state versus a persistent state machine.

Decision: StatusEvent records transitions; partial unique index ensures one acceptance.

Trade-offs: Traceability; requires transactions, migrations and authorization tests.

https://github.com/pethersonzada/marketplace-services/blob/324dc41c692e5886f8dddce7f0a554d738ff64a0/Code/marketplace_services_nextjs/prisma/schema.prisma

ADR-02 · Booking concurrency

Context: Concurrent requests may book conflicting slots.

Options: Application check versus an additional database guarantee.

Decision: Transaction and GiST exclusion by provider and active time range.

Trade-offs: Protects integrity; requires PostgreSQL and specific migrations.

https://github.com/pethersonzada/marketplace-services/blob/324dc41c692e5886f8dddce7f0a554d738ff64a0/Code/marketplace_services_nextjs/prisma/migrations/20261129000000_initial/migration.sql

Source and demonstration

Professional contact

Get in touch

I am seeking an internship or junior full-stack role. Send me the job description or connect on LinkedIn.