Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LegoDB — Cloud-Hosted Relational Database System for LEGO Inventory & Analytics

LegoDB is a full-stack relational database project modeling LEGO pieces, sets, collections, releases, customers, and stores.
It was designed end-to-end with formal ER modeling, schema normalization, domain constraints, cloud deployment, and an interactive UI.

The system supports both customer-facing queries (browsing sets, filtering parts) and administrator analytics (inventory, sales, demographics).


🚀 Architecture Overview

  • MySQL (AWS RDS)
  • Retool UI
  • Docker (local dev)
  • SQL constraint validation
  • Mock data generation
  • Cloud deployment

Core pipeline: ERD → Relational Model → SQL Schema → Domain Constraints → Sample Data → Cloud RDS → Retool UI


📐 Data Modeling

The schema includes:

  • 5 strong entities (Lego, Collection, Release, Customer, Store)
  • 2 weak entities (Set, Inventory)
  • 11 relationships
  • Explicit domain, entity, and foreign key constraints

Highlights:

  • M:N relationships decomposed via index tables
  • Formal domain constraints on dimensions, pricing, dates, and IDs
  • Weak entities modeled for Sets and Inventory
  • Customer ownership + purchase tracking

See:

  • docs/erd.png
  • docs/rm.png
  • docs/schema.md

🧠 Design Decisions

  • Sets belong to exactly one Collection and one Release.
  • Collections may span multiple Releases.
  • LEGO pieces are independent entities.
  • Tags enable flexible classification.
  • Strict SQL modes enforce integrity.
  • Foreign keys enforce ownership and purchase flows.

Tradeoffs around normalization, boolean attributes, and multivalue relations are documented in docs/architecture.md.


🔍 Example Queries

Customer:

  • Browse sets by dimensions, price, brand
  • View owned LEGO parts
  • Filter by tags

Admin:

  • Inventory per store
  • Average prices
  • High-activity customers
  • Demographic analytics

Located in sql/queries/.


🧪 Testing

Each relation includes:

  • Max/min domain inserts
  • Invalid constraint inserts
  • Foreign key violation tests

Ensuring:

  • Domain enforcement
  • Referential integrity
  • Primary key uniqueness

☁️ Deployment

  • AWS RDS (MySQL)
  • Retool frontend connected via secure resource query
  • Local Docker for development

Retool app export is included in /retool.


📸 UI

Interactive dashboards allow:

  • Customer collection management
  • Store inventory control
  • Dynamic filtering
  • SQL-backed tables

Screenshots in docs/ui_screenshots/.


🧰 Tech Stack

  • MySQL
  • AWS RDS
  • Retool
  • Docker
  • VSCode
  • GitHub

📌 Status

Complete.
Frozen for portfolio reference.


License

MIT

About

Implementation of a relational database.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors