Closure is a visual database design tool that guarantees your schema is correct. It runs normalization algorithms (BCNF/3NF) on your design in real-time to eliminate redundancy and data anomalies.
Stop guessing if your database is normalized. Define your tables and rules (Functional Dependencies), and Closure will analyze your schema to detect redundancy and normalization violations (BCNF/3NF).
- Visual Design: Drag-and-drop tables and define relationships.
- Auto-Normalization: One-click optimization to BCNF or 3NF.
- SQL Export: Generate production-ready SQL schemas.
Closure consists of two high-performance components:
- Framework: Next.js 14 + React (TypeScript).
- State Management: Effect-TS (Functional Reactive Programming).
- Canvas: React Flow.
- Design: Hierarchical MVA (Model-View-Adapter).
canvas/: Handles the graph, nodes, and drag interactions.dashboard/: Handles the HUD, suggestions, and analysis feedback.
- Language: Haskell ๐.
- Role: The "Brain". Handles heavy computational logic:
- Calculating Closures of Functional Dependencies.
- Bernstein's Synthesis / BCNF Decomposition.
- Cycle Detection & Lossless Join verification.
- Build Tool: Stack / Cabal.
- Node.js (v18+)
- Haskell Stack (for the server) OR Cabal.
The server runs the normalization algorithms.
cd server
# Build and run with Stack (Recommended)
stack build
stack run
# The server typically runs on localhost:8080 or port 3000 (check console output)The client provides the visual interface.
cd client
npm install
npm run dev
# Open http://localhost:3000 to use Closure.- Draft Your Schema:
- Use the Canvas to create tables.
- Add Attributes (columns) and Functional Dependencies (FDs) (rules like
zip_code -> city).
- Analyze:
- Click "Analyze Workspace" in the Dashboard.
- Closure sends your schema to the Haskell engine.
- It returns:
- Health Score: Identifying BCNF/3NF violations.
- Suggestions: Intelligent merges or splits.
- Warnings: Potential anomalies.
- Optimize:
- Select a strategy:
- BCNF (Strict): Maximum consistency, no redundancy. Best for write-heavy apps.
- 3NF (Balanced): Standard industry target. Allows minor redundancy for convenience.
- Performance (Speed): Prioritizes Read Speed (denormalization). Allows redundancy to reduce JOINs, ideal for analytics or high-traffic read APIs.
- Let Closure automatically decompose your tables based on your choice.
- Select a strategy:
- Export:
- Export the result as production-ready SQL.