Collaborative database operations inside Slack. Connects Slack slash commands and interactive approval cards to AutoDB so teams can ask questions, risk-check migrations, approve changes, and keep an audit trail without leaving the channel.
Built as a FastAPI + Slack Bolt bot with an optional live dashboard for migration activity.
- Install dependencies
pip install -r requirements.txt- Configure environment
Copy env.example to .env and fill in:
SLACK_BOT_TOKEN=xoxb-your-bot-token
SLACK_SIGNING_SECRET=your-signing-secret
AUTODB_API_KEY=adb_your-api-key
APPROVER_SLACK_ID=U1234567890
PORT=3000
HOST=0.0.0.0- Run the bot
python3 slackdb_bot.py- Point Slack events to:
https://<your-domain>/slack/events
The app exposes a health check at /health and audit data at /audit.
docker compose up --buildThe compose file starts the SlackDB bot and includes optional PostgreSQL and Redis services for future state/caching work.
/db connect <id> - set the active AutoDB connection
/db connections - list available AutoDB connections
/db introspect - refresh schema metadata
/db query <question> - ask a database question in plain English
/db ask <question> - answer with generated SQL plus optimization hints
/db analyze <SQL> - risk-check a migration before execution
/db optimize <SQL> - get query performance suggestions
/db panic [token] - launch an emergency rollback flow
/db audit - show recent migration history
/db status - show bot, approver, and migration state
- A user runs
/db analyze <SQL>. - SlackDB sends the SQL to AutoDB for risk scoring and rollback analysis.
- SlackDB posts an interactive Slack card with risk category, affected tables, rollback availability, and action buttons.
- Low-risk changes can be approved directly. High-risk changes can require a configured approver.
- Approved migrations execute through AutoDB and are written to the in-memory audit log.
- SlackDB polls execution status and posts completion/failure updates in-thread.
dashboard.html is a read-only live view for the audit API. It visualizes:
- total migrations
- pending approvals
- average risk score
- success rate
- recent migration feed
- risk distribution
- team activity
- daily approved/rejected activity
Open it alongside the running API and set its API base if needed.
slackdb_bot.py - FastAPI app, Slack command router, AutoDB client, approvals
dashboard.html - live audit dashboard powered by /audit
mockup.html - static Slack-style visual mockup
requirements.txt - Python dependencies
env.example - required environment variables
Dockerfile - container image for the bot
docker-compose.yml - bot plus optional Postgres/Redis services
Procfile - platform deployment entrypoint
vercel.json - deployment configuration
SlackDB keeps runtime state in memory in the current version: active connections, pending approvals, and audit entries reset when the process restarts. The compose file already sketches PostgreSQL and Redis as natural next steps for durable state and caching.