ShelfDB usage
Use ShelfDB in one of two modes:
- Remote client/server: start
shelfdb server, connect withshelfdb.client.Client, open async transactions, and end remote reads or writes withawait ...query(). - Local direct DB: open
shelfdb.shelf.DB(...), use local transactions, and run queries directly without.query().
Core rules
- Prefer the remote client flow for application code and flexible deployment.
- Use local DB access only when the process can open the database directly.
- For remote usage, remember: builder methods do nothing until
await .query(). - For local usage, do not add
.query(); local operations run directly. - Use
client.transaction()for reads andclient.transaction(write=True)for mutations. - Close remote clients with
await client.close(). - Start the server with
shelfdb server; default URL istcp://127.0.0.1:31337and default DB path isdb.
Read the bundled docs for details
Read the skill-local docs under ai-skill/shelfdb-usage/docs/ as needed:
docs/index.md— overview, fit, and navigationdocs/usage/installation.md— install and CLI verificationdocs/usage/server.md— server startup and URL formatsdocs/usage/remote.md— async client usage and.query()behaviordocs/usage/local.md— direct local DB usagedocs/api/index.md— API reference indexdocs/api/client.md— remote client APIdocs/api/local.md— local DB APIdocs/api/cli.md— CLI reference
Practical guidance
- If the user asks for app code that talks to a running ShelfDB instance, use the remote client API.
- If the user asks for simple in-process storage examples, use
DB(...)and local transactions. - If the user is confused about why nothing happens remotely, check whether
.query()is missing. - If the user needs a server command example, prefer
shelfdb server --db-path ./db --url tcp://127.0.0.1:31337unless they need a Unix socket.
Source: keenlycode/shelfdb — distributed by TomeVault.