Architecture

How the frontend, API, database, and blockchain interact.

VerseBill is a Next.js application with an App Router frontend, API route handlers, a Prisma-backed Supabase Postgres database, and a viem client for reading the Polygon blockchain.

  1. 1Frontend (Next.js / React, Tailwind CSS)
  2. 2Application/API layer (Next.js route handlers)
  3. 3Supabase / Postgres (Prisma ORM)
  4. 4Blockchain RPC (viem public client)
  5. 5Polygon network
  6. 6VERSE token (ERC-20)
  7. 7On-chain transaction verification

Request flow

  • The browser calls an API route with the authenticated session
  • The route validates input and authorizes the request against the merchant
  • Server modules read and write Postgres via Prisma
  • Payment verification reads the blockchain through a server-side RPC
  • The route returns JSON that the client renders
FrontendNext.js · React · TailwindApplication / API layerRoute handlers · Zod · PrivySupabase / PostgresPrisma ORMEntitiesUser · Merchant · InvoicePayment · AuditLogBlockchain RPCviem public clientPolygon PoSChain ID 137VERSEERC-20 tokenOn-chain verificationPAID only after confirm
Verification reads the transaction and receipt from the RPC, then writes the confirmed status back to Postgres. The browser never talks to the database or the RPC directly.
The browser never talks to the database or the RPC directly. All chain reads and database writes happen on the server.
Architecture — VerseBill Documentation