CDN Usage
Use ctrodb directly in the browser via script tag
Unpkg
<script src="https://unpkg.com/ctrodb@1.0.1/dist/index.global.js"></script>
<script>
const { Database } = CtroDB
const db = new Database({
schema: {
version: 1,
collections: {
notes: {
fields: {
text: { type: "string" },
},
},
},
},
})
await db.connect()
const notes = db.collection("notes")
await notes.create({ text: "Hello from CDN!" })
</script>
jsDelivr
<script src="https://cdn.jsdelivr.net/npm/ctrodb@1.0.1/dist/index.global.js"></script>
esm.sh (import maps)
For projects that use ES modules with import maps:
<script type="importmap">
{
"imports": {
"ctrodb": "https://esm.sh/ctrodb@1.0.2"
}
}
</script>
<script type="module">
import { Database } from "ctrodb"
const db = new Database({ schema: { version: 1, collections: { notes: { fields: { text: { type: "string" } } } } } })
await db.connect()
const notes = db.collection("notes")
await notes.create({ text: "Hello from esm.sh!" })
</script>
What works
- All features work from CDN
- IndexedDB adapter works in all modern browsers
- Memory adapter works everywhere
- The full bundle is ~25 KB gzip
See the CDN example for a complete todo app.
How is this guide?
Last updated on Jun 20, 2026