Identity & permissions
Supabase-backed authentication, application-owned sessions, customer ownership checks, database-backed administrator RBAC and WebAuthn passkeys.
Flagship case study · Application & commerce engineering
A commerce system where the server owns prices, permissions, stock and payment outcomes. The engineering connects a customer storefront to the transactional workflows and administrator tools behind it.
Deployed on Vercel Production as a controlled demonstration, using synthetic data and Stripe test mode. It is not a commercial live store.
Project overview
Palermo is a perfume-commerce application with public catalogue and discovery, customer accounts, checkout, orders and tracking, alongside protected operational tools. Its value as an engineering case study is the coordination of these areas across trust boundaries.
Pawan’s documented ownership covers backend, platform and integration work: database architecture, identity, checkout, payment, order and inventory authority, plus security and delivery controls. Customer and administrator interfaces were delivered collaboratively; this case study describes the system and that engineering contribution.
The central challenge was keeping financial and stock state coherent when a browser repeats a request, a payment arrives late, a reservation expires, or an administrator’s access changes.
01 · Architecture
A Next.js App Router modular monolith, with strict TypeScript, domain services, shared API contracts and server-side provider adapters. Prisma connects the application to Supabase PostgreSQL.
Browser
Storefront & admin interfaces
Application
HTTP contracts → domain services
Server boundaries
PostgreSQL · Auth · Stripe adapters
Supabase-backed authentication, application-owned sessions, customer ownership checks, database-backed administrator RBAC and WebAuthn passkeys.
Catalogue discovery, variants and inventory-backed availability, with promotions and current pricing revalidated on the server.
Persistent carts, transactional checkout, bounded stock reservations, payment attempts, order finalisation and attributable inventory movements.
Profiles and addresses, order history and detail, invoice reads, cancellation requests, tracking and support functionality.
Catalogue, inventory and finished-product batches, orders, promotions, review moderation, reporting and security surfaces.
Shared typed API contracts, provider adapters, Prisma migrations, isolated test data, GitHub Actions and Vercel deployments.
02 · Engineering
The browser submits intent. It cannot decide final prices, stock availability, payment success or administrator authority. Shared contracts define the application’s API boundary, while domain modules own business rules.
Checkout revalidates the active cart, current variant prices, promotion, saved addresses, delivery method and available stock in one transaction. It creates the order, pending payment attempt and short inventory reservations together.
A customer-scoped idempotency key allows an identical checkout request to replay safely. Conditional inventory writes and unique movement references guard against repeat effects, while batch release is restricted to an authorised administrator.
The modular monolith keeps these transactional boundaries in one application. Provider-specific behaviour sits behind adapters, so isolated tests can exercise business rules without calling mutable hosted services.
03 · Engineering
Supabase Auth owns password handling and verification. Palermo owns application sessions and account eligibility. Session tokens are stored as hashes; browser cookies use HttpOnly and SameSite protections, with Secure host-scoped cookies in production.
Protected requests recheck account eligibility and credential version. Administrator operations resolve active roles and explicit permissions from the database; a browser role, email convention or provider metadata cannot grant authority.
Administrator passkeys use WebAuthn verification with expected challenge, origin and relying-party checks, requiring user verification. They add a credential path within the same server-owned permission model.
Input validation, customer-scoped reads, safe error contracts and server-only provider access reinforce these boundaries. The release security review records its scope and limitations; these controls are not presented as a security certification.
04 · Engineering
Palermo uses Stripe test-mode PaymentIntents and Stripe Elements. Card data remains within Stripe-controlled fields. Missing server payment configuration fails closed rather than silently switching to a simulated gateway.
The webhook verifies the raw body through Stripe’s signature verifier. A successful event finalises payment, confirms the order, claims active reservations, decrements inventory balances and appends movements within an authoritative database transaction.
Duplicate successful events are idempotent. If success arrives after stock reservations expire, the transaction returns a retryable conflict without changing commerce state. An explicit payment retry can reactivate released or expired reservations when stock remains available, allowing a repeated verified webhook to finish safely.
This separation matters: placing an order, reserving stock and receiving payment are distinct steps. A browser return from checkout is not evidence that the payment completed.
05 · Testing & delivery
172
Unit & contract tests
166
Database integration tests
8
Browser tests
346 passing tests in the successful 29 September 2026 CI run for repository revision 46133da. Counts describe that recorded run, rather than a claim about every future revision.
GitHub Actions runs strict type checks, lint, unit/contract tests and a production build. Database integration tests apply migrations to disposable PostgreSQL fixtures; separate browser jobs exercise customer and administrator journeys.
The automated suites use deterministic providers rather than live Stripe or hosted Auth. Browser checkout stops at the pre-payment boundary. Final deployment QA exercised Chromium at 375, 768 and 1440 pixels, within its documented read-only scope.
06 · Engineering
The final release freeze records a successful Vercel Production deployment, HTTP smoke checks and applied repository migrations. Application data and runtime roles are separated between Preview and Production, and migration authority stays outside the application runtime.
The deployed system remains a controlled demonstration: synthetic customers and orders, Stripe test mode and internally simulated delivery. Supabase Auth is shared at the project level, a documented limitation of this environment.
Release work included regression checks, catalogue and UI repairs, browser QA, a security review and a frozen application baseline. The handover records the operational boundaries and known limitations instead of treating a successful deployment as proof of commercial readiness.
Read the release record07 · Engineering
Retries are part of the domain. Idempotency has to span the request, payment attempt and stock effects. Preventing a duplicate button click covers only one entry point.
Recovery must preserve the same invariants as success. A late webhook cannot confirm an order against stock it no longer owns. Restoring a reservation needs a fresh availability check.
Test evidence needs a boundary. Database fixtures, browser tests and deployment smoke checks prove different things. Naming the exclusions makes the evidence useful when planning the next release.
Apply this approach to production readinessEngineering behind the case study
A first engineering note on Palermo’s payment recovery boundary: late webhooks, transactional stock claims, and explicit retries.
A first engineering note from Palermo: treating the cart as intent, validating current prices and stock, and creating an order transactionally.
Further notes are planned on administrator passkeys, transactional inventory and release validation. Published articles will appear in the engineering hub.
This case study is grounded in the public project documentation and recorded CI. The architecture and implementation evidence is pinned to the reviewed repository revision.
Work with HexCode
Preparing for launch, recovering a broken workflow, or looking for a technical partner? Start with the system and the problem.