dbcord is an experimental Discord-native database for portfolio and learning use.
- Guild = database instance
- Category = namespace
- Text channel = table or secondary index
- Message = row or index entry
- Attachment = large JSON blob or snapshot
- Thread = row history
- Discord guild search = query engine
This project intentionally uses Discord as the durable store. It does not use SQLite, Redis, or a local persistent index.
dbcord is a demo-quality experiment, not a production database.
- Only use it in dbcord-owned channels on a dedicated test guild
- Do not point it at normal conversations
- Do not use it for secrets, regulated data, or real workloads
- Search is eventually consistent because Discord search is eventually consistent
- Discord-native tables, rows, blobs, and secondary indexes
- Slash commands for init, CRUD, find, inspect, export, verify, reindex, vacuum, and snapshot
- Small schema validation stored in Discord catalog messages
- Blob rows backed by Discord attachments
- Best-effort row history via message threads
- Unit and engine tests that run without a live Discord server
dbcord-prod/
#dbc-catalog
#table-users
#table-posts
#idx-users-email
#idx-users-role
- Create a Discord application and bot in the Developer Portal.
- Invite the bot to a dedicated test server.
- Enable
Message Content Intentfor development. - Grant the bot at least:
View ChannelsSend MessagesRead Message HistoryAttach FilesManage ChannelsCreate Public ThreadsSend Messages in ThreadsManage Messagesfor vacuum and hard-delete experiments
macOS/Linux:
python -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
cp .env.example .env
python -m dbcordWindows PowerShell:
python -m venv .venv
.venv\Scripts\activate
python -m pip install -r requirements.txt
Copy-Item .env.example .env
python -m dbcord.env:
DISCORD_BOT_TOKEN=your-bot-token
DBCORD_GUILD_ID=your-test-guild-id/dbc_init database:prod
/dbc_table_create database:prod table:users pk:id
/dbc_schema_set database:prod table:users schema_json:{"required":["id","email"],"properties":{"id":"str","email":"str","role":"str"}}
/dbc_index_create database:prod table:users field:email unique:true
/dbc_insert database:prod table:users key:u_1 value_json:{"id":"u_1","email":"a@example.com","role":"student"}
/dbc_find database:prod table:users where_json:{"role":"student"}
/dbc_update database:prod table:users key:u_1 patch_json:{"role":"admin"}
/dbc_verify database:prod table:users
/dbc_snapshot database:prod table:users
Equality predicates become Discord search tokens.
{"role":"student","active":true}Range-like predicates are post-filters after candidate rows are fetched:
{"age":{"$gte":18,"$lt":30}}Supported post-filter operators:
$eq$ne$gt$gte$lt$lte$contains$in$exists$prefix
If a matching secondary index exists, find() searches the index channel first and falls back to table search when the index is temporarily stale or not yet searchable.
python -m pip install -e .[dev]
python -m pytestRecent local verification on April 30, 2026:
python -m pytestpassed- live Discord guild checks passed for init, schema, index, CRUD, blob row, history, verify, snapshot, reindex, and vacuum
This project depends on Discord APIs and privileged intent behavior that can change over time.
Search Guild MessagesrequiresREAD_MESSAGE_HISTORYand is restricted byMESSAGE_CONTENT- if you ever scale beyond small private testing, review Discord’s current Developer Terms, Developer Policy, and Message Content rules again
- this repository is best treated as an educational or portfolio experiment, not a platform product
Official references: