production-scale reliability and three powerful extensions
working together.
Amazon DynamoDB — The Chat Layer
Chat messages have completely different characteristics:
-
High volume — every message in every conversation
-
Simple access pattern — always fetched by conversationId
-
Time-ordered — always read chronologically
-
Auto-expiring — old messages should disappear after 90 days
This is a perfect DynamoDB use case:
PK: conversationId (String)
SK: {timestamp}#{messageId} (String)
TTL: expiresAt (Unix epoch, 90 days)
Capacity: PAY_PER_REQUEST
The composite sort key enables chronological reads and
time-range queries in a single DynamoDB operation. TTL
auto-expires messages with zero infrastructure — no cron
jobs, no manual deletes.
The Dual Database Pattern
Aurora PostgreSQL DynamoDB
───────────────── ────────
scrolls + embeddings │ chat messages
folder hierarchy │ composite sort keys
user accounts │ 90-day TTL
conversation metadata │ pay-per-request scale
complex queries │ simple key-value access
Aurora owns structure and search.
DynamoDB owns the high-volume message stream.
Each database doing what it's best at.
What I Learned
DynamoDB key design is everything. The
timestamp#messageId sort key pattern unlocks
chronological reads, time-range queries, and uniqueness
in a single attribute. Getting the key design right
upfront saved me from any schema migrations later.
Aurora pgvector at 3072 dimensions has index limits.
Both ivfflat and hnsw indexes cap at 2000 dimensions on
Aurora's pgvector version. For a personal knowledge base,
exact search works perfectly and is simpler to maintain.
Serverless v2 auto-pause is a feature. Aurora
Serverless v2 auto-pauses when idle — zero cost during
development and low-traffic periods. Perfect for a
hackathon prototype.
The Result
A production-grade dual-database architecture where:
- Aurora handles all the complex relational and vector
search operations
- DynamoDB absorbs all the chat message write volume
- Each database is used exactly as it was designed to be
Try ChatScroll: https://chatscroll.vercel.app
AWS Architecture deep dive: https://chatscroll.vercel.app/aws-showcase
I created this content for the purposes of entering
the AWS H0 Hackathon.
H0Hackathon #AWS #Aurora #DynamoDB #Vercel #H0Hackathon