An interactive, production-grade educational platform designed to demystify the core pillars of database transactions. ACID Lab visualizes complex data operations through real-time simulations, interactive narrations, and crash-recovery scenarios.
Ensures that a transaction is treated as a single "unit," which either completely succeeds or completely fails.
- Scenario: Bank transfer from Person A to Person B.
- Visuals: Step-by-step checklist and transactional boundary visualization.
- Failure Demo: Watch the system trigger an automatic Rollback during a simulated network crash.
Guarantees that a transaction only brings the database from one valid state to another, maintaining all predefined rules.
- Constraints: Non-negative balances, minimum deposit requirements, and daily withdrawal limits.
- Narrator: Real-time feedback explaining exactly why a transaction was rejected.
Controls how transaction integrity is visible to other users and systems.
- Simulation: Run concurrent transactions with varying isolation levels.
- Anomalies: Visualize Dirty Reads, Non-Repeatable Reads, and Phantom Reads.
- Levels: Supports Read Uncommitted, Read Committed, Repeatable Read, and Serializable.
Ensures that once a transaction has been committed, it will remain committed even in the case of a system failure.
- Mechanism: Demonstrates Write-Ahead Logging (WAL).
- Crash Test: Simulate a system reboot at different stages (In-Memory, WAL-Logged, Persisted to Disk).
- Recovery: Observe the database "replay" the log to restore data post-crash.
The simulator uses a deterministic state-machine approach to mimic database internals:
- Transaction Manager: Orchestrates the phases (Begin, Execute, Commit/Abort).
- Simulation Engine: Introduces artificial delays (
STEP_DELAY = 5000ms) to make internal operations visible. - Virtual Disk: A reactive state layer that separates "In-Memory" buffer states from "Persisted" disk states.
- Narrator Engine: A context-aware notification system that provides educational commentary for every state change.
- 🎓 Students: Visualizing abstract concepts from database textbooks.
- 💻 Developers: Understanding the trade-offs between different isolation levels.
- 🏫 Educators: A shared platform for demonstrating transaction anomalies in class.
- 📋 Interview Prep: Mastering the technical nuances of ACID properties for system design interviews.
- Node.js (v20+)
- npm / pnpm / yarn
# 1. Clone the Repository
git clone https://github.com/rajanand/acid-properties.git
cd acid-properties
# 2. Install Dependencies
npm install
# 3. Start Development Server
npm run devOpen http://localhost:3000 to view the simulator.
If you experience 404 errors on localhost after checking out the project, ensure you are running in a development environment. The next.config.ts is configured to use a basePath only in production:
// next.config.ts
const isProd = process.env.NODE_ENV === "production";
const nextConfig = {
basePath: isProd ? "/acid-properties" : undefined,
// ...
};acid-properties/
├── .github/workflows/ # CI/CD Deployment scripts
├── public/ # High-quality assets & demos
├── src/
│ ├── app/ # Application Pages (App Router)
│ ├── components/ # UI components & Theme logic
│ └── lib/ # Simulation logic & Types
├── next.config.ts # Deployment-specific configuration
└── package.json # Scripts & Dependencies
Developed by Rajanand




