The introduction of WebContainers opened the possibility of using browsers to run all kinds of Node-based toolchains like Eleventy blogs, Docusaurus documentation, Nuxt / Next.js websites and more. These SSR/SSG solutions often rely on various markdown dialects as a source of their data – that is quite a convenient way of storing text after all.

While these types of read-only applications are incredibly common, having the possibility to connect to some kind of SQL database would enable new types of applications that need both read and write capabilities. This has been a top-requested feature, as it enables everything from todo apps to authentication systems.

That is why we are really excited to announce the experimental support for the SQLite database in WebContainers. What that means is, you can npm install it right now and use it directly, or via an ORM like Sequelize.

SQLite3 now supported in StackBlitz WebContainers

You can also work with it in a backend framework like Express!

Why is this useful? If you’re prototyping a new application that needs a database backend, this is perfect for that. And it’s all sandboxed inside your browser.

You can choose to either re-create the database whenever project loads (great e.g. for sharing demos), or persist the database file with the project:

At this point it's worth mentioning that while this polyfill is based on the amazing node-sqlite3 project it does not provide every feature that the original module offers. It is very fresh and experimental, but we just can't wait to see what you'll make with it!

Feel free to shoot us a tweet @stackblitz or jump into our Discord to share your thoughts and creations! ⚡️

Tomek Sułkowski

Founding Engineer & DevRel at StackBlitz. Let's talk about docs, live examples, teaching, and experimenting in browsers!

Recent Posts