{"id":48380814,"url":"https://github.com/veeso/wasm-dbms","last_synced_at":"2026-04-05T20:02:22.089Z","repository":{"id":323914525,"uuid":"1095275459","full_name":"veeso/wasm-dbms","owner":"veeso","description":"IC DBMS Canister is an Internet Computer framework which provides an easy way to implement a database canister by just providing the database schema.","archived":false,"fork":false,"pushed_at":"2026-03-27T09:34:09.000Z","size":3969,"stargazers_count":3,"open_issues_count":5,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-27T09:43:01.181Z","etag":null,"topics":["canister","dfinity","icp","internet-computer"],"latest_commit_sha":null,"homepage":"https://wasm-dbms.cc","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/veeso.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"veeso","liberapay":"veeso"}},"created_at":"2025-11-12T20:42:37.000Z","updated_at":"2026-03-27T09:10:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"d95e0383-0d1b-4900-8a31-21e49b584990","html_url":"https://github.com/veeso/wasm-dbms","commit_stats":null,"previous_names":["veeso/ic-dbms-canister","veeso/ic-dbms","veeso/wasm-dbms"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/veeso/wasm-dbms","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veeso%2Fwasm-dbms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veeso%2Fwasm-dbms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veeso%2Fwasm-dbms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veeso%2Fwasm-dbms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/veeso","download_url":"https://codeload.github.com/veeso/wasm-dbms/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veeso%2Fwasm-dbms/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31448216,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T15:22:31.103Z","status":"ssl_error","status_checked_at":"2026-04-05T15:22:00.205Z","response_time":75,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["canister","dfinity","icp","internet-computer"],"created_at":"2026-04-05T20:02:15.896Z","updated_at":"2026-04-05T20:02:21.416Z","avatar_url":"https://github.com/veeso.png","language":"Rust","funding_links":["https://github.com/sponsors/veeso","https://liberapay.com/veeso"],"categories":[],"sub_categories":[],"readme":"# WASM DBMS\n\n![logo](https://wasm-dbms.cc/logo-128.png)\n\n[![license-mit](https://img.shields.io/crates/l/wasm-dbms.svg?logo=rust)](https://opensource.org/licenses/MIT)\n[![repo-stars](https://img.shields.io/github/stars/veeso/wasm-dbms?style=flat)](https://github.com/veeso/wasm-dbms/stargazers)\n[![downloads](https://img.shields.io/crates/d/wasm-dbms.svg?logo=rust)](https://crates.io/crates/wasm-dbms)\n[![latest-version](https://img.shields.io/crates/v/wasm-dbms.svg?logo=rust)](https://crates.io/crates/wasm-dbms)\n[![conventional-commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196?logo=conventionalcommits\u0026logoColor=white)](https://conventionalcommits.org)\n\n[![ci](https://github.com/veeso/wasm-dbms/actions/workflows/ci.yml/badge.svg)](https://github.com/veeso/wasm-dbms/actions)\n[![coveralls](https://coveralls.io/repos/github/veeso/wasm-dbms/badge.svg)](https://coveralls.io/github/veeso/wasm-dbms)\n[![docs](https://docs.rs/wasm-dbms/badge.svg?logo=rust)](https://docs.rs/wasm-dbms)\n\nAn embeddable relational database engine written in Rust, designed to run inside WASM runtimes, with first-class support\nfor Internet Computer canisters.\n\n## Overview\n\nThis repository contains three crate families:\n\n- **wasi-dbms**: Crates for building a DBMS on any WASM runtime that supports WASI (Wasmtime, Wasmer, WasmEdge)\n- **wasm-dbms** - A runtime-agnostic DBMS engine that runs on any WASM runtime (Wasmtime, Wasmer, WasmEdge, IC)\n- **ic-dbms** - A thin IC-specific adapter that provides Internet Computer canister integration\n\n### Crate Architecture\n\n| Crate              | Description                                                 |\n|--------------------|-------------------------------------------------------------|\n| `wasm-dbms-api`    | Shared types, traits, validators, sanitizers                |\n| `wasm-dbms-memory` | Memory abstraction and page management                      |\n| `wasm-dbms`        | Core DBMS engine with transactions, joins, integrity checks |\n| `wasm-dbms-macros` | Procedural macros: `Encode`, `Table`, `CustomDataType`      |\n| `wasi-dbms-memory` | Memory provider implementations for WASI runtimes           |\n| `ic-dbms-api`      | IC-specific types (re-exports `wasm-dbms-api`)              |\n| `ic-dbms-canister` | IC canister DBMS implementation                             |\n| `ic-dbms-macros`   | IC-specific macro: `DbmsCanister`                           |\n| `ic-dbms-client`   | Client libraries for canister interaction                   |\n\n## Quick Start (Generic)\n\nDefine your database schema using Rust structs with derive macros:\n\n```rust\nuse wasm_dbms_api::prelude::*;\n\n#[derive(Debug, Table, Clone, PartialEq, Eq)]\n#[table = \"users\"]\npub struct User {\n    #[primary_key]\n    pub id: Uint32,\n    #[sanitizer(TrimSanitizer)]\n    #[validate(MaxStrlenValidator(100))]\n    pub name: Text,\n    #[validate(EmailValidator)]\n    pub email: Text,\n}\n```\n\nWire tables together with the `DatabaseSchema` macro and use the `Database` trait:\n\n```rust\nuse wasm_dbms::prelude::*;\nuse wasm_dbms_api::prelude::*;\n\n#[derive(DatabaseSchema)]\n#[tables(User = \"users\")]\npub struct MySchema;\n\n// Create a database context with any MemoryProvider\nlet ctx = DbmsContext::new(HeapMemoryProvider::default());\nMySchema::register_tables(\u0026ctx)?;\n\nlet database = WasmDbmsDatabase::oneshot(\u0026ctx, MySchema);\n\n// Insert\ndatabase.insert::\u003cUser\u003e(UserInsertRequest {\n    id: 1.into(),\n    name: \"Alice\".into(),\n    email: \"alice@example.com\".into(),\n})?;\n\n// Query\nlet users = database.select::\u003cUser\u003e(Query::builder().all().build())?;\n```\n\nThe `MemoryProvider` trait abstracts storage — use `HeapMemoryProvider` for testing, `FileMemoryProvider` for\nWasmtime/WASI, or implement your own for any WASM runtime.\n\n### Component Model (WIT)\n\nwasm-dbms can be exposed as a [WebAssembly Component](https://component-model.bytecodealliance.org/) via a WIT\ninterface (`/wit/dbms.wit`), making it accessible from any Component Model host — Go, Python, JavaScript, or any\nlanguage with Component Model tooling. See the [Wasmtime example](https://wasm-dbms.cc/guides/wasmtime-example.html)\nand the reference implementation in `crates/wasm-dbms/example/`.\n\n## Quick Start (IC Canister)\n\nDefine your database schema using Rust structs:\n\n```rust\nuse candid::CandidType;\nuse ic_dbms_api::prelude::{Text, Uint32};\nuse ic_dbms_canister::prelude::{DatabaseSchema, DbmsCanister, Table};\nuse serde::Deserialize;\n\n#[derive(Debug, Table, CandidType, Deserialize, Clone, PartialEq, Eq)]\n#[table = \"users\"]\npub struct User {\n    #[primary_key]\n    id: Uint64,\n    #[sanitizer(ic_dbms_api::prelude::TrimSanitizer)]\n    #[validate(ic_dbms_api::prelude::MaxStrlenValidator(20))]\n    name: Text,\n    #[validate(ic_dbms_api::prelude::EmailValidator)]\n    email: Text,\n    age: Nullable\u003cUint32\u003e,\n}\n```\n\nDefine relationships between tables:\n\n```rust\n#[derive(Debug, Table, CandidType, Deserialize, Clone, PartialEq, Eq)]\n#[table = \"posts\"]\npub struct Post {\n    #[primary_key]\n    id: Uint32,\n    title: Text,\n    content: Text,\n    #[foreign_key(entity = \"User\", table = \"users\", column = \"id\")]\n    author: Uint32,\n}\n```\n\n\u003e [!NOTE]\n\u003e Deriving `CandidType`, `Deserialize` and `Clone` is required for IC canister tables.\n\nInstantiate the database canister:\n\n```rust\n#[derive(DatabaseSchema, DbmsCanister)]\n#[tables(User = \"users\", Post = \"posts\")]\npub struct IcDbmsCanisterGenerator;\n```\n\nThis generates a fully functional database canister with all CRUD operations.\n\n## Generated Canister API\n\n```candid\nservice : (IcDbmsCanisterArgs) -\u003e {\n  acl_add_principal : (principal) -\u003e (Result);\n  acl_allowed_principals : () -\u003e (vec principal) query;\n  acl_remove_principal : (principal) -\u003e (Result);\n  begin_transaction : () -\u003e (nat);\n  commit : (nat) -\u003e (Result);\n  delete_posts : (DeleteBehavior, opt Filter_1, opt nat) -\u003e (Result_1);\n  delete_users : (DeleteBehavior, opt Filter_1, opt nat) -\u003e (Result_1);\n  insert_posts : (PostInsertRequest, opt nat) -\u003e (Result);\n  insert_users : (UserInsertRequest, opt nat) -\u003e (Result);\n  rollback : (nat) -\u003e (Result);\n  select_posts : (Query, opt nat) -\u003e (Result_2) query;\n  select_users : (Query_1, opt nat) -\u003e (Result_3) query;\n  update_posts : (PostUpdateRequest, opt nat) -\u003e (Result_1);\n  update_users : (UserUpdateRequest, opt nat) -\u003e (Result_1);\n}\n```\n\n### ACL Management\n\n- `acl_add_principal(principal)`: Adds a principal to the ACL.\n- `acl_allowed_principals()`: Returns the list of principals in the ACL.\n- `acl_remove_principal(principal)`: Removes a principal from the ACL.\n\n### Transaction Management\n\n- `begin_transaction()`: Starts a new transaction and returns its ID.\n- `commit(transaction_id)`: Commits the transaction with the given ID.\n- `rollback(transaction_id)`: Rolls back the transaction with the given ID.\n\n### Data Manipulation\n\nFor each table defined in the schema:\n\n- `insert_\u003ctable_name\u003e(records, transaction_id)`: Inserts records into the specified table.\n- `select_\u003ctable_name\u003e(query, transaction_id)`: Selects records from the specified table.\n- `update_\u003ctable_name\u003e(updates, transaction_id)`: Updates records in the specified table.\n- `delete_\u003ctable_name\u003e(delete_behavior, filter, transaction_id)`: Deletes records from the specified table.\n\n## Getting Started\n\nSee the [Getting Started Guide](https://wasm-dbms.cc/guides/get-started.html) for more information on how to setup and\ndeploy the DBMS canister.\n\n## Interacting with the Canister\n\nSee the [ic-dbms-client](./crates/ic-dbms/ic-dbms-client/README.md) for more information on how to interact with the\ncanister.\n\n## Features\n\n- [x] Define tables with common attributes\n- [x] CRUD operations\n- [x] Complex queries with filtering and pagination\n- [x] Relationships between tables with foreign keys\n- [x] Transactions with commit and rollback\n- [x] Access Control Lists (ACL) to restrict access to the database\n- [x] Validation, Sanitizers and constraints on table columns\n- [x] JOIN operations between tables\n- [x] Custom data types\n- [x] Runtime-agnostic core (wasm-dbms) for any WASM runtime\n- [x] Indexes for faster queries\n- [ ] Migrations to update the database schema on canister upgrades\n- [ ] SQL query support\n\n## Documentation\n\nRead the documentation at \u003chttps://wasm-dbms.cc\u003e\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fveeso%2Fwasm-dbms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fveeso%2Fwasm-dbms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fveeso%2Fwasm-dbms/lists"}