Database

Database Guide

Everything you need to know about our DynamoDB tables: how they're structured and how the environment suffix system works.


Overview

BizTech uses Amazon DynamoDB as its primary database. DynamoDB is a NoSQL key-value and document database, so there are no SQL queries, joins, or migrations. Data is organized into tables with primary keys and optional sort keys.

Key Concept for Newcomers

DynamoDB is fundamentally different from relational databases (PostgreSQL, MySQL). There are no tables with columns. Instead, each item is a JSON document with a primary key. You can store different shapes of data in the same table. Think of it as a giant, fast key-value store.


Environment Suffix System

All table names automatically get the ENVIRONMENT variable appended at runtime. This is handled by lib/db.js, so you never need to add the suffix manually.

EnvironmentSuffixExample Table Name
Dev"" (empty)biztechEvents
Staging"" (empty)biztechEvents
Production"PROD"biztechEventsPROD

Dev and Staging Share Tables

Because both dev and staging have an empty suffix, they read from the same tables. Be careful with destructive operations in staging since they affect dev too.


Table Reference

Core Tables

TablePrimary Key (PK)Sort Key (SK)Description
biztechEventsid (string)year (number)All events
biztechUsersid (string = email)-User accounts
biztechRegistrationsid (string = email)eventID;year (string)Event registrations
biztechMembers2026id (string = email)-Club members
biztechProfilesid (string)eventID;year (string)Profiles + connections
biztechTeamseventID;year (string)id (string)Teams per event
biztechQRseventID;year (string)id (string)QR codes per event
biztechQuestsid (string = email)eventID;year (string)Quest progress
biztechQuizzesid (string)eventID;year (string)Quiz results
biztechPrizesid (string)-Prize catalog
biztechTransactionsid (string = UUID)-Point transactions
biztechInvestmentsid (string = UUID)eventID;year (string)Kickstart investments

Connection & Real-Time Tables

TableDescription
bizConnectionsConnection records between profiles
bizWallSocketsWebSocket connections for the live connection wall
bizLiveConnectionsRecent connections for wall animation (with TTL)
bizSocketsWebSocket connections for the sticker/voting system
bizStickersSticker votes
bizScoresScoring data
bizFeedbackJudge feedback
bizJudgeJudge assignment tracking

BTX (Stock Exchange) Tables

TableDescription
bizBtxProjectsProjects/companies in the exchange
bizBtxAccountsUser trading accounts (balance, portfolio value)
bizBtxHoldingsUser share holdings
bizBtxTradesTrade history
bizBtxSocketsWebSocket connections for real-time prices
bizBtxPricesPrice history snapshots

Next Steps

  • Schemas & Access Patterns: Detailed table schemas, Global Secondary Indexes, common access patterns, and how to use the db module
Previous
Admin & Specialized APIs