
Building a Globally Distributed Corporate Ledger with AWS Aurora DSQL, Prisma, and Vercel
Zenith Treasury is a B2B treasury and reconciliation engine that uses an autonomous AI agent mesh to match, investigate, and audit transactions across global shards, backed by AWS Aurora DSQL for active-active consistency.
In financial tech, data consistency is non-negotiable. Relational databases must guarantee ACID transactions across global operations, which traditionally meant deploying complex master-replica setups and dealing with replication lag.For the H0 Hackathon, I built Zenith Treasury—a B2B treasury and reconciliation dashboard that utilizes AWS Aurora DSQL and Vercel to simulate real-time, multi-region transaction audits.#### The Tech Stack* Frontend & APIs: Next.js (App Router, Server Actions, Server-Sent Events) deployed on Vercel.
- Database: AWS Aurora DSQL (Distributed SQL).
- ORM: Prisma v7 with
@prisma/adapter-pg.#### Connecting Prisma to AWS Aurora DSQLAurora DSQL utilizes IAM authentication instead of traditional passwords. To connect, we sign the connection token dynamically:import { DsqlSigner } from "@aws-sdk/dsql-signer";
import { Pool } from "pg";
import { PrismaPg } from "@prisma/adapter-pg";
import { PrismaClient } from "@prisma/client";const signer = new DsqlSigner({
region: "us-east-1",
hostname: "your-cluster-endpoint.dsql.us-east-1.on.aws",
});const pool = new Pool({
host: "your-cluster-endpoint.dsql.us-east-1.on.aws",
port: 5432,
database: "postgres",
user: "admin",
password: async () => await signer.getDbConnectAdminAuthToken(),
ssl: { rejectUnauthorized: false }
});const adapter = new PrismaPg(pool);
const prisma = new PrismaClient({ adapter });Resolving DSQL ConstraintsDuring development, we navigated a few DSQL-specific structural constraints:1. No unique secondary indexes: Aurora DSQL does not support synchronous secondary unique indexes. We moved unique constraint validations to the application logic.
2. Relation Handling: Foreign keys are managed in the client layer using Prisma'srelationMode = "prisma"configuration.#### ConclusionVercel and AWS Aurora DSQL enable developers to build B2B financial apps that scale globally from day one, with active-active transaction consistency across Virginia and Dublin shards.Created for the H0: Hack the Zero Stack with Vercel v0 and AWS Databases hackathon (#H0Hackathon).
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article