JSPM

workers-dbms

0.0.5
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q15872F
  • License MIT

Workers Database Management System for Durable Objects

Package Exports

  • workers-dbms
  • workers-dbms/dist/index.js
  • workers-dbms/dist/index.mjs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (workers-dbms) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

workers-dbms

Workers Database Management System for Durable Objects

Features

  • On demand SQLite databases (like neon.tech)
  • https endpoints to manage and query databases
  • Websocket endpoint to query databases

Connect apps outside Cloudflare to your database

The package django-d1 has an experimental backend to use the websocket endpoint to run django migrations and queries

Example usage in django:

DATABASES = {
    'default': {
        'ENGINE': 'django_d1.workers-dbms',
        'WORKERS_DBMS_ENDPOINT': 'wss://workers-dbms.workers.dev/api/v1/databases/django/websocket',
    }
}

Get started

npm install --save workers-dbms
npm install --save wrangler

Create a index.ts file with this:

import { generateApp } from "workers-dbms";
export { DBMSDO } from "workers-dbms";

export default generateApp()

Create a wrangler.toml file with this:

#:schema node_modules/wrangler/config-schema.json
name = "workers-dbms"
main = "index.ts"
compatibility_date = "2024-09-28"

[[durable_objects.bindings]]
name = "DBSM_DO"
class_name = "DBMSDO"

[[migrations]]
tag = "v1"
new_sqlite_classes = ["DBMSDO"]

Deploy your dbms with wrangler:

wrangler deploy

You can now access your dbms on the worker deployed url

There is also a swagger interface with all the endpoints documented at /api path.

Images

Home page homepage

Database details homepage

API Documentation with swagger homepage