Introducing WASI for IC

Hi @mycelia,
the main motivation is to enable running wasi-oriented projects (such as sqlite) in a canister. Since WASI is not supported directly by IC, the project helps to transform Wasm binaries. You can check out the introduction here and the project here.

5 Likes

@ulan thank you for that explanation.

icpp-pro does not enable writing to stable memory directly, so we should be good then.

I will add it to the docs though, to warn people not to implement something themselves to write to stable memory, and just use the standard file system.

1 Like

@sgaflv Amazing work! I managed to make your examples/ic-rusqlite work!

So, now weā€™re missing a good ORM that enables people to manage their database inside the canister, in order to onboard even more of the people that are used to traditional databases.
Iā€™ve found this old rusqlite-model implementation, which could act as reference to build a good ORM.
Iā€™d love to see libraries like SQLx to support wasm32-wasi, but it looks like itā€™s not that easy for them to add support for that target.

Furthermore, I also envision a future in which there will be a CLI tool that manages the canisterā€™s db migrations.

What do you think? Should we spend time investigating the efforts needed to build a good ORM on the IC?
Is this the direction we should take to spread the adoption of canisters?

3 Likes

First off, I think we should compile a version of sqlite with some sensible default settings to a wasm module and package it in a crate. A canister dev that wants to use SQLite should not have to setup clang etc.

For SQLx, did you have a look at the wasi version?

https://crates.io/crates/sqlx_wasi

1 Like

Definitely agree, but this should be part of a plug and play CDK (C for Canister, as we are used to)/ORM that helps you to maintain the db inside the canister. I guess no one (and for ā€œno oneā€ I mean medium to big projects) would like to write migrations and queries in raw SQL manually.

I was looking at the work done by WasmEdge and it looks great. I see a lot of points in common with the Internet Computer that we should explore, especially when they talk about things like Serverless SaaS Functions, for which the IC is the perfect match in my opinion.
Unfortunately, it doesnā€™t look like sqlx_wasi is maintained anymore (last release 2 years ago).

3 Likes