SurrealDB is designed to be run in many different ways, and environments. Due to the separation of the storage and compute layers, SurrealDB can be run in embedded mode, from within your JavaScript environments.
You can embed SurrealDB in both browser and server environments. In browser environments using the Wasm engine, SurrealDB can be run as an in-memory database, or it can persist data using IndexedDB. In server environments using the Node.js engine, SurrealDB can be run as an embedded database, backed by either an in-memory engine or SurrealKV.
In this document, we will cover how to embed SurrealDB in both browser and server environments.
In browser environments, using the Wasm engine, you can run SurrealDB in-memory or with IndexedDB persistence.
For more information on how to embed SurrealDB in browser environments, please see the Wasm engine documentation.
In server environments, you can use the Node.js engine to run SurrealDB as an embedded database.
For more information on how to embed SurrealDB in server environments, please see the Node.js engine documentation.