Single-table design in a key-value database is one of the most effective techniques for building hyper-scalable SaaS backends. By modeling multiple entity types in a single table using composite primary keys (PK and SK), we achieve O(1) query performance across all application entities.
Key Schema Design for ServerLaas
Our core database schema stores Users, Projects, Deployments, and Billing Subscriptions inside a single table named 'serverlaas-main':
json
{
"PK": "USER#usr_99812",
"SK": "METADATA",
"email": "dev@obsidianx.online",
"plan": "PRO"
}Global Secondary Index (GSI) Partitioning
To query deployments by status (e.g. FETCH_ALL_BUILDING_PROJECTS), we leverage GSI1 with GSI1PK set to STATUS#BUILDING and GSI1SK set to the ISO timestamp.