Architecture
Published June 2026
ZestyShop runs on Next.js 16 deployed to Vercel with Aurora PostgreSQL as the primary database. Auth, payments, file storage, and email all flow through AWS services or integrated providers.
Data Flow
- Browser → Vercel — All traffic hits the Vercel edge network. Server Components render pages server-side; Client Components handle interactivity.
- Vercel → Aurora PostgreSQL — Products, orders, user accounts, reviews, categories, and discount codes all live in a single Aurora PostgreSQL cluster. Kysely provides typed queries.
- Vercel → Stripe / DodoPayments — Better Auth plugins handle subscription management (Stripe) and one-time checkout (DodoPayments). Webhooks sync payment status.
- Vercel → S3 — Product images and file uploads use presigned POST URLs. The browser uploads directly to S3 — the server never touches the file.
- Vercel → SES — Transactional emails (verification, password reset, order confirmation, shipping notification) are sent via Amazon SES with DKIM-signed domain.
- Vercel → AWS via IAM — Vercel OIDC provides temporary credentials via STS role assumption. No long-lived access keys in production.
Why Aurora PostgreSQL?
Aurora PostgreSQL was chosen for ACID compliance, native JSON support, and managed scaling. All relational data — products, orders, users, reviews, categories, and discount codes — lives in a single Aurora cluster. This keeps joins fast and schema migrations simple.
For local development, the app uses PGlite — an in-process WASM Postgres that requires zero external dependencies. The same SQL runs in dev and production. The app detects PGlite vs Aurora automatically via lib/db-pool.ts.
Auth & Sessions
Better Auth manages email/password and Google OAuth sign-in. Sessions last 30 days with auto-refresh. The Stripe and DodoPayments Better Auth plugins link subscriptions and checkout to user accounts. All auth queries go through the Kysely adapter to PostgreSQL.
Scale Strategy
The architecture is designed for growth. Aurora PostgreSQL scales vertically or via read replicas. S3 and SES are fully managed — they scale to any load. Vercel's edge network handles global distribution. The only stateful bottleneck is the database, and Aurora's Multi-AZ deployment provides both high availability and read scaling.