An interactive web-based demonstration of DriftDB's time-travel database capabilities. Experience querying data at any point in time through an intuitive SQL editor with a visual time-travel slider.
- Time-Travel Slider: Visually navigate through database history
- SQL Editor: Write and execute queries in real-time
- Multiple Datasets: Switch between e-commerce, user management, and inventory scenarios
- Example Queries: Pre-built queries to showcase time-travel capabilities
- Real-Time Results: Instant query execution with formatted table display
- Mock Data Mode: Works standalone without requiring a DriftDB server
- Responsive Design: Works on desktop and mobile devices
Just open index.html in your web browser:
# From the demo directory
open index.html
# or
firefox index.html
# or
chrome index.htmlThe demo runs entirely in your browser with no dependencies!
Using Node.js:
# From the demo directory
node server.js 8080
# Then open http://localhost:8080 in your browserUsing Python:
# Python 3
python3 -m http.server 8080
# Python 2
python -m SimpleHTTPServer 8080
# Then open http://localhost:8080 in your browser# From your repository root
git add demo/
git commit -m "Add interactive demo"
git push
# Enable GitHub Pages in repository settings
# Source: main branch, /demo folder
# Your demo will be at: https://yourusername.github.io/driftdb/The slider at the top lets you query data at different points in time:
- Drag the slider to select a sequence number (1-10)
- See the timestamp update to show when that data existed
- Run queries to see results at that point in time
Write standard SQL queries:
-- View all orders
SELECT * FROM orders
-- Filter by status
SELECT * FROM orders WHERE status = 'shipped'
-- High-value orders
SELECT * FROM orders WHERE amount > 100
-- Specific customer
SELECT * FROM orders WHERE customer_name = 'Alice Johnson'Keyboard Shortcuts:
Ctrl+Enter- Run queryFormat SQLbutton - Auto-format your SQL
Click any example query in the sidebar to:
- Load the query into the editor
- Automatically execute it
- See results instantly
Switch between datasets using the dropdown:
- E-Commerce Orders: Order lifecycle (pending → paid → shipped → delivered)
- User Management: User status and role changes over time
- Inventory Tracking: Stock quantity changes
- Select the "E-Commerce Orders" dataset
- Set time slider to sequence 3 (early time)
- Run:
SELECT * FROM orders WHERE id = 1 - Observe: Order status is "pending"
- Move slider to sequence 8 (later time)
- Run the same query
- Observe: Order status is now "delivered"
What you learn: How DriftDB tracks changes over time
- Start at sequence 1 (earliest)
- Run:
SELECT * FROM orders WHERE status = 'cancelled' - Result: 0 rows (no cancelled orders yet)
- Move to sequence 6
- Run the same query
- Result: 1 row (order was cancelled at this point)
What you learn: Pinpoint exactly when changes occurred
Imagine a customer complains: "My order was marked delivered but I never received it!"
- Query their order at current time:
SELECT * FROM orders WHERE customer_id = 101 - Use time-travel to see order history at different points
- Find when status changed to "delivered"
- Cross-reference with shipping logs to investigate
What you learn: How time-travel helps with debugging
demo/
├── index.html # Main demo page
├── demo.js # Interactive demo logic
├── server.js # Optional HTTP server
└── README.md # This file
- Mock Database: Generates realistic sample data with 10 sequence numbers
- Time-Travel Logic: Queries return data as it existed at the selected sequence
- SQL Parser: Simple parser supporting SELECT, WHERE, and basic operators
- Pure JavaScript: No frameworks or dependencies required
SELECT * FROM tableSELECT column1, column2 FROM tableWHEREconditions:- Equality:
column = 'value' - Inequality:
column != 'value' - Comparisons:
column > number,column < number,>=,<= - Logic:
AND,OR
- Equality:
COUNT(*)LIMIT n
Each dataset has 10 sequence numbers representing points in time:
Sequence 1 → Sequence 2 → ... → Sequence 10
(oldest) (latest/now)
Data evolves over time:
- Orders change status
- Users get promoted to different roles
- Inventory quantities decrease
The demo currently runs in mock mode. To connect to a real DriftDB server:
// In demo.js, add DriftDB client connection
class DriftDBClient {
constructor(host, port) {
this.host = host;
this.port = port;
}
async query(sql, asOfSeq) {
const response = await fetch('/api/query', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ sql, asOfSeq })
});
return response.json();
}
}Then update the connection mode selector to switch between mock and real data.
In demo.js, add a new dataset generator:
generateYourData() {
const history = [];
for (let seq = 1; seq <= 10; seq++) {
const data = [
{ id: 1, name: 'Item 1', value: seq * 10 },
// ... your data
];
history.push({
seq: seq,
timestamp: new Date(Date.now() - (10 - seq) * 3600000),
data: data
});
}
return history;
}Edit the CSS in index.html:
/* Change color scheme */
header {
background: linear-gradient(135deg, #your-color1, #your-color2);
}
.btn-primary {
background: #your-primary-color;
}Works on any static file host:
- GitHub Pages (free)
- Netlify (free)
- Vercel (free)
- AWS S3 + CloudFront
- Google Cloud Storage
- Azure Static Web Apps
Create Dockerfile:
FROM nginx:alpine
COPY demo/ /usr/share/nginx/html/
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]Build and run:
docker build -t driftdb-demo .
docker run -p 8080:80 driftdb-demoDeploy as a serverless function:
// AWS Lambda, Google Cloud Functions, etc.
exports.handler = async (event) => {
const html = fs.readFileSync('index.html', 'utf8');
return {
statusCode: 200,
headers: { 'Content-Type': 'text/html' },
body: html
};
};- ✅ Chrome 90+
- ✅ Firefox 88+
- ✅ Safari 14+
- ✅ Edge 90+
Note: Requires ES6 support (class syntax, arrow functions, etc.)
- Load time: < 1 second
- Query execution: < 100ms (mock data)
- Memory usage: < 10MB
- No external dependencies: 100% self-contained
Issue: Blank page or console errors
Solution:
- Check browser console (F12) for errors
- Ensure JavaScript is enabled
- Try a different browser
- Use HTTP server instead of file:// protocol
Issue: Moving slider doesn't update results
Solution:
- Click "Run Query" button after moving slider
- Or use an example query to auto-execute
Issue: Query runs but no data displayed
Solution:
- Check the WHERE conditions match data
- Try simpler query:
SELECT * FROM orders - Move time slider to different sequence
Planned features for v2:
- Real DriftDB server connection
- Query history and favorites
- Export results to CSV/JSON
- Visual query builder (drag-and-drop)
- Diff view between two time points
- Query performance metrics
- Dark mode
- Collaborative queries (share URL)
- Syntax highlighting in SQL editor
- Auto-complete for table/column names
Want to improve the demo? Here's how:
- Report Issues: Open an issue on GitHub
- Submit PRs: Fork, make changes, submit pull request
- Add Datasets: Create interesting sample scenarios
- Improve UI: Better design, animations, accessibility
- Add Features: Implement items from the roadmap
MIT License - Same as DriftDB
Created by the DriftDB team to showcase time-travel database capabilities.
Special thanks to:
- All DriftDB contributors
- PostgreSQL community for SQL inspiration
- Users who provided feedback
Ready to try the real thing?
Install DriftDB:
cargo install driftdb-server
driftdb-server --data-path ./dataConnect with any PostgreSQL client and experience time-travel queries in your own data!
