Instead of connecting to a remote server, you can run SurrealDB directly inside your application process. Embedded mode gives you the full query engine with no network overhead, which is useful for local-first applications, edge deployments, and testing.
Embedding languages
The following languages are supported:
The Swift and Kotlin SDKs, which cover iOS and Android apps, connect to a SurrealDB server over HTTP or WebSocket, and do not run a database inside the app.
Browser embedding options
When embedding SurrealDB in web browsers, you have two options:
IndexedDB: SurrealDB can be configured to use IndexedDB to store and persist data within the web browser. SurrealDB first serialises both keys and values into a Uint8Array and uses IndexedDB as a binary key-value store. This gives good performance, and all of the functionality that SurrealDB offers when it runs in other ways.
SDK: Alternatively, you can use the SurrealDB SDK to connect to a remote SurrealDB instance instead of using IndexedDB for local persistence.
Embedding in a browser uses the JavaScript SDK's WebAssembly engine (@surrealdb/wasm). It connects with mem:// for an in-memory database or indxdb:// for IndexedDB persistence, and can run inside a Web Worker so that queries do not block the page. Embedded engines shows both setups.
Storage
Storage engines - which engine an embedded database can use, and what each gives up