Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Choose the package for your app's runtime:
| Runtime | Package | Setup |
| --- | --- | --- |
| React Native | `react-native-nitro-sqlite` | [React Native guide](docs/content/docs/react-native/index.mdx) |
| NitroUI | `nitro-sqlite` | [NitroUI guide](docs/content/docs/nitro-ui/index.mdx). Pre-release source with local archive and checkout installation. |
| NitroUI | `nitro-sqlite` | [NitroUI guide](docs/content/docs/nitro-ui/index.mdx) |

Both runtimes support [Drizzle ORM](docs/content/docs/integrations/orms/drizzle.mdx), [TypeORM](docs/content/docs/integrations/orms/typeorm.mdx), [MikroORM](docs/content/docs/integrations/orms/mikro-orm.mdx), [Kysely](docs/content/docs/integrations/orms/kysely.mdx), and [vector search](docs/content/docs/integrations/vector-search.mdx) through optional companion packages.

Expand All @@ -27,22 +27,20 @@ Both runtimes support [Drizzle ORM](docs/content/docs/integrations/orms/drizzle.
| Kysely | `react-native-nitro-sqlite-kysely` | `nitro-sqlite-kysely` |
| Vector search | `react-native-nitro-sqlite-vec` | `nitro-sqlite-vec` |

These pre-release companion packages use the matching SQLite adapter for the same host. Install them from local archives after preparing the source checkout. See the [ORM setup guide](docs/content/docs/integrations/orms/index.mdx). The TypeORM export in each SQLite adapter remains available for compatibility and is deprecated in favor of its companion package.
Each companion uses the SQLite adapter for the same host. Install it from the `alpha` tag with an exact version, like the adapter. See the [ORM setup guide](docs/content/docs/integrations/orms/index.mdx). The TypeORM export in each SQLite adapter remains available for compatibility and is deprecated in favor of its companion package.

Read [Supported platforms](docs/content/docs/supported-platforms.mdx) for platform status, runtime versions, and integration limits. The React Native documentation is also available at [sqlite.margelo.com](https://sqlite.margelo.com/docs).

If you use a coding agent, give it the [NitroSQLite skill](https://github.com/margelo/react-native-skills/blob/main/skills/react-native-nitro-sqlite/SKILL.md). It links to focused guidance for connections, queries, transactions, concurrency, and migration. See the [AI agent guide](https://sqlite.margelo.com/docs/guides/ai-agents) for what to check in generated code.

Published React Native releases remain available, including 10.x and the `nitro-v1` prereleases. The instructions below install this source checkout from local archives. Its React Native package versions remain provisional. Use the documentation for your installed release when staying on an existing version.

## React Native installation

The Nitro V1 prerelease requires React Native 0.88 or newer. iOS requires a deployment target of 16.0 or later, Swift Package Manager, and Xcode with Swift 6.4 or newer.
The 11.0.0 alpha installs from the `alpha` tag and requires React Native 0.88 or newer. iOS requires a deployment target of 16.0 or later, Swift Package Manager, and Xcode with Swift 6.4 or newer. Stable 10.x stays on the `latest` tag.

Prepare the source checkout and build the SQLite archive from `packages/react-native-nitro-sqlite` with its packing script. The packing step prints the archive filename with its recorded package version. Replace `VERSION` below with that version and install it in your app:
Save an exact version. npm otherwise saves `^11.0.0-alpha.0`, and that range also matches the older `11.0.0-nitro-v1.x` builds:

```sh
npm install /path/to/react-native-nitro-sqlite-VERSION.tgz react-native-nitro-modules@1.0.0-alpha.nightly.138.g43e09c161101
npm install --save-exact react-native-nitro-sqlite@alpha react-native-nitro-modules@1.0.0-alpha.nightly.138.g43e09c161101
```

For iOS, follow the [React Native SwiftPM setup](https://sqlite.margelo.com/docs/configuration/ios#set-up-swift-package-manager), including the steps for keeping other CocoaPods, or the [Expo prebuild setup](https://sqlite.margelo.com/docs/configuration/expo#generate-and-rebuild).
Expand Down
6 changes: 4 additions & 2 deletions docs/content/docs/configuration/expo.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Configure optional native SQLite features during Expo prebuild and

SQLite compiles optional modules into the native library. FTS5 adds full-text indexes, while sqlite-vec adds vector search. Changing these modules requires a native rebuild; a JavaScript update cannot enable them.

Use Expo SDK 58 for the Nitro V1 prerelease. Its native runtime requires React Native 0.88 or newer and uses Swift Package Manager on iOS. Nitro SQLite autolinks without a config plugin. Add the plugins to change SQLite settings during prebuild. The repository tests these prebuild transformations on Expo SDKs 55 through 58. Run your app in a development or production build because Expo Go does not include Nitro SQLite.
Use Expo SDK 58 for the 11.0.0 alpha. Its native runtime requires React Native 0.88 or newer and uses Swift Package Manager on iOS. Nitro SQLite autolinks without a config plugin. Add the plugins to change SQLite settings during prebuild. The repository tests these prebuild transformations on Expo SDKs 55 through 58. Run your app in a development or production build because Expo Go does not include Nitro SQLite.

## Configure SQLite

Expand Down Expand Up @@ -42,9 +42,11 @@ Shared settings such as `threadSafe`, `performanceMode`, and `enableRTree` still
Install the companion package and add its plugin:

```sh
npx expo install react-native-nitro-sqlite-vec@nitro-v1
npx expo install react-native-nitro-sqlite-vec@alpha -- --save-exact
```

Expo passes the arguments after `--` to your package manager, so the exact version is saved. With Yarn or Bun, use `-- --exact`.

```json
{
"expo": {
Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/configuration/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The `react-native-nitro-sqlite` build reads `nitroSQLite` in your app's `package
}
```

All values are booleans. Rebuild the native app on every platform after changing them. On iOS with the Nitro V1 prerelease, delete `~/Library/Caches/org.swift.swiftpm/manifests` before rebuilding so Swift Package Manager reads the new settings. On macOS and visionOS with Nitro SQLite 10.x, install Pods again before rebuilding.
All values are booleans. Rebuild the native app on every platform after changing them. On iOS with the 11.0.0 alpha, delete `~/Library/Caches/org.swift.swiftpm/manifests` before rebuilding so Swift Package Manager reads the new settings. On macOS and visionOS with Nitro SQLite 10.x, install Pods again before rebuilding.

## Thread safety

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/configuration/macos.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Installation, database storage, and Apple build options.

Use Nitro SQLite 10.x and Nitro Modules 0.37.2 in a CocoaPods-based React Native macOS app. The 10.x SQLite pod declares macOS 10.15, and the app must also meet the minimums of React Native macOS and Xcode. React Native macOS 0.81 and 0.83 both require macOS 14.

The Nitro V1 prerelease requires React Native 0.88 or later. React Native macOS 0.83 lacks JSI APIs that Nitro V1 uses.
The 11.0.0 alpha requires React Native 0.88 or later. React Native macOS 0.83 lacks JSI APIs that Nitro V1 uses.

Install the 10.x packages, then install Pods and rebuild:

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/guides/migrate-from-quick-sqlite.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This guide covers React Native apps. NitroUI apps use a different host package;

```sh
npm uninstall react-native-quick-sqlite
npm install react-native-nitro-sqlite@nitro-v1 react-native-nitro-modules@1.0.0-alpha.nightly.138.g43e09c161101
npm install --save-exact react-native-nitro-sqlite@alpha react-native-nitro-modules@1.0.0-alpha.nightly.138.g43e09c161101
npx react-native spm
```

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/guides/standalone-review.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ description: Find the NitroUI installation and first-query guides.

Nitro SQLite runs on NitroUI through `nitro-sqlite`. The adapter uses the shared SQLite implementation and API without React Native.

Start with [Install on NitroUI](/docs/nitro-ui) for the source checkout and local archive paths. Then [run your first query](/docs/nitro-ui/first-query).
Start with [Install on NitroUI](/docs/nitro-ui) to install the adapter from npm or run the repository example. Then [run your first query](/docs/nitro-ui/first-query).

The [supported platforms page](/docs/supported-platforms) lists the runtime versions and OS coverage. The [shared API reference](/api) describes the database operations.
2 changes: 1 addition & 1 deletion docs/content/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ SQLite stores your data in a local file. Opening a connection creates the file w

The packages use different Nitro versions and generated bindings. Choose the package for your app's runtime. See [supported platforms](/docs/supported-platforms) for OS coverage and version requirements.

The NitroUI adapter is available through the source checkout or a locally packed archive. Its installation guide covers both paths.
Both packages install from the `alpha` npm tag as 11.0.0 alpha releases. Stable 10.x stays on the `latest` tag and supports React Native only.

## Use the shared docs

Expand Down
12 changes: 11 additions & 1 deletion docs/content/docs/integrations/orms/drizzle.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,17 @@ Install `drizzle-orm` (0.45.4 or a later 0.x release) alongside the driver and S
| [React Native](/docs/react-native) | `react-native-nitro-sqlite-drizzle` | `react-native-nitro-sqlite` |
| [NitroUI](/docs/nitro-ui) | `nitro-sqlite-drizzle` | `nitro-sqlite` |

For this pre-release source, install the matching driver and SQLite archives from the checkout. The repository examples use the local packages.
Install both from the `alpha` tag with exact versions. In React Native:

```sh
npm install --save-exact react-native-nitro-sqlite@alpha react-native-nitro-sqlite-drizzle@alpha drizzle-orm@0.45.4
```

In NitroUI:

```sh
bun add --exact nitro-sqlite@alpha nitro-sqlite-drizzle@alpha drizzle-orm@0.45.4
```

## Open a database

Expand Down
29 changes: 12 additions & 17 deletions docs/content/docs/integrations/orms/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ For the difference between entity mapping and a typed query builder, see [How OR

## Installation

Follow [Getting Started](/docs) to install Nitro SQLite and Nitro Modules. Add the packages for your library below before rebuilding the native app.
Follow [Getting Started](/docs) to install Nitro SQLite and Nitro Modules. Add the packages for your library below before rebuilding the native app. The companions install from the `alpha` tag. Save them with exact versions, as described in [React Native installation](/docs/react-native#1-install-the-packages).

<OrmTabs section="install">

Expand All @@ -37,7 +37,7 @@ Follow [Getting Started](/docs) to install Nitro SQLite and Nitro Modules. Add t
Install Drizzle and its Nitro SQLite driver.

```sh
npm install react-native-nitro-sqlite-drizzle drizzle-orm@0.45.4
npm install --save-exact react-native-nitro-sqlite-drizzle@alpha drizzle-orm@0.45.4
```

</TabsContent>
Expand All @@ -51,7 +51,7 @@ npm install typeorm@1.1.2
npm install --save-dev babel-plugin-module-resolver @babel/plugin-transform-class-static-block
```

Nitro SQLite 10.4.0 includes the TypeORM driver in core. For releases that ship the standalone adapter, also run `npm install react-native-nitro-sqlite-typeorm` and [switch the driver import and Babel alias](/docs/integrations/orms/typeorm#install-the-separate-adapter).
The 11.0.0 alpha ships the driver as a separate companion. Also run `npm install --save-exact react-native-nitro-sqlite-typeorm@alpha` and [switch the driver import and Babel alias](/docs/integrations/orms/typeorm#install-the-separate-adapter). Nitro SQLite 10.4.0 includes the driver in core.

</TabsContent>

Expand All @@ -60,7 +60,7 @@ Nitro SQLite 10.4.0 includes the TypeORM driver in core. For releases that ship
Install the driver and its runtime dependencies. [Configure Metro, Babel, and Buffer](/docs/integrations/orms/mikro-orm#configure-metro-and-babel) before importing the ORM.

```sh
npm install react-native-nitro-sqlite-mikro-orm @mikro-orm/core@7.2.13 @mikro-orm/sql@7.2.13 kysely@0.29.9 @craftzdog/react-native-buffer@6.1.2 react-native-quick-base64@3.0.1 base64-js@1.5.1
npm install --save-exact react-native-nitro-sqlite-mikro-orm@alpha @mikro-orm/core@7.2.13 @mikro-orm/sql@7.2.13 kysely@0.29.9 @craftzdog/react-native-buffer@6.1.2 react-native-quick-base64@3.0.1 base64-js@1.5.1
```

</TabsContent>
Expand All @@ -70,31 +70,26 @@ npm install react-native-nitro-sqlite-mikro-orm @mikro-orm/core@7.2.13 @mikro-or
Install Kysely and its Nitro SQLite dialect.

```sh
npm install react-native-nitro-sqlite-kysely 'kysely@^0.29.9'
npm install --save-exact react-native-nitro-sqlite-kysely@alpha
npm install 'kysely@^0.29.9'
```

</TabsContent>

</OrmTabs>

## Install from a source checkout
## Install on NitroUI

Use a source checkout with its workspace dependencies installed. The NitroUI companion packages are source previews. For this checkout, build local archives of the SQLite adapter and companions for your host. The archive name contains the version in each package manifest.

From the package directory for your host and integration, build a local archive. For example:
NitroUI apps use the `nitro-sqlite-*` companions instead of the React Native companions, with the same ORM libraries as the installation tabs above. First [install the adapter](/docs/nitro-ui#add-the-adapter-to-an-existing-app), then add the companion from the `alpha` tag with an exact version. For example, for Kysely:

```sh
cd packages/integrations/nitro-ui/kysely
bun run pack
bun add --exact nitro-sqlite-kysely@alpha
bun add 'kysely@^0.29.9'
```

For the staged NitroUI package version, this produces `nitro-sqlite-kysely-11.0.0.tgz`. Use the corresponding `packages/integrations/react-native/kysely` directory for React Native. The ORM companions have the same packing entry point. For React Native Vec, run `bun pm pack` in `packages/integrations/react-native/vec` instead.

Install the archive into your app alongside the SQLite adapter for that host. For NitroUI, follow [adapter installation](/docs/nitro-ui#add-the-adapter-to-an-existing-app). For React Native, follow [React Native setup](/docs/react-native) and use the matching SQLite archive from this checkout.

A companion archive includes its shared implementation. Your app does not need `shared/orm`, `nitro-sqlite-core`, or `nitro-sqlite-drizzle-core` installed from a registry. If you install a package through a local directory instead of an archive, prepare it from the source checkout first.
Each companion package includes its shared implementation. Your app does not need `shared/orm`, `nitro-sqlite-core`, or `nitro-sqlite-drizzle-core`.

NitroUI apps also need the ORM libraries in the installation tabs above, using their `nitro-sqlite-*` companions instead of the React Native companions. MikroORM requires both its driver and Kysely companion archives. Its NitroUI [browser bundle and Buffer setup](/docs/integrations/orms/mikro-orm#configure-nitroui) uses JavaScript dependencies. React Native keeps its [native Buffer setup](/docs/integrations/orms/mikro-orm#react-native-buffer-options) or can use the shared JavaScript adapter.
MikroORM requires both its driver and Kysely companions. Its NitroUI [browser bundle and Buffer setup](/docs/integrations/orms/mikro-orm#configure-nitroui) uses JavaScript dependencies. React Native keeps its [native Buffer setup](/docs/integrations/orms/mikro-orm#react-native-buffer-options) or can use the shared JavaScript adapter.

## Usage

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/integrations/orms/kysely.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SQLite stores tables and indexes in a file on the device. [Kysely](https://kysel

## Install

The [companion installation guide](/docs/integrations/orms#kysely) lists the packages for each host. These pre-release packages use Nitro SQLite 11 and Kysely 0.29.9. Both React Native and NitroUI expose the same dialect API.
The [companion installation guide](/docs/integrations/orms#kysely) lists the packages for each host. These 11.0.0 alpha packages install from the `alpha` tag and use Kysely 0.29.9. Both React Native and NitroUI expose the same dialect API.

## Create a table and query it

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/integrations/orms/mikro-orm.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ MikroORM cursors encode with `base64url`, so the app's global `Buffer` must supp

The NitroUI example prepares MikroORM as a browser bundle before the SDK bundles the app. Follow the same preparation for another NitroUI app. Install `esbuild@0.28.1` as a development dependency, plus `buffer@6.0.3` and `reflect-metadata` as app dependencies.

1. Copy <a href={sourceUrl('examples/nitro-ui/scripts/prepare-mikro-orm.mjs')}>`prepare-mikro-orm.mjs`</a> and <a href={sourceUrl('examples/nitro-ui/scripts/mikro-environment.mjs')}>`mikro-environment.mjs`</a> from the source checkout into your app's `scripts` directory. Run the preparation script before starting or bundling the app:
1. Copy <a href={sourceUrl('examples/nitro-ui/scripts/prepare-mikro-orm.mjs')}>`prepare-mikro-orm.mjs`</a> and <a href={sourceUrl('examples/nitro-ui/scripts/mikro-environment.mjs')}>`mikro-environment.mjs`</a> from the repository into your app's `scripts` directory. Run the preparation script before starting or bundling the app:

```sh
node scripts/prepare-mikro-orm.mjs
Expand Down
16 changes: 14 additions & 2 deletions docs/content/docs/integrations/vector-search.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,25 @@ Install the companion for your runtime. Both expose the same functions for creat

## Enable vector search in React Native

Install `react-native-nitro-sqlite-vec` alongside `react-native-nitro-sqlite`. Enable it for each platform you ship using the [iOS](/docs/configuration/ios#vector-search) or [Android](/docs/configuration/android#vector-search) configuration page, then rebuild the native app. Check availability with `isVecAvailable(db)` before running vector queries. A JavaScript update alone cannot enable the extension.
Install `react-native-nitro-sqlite-vec` alongside `react-native-nitro-sqlite`:

```sh
npm install --save-exact react-native-nitro-sqlite@alpha react-native-nitro-sqlite-vec@alpha
```

Enable it for each platform you ship using the [iOS](/docs/configuration/ios#vector-search) or [Android](/docs/configuration/android#vector-search) configuration page, then rebuild the native app. Check availability with `isVecAvailable(db)` before running vector queries. A JavaScript update alone cannot enable the extension.

Expo projects can enable Vec during prebuild with the [Vec config plugin](/docs/configuration/expo#enable-vector-search). For macOS, use the [10.x setup](/docs/configuration/macos#apple-build-options).

## NitroUI

Install the local `nitro-sqlite-vec` archive alongside the matching `nitro-sqlite` archive. The repository example uses a local file dependency for each package. Prepare and rebuild the native app after adding Vec, just as when [installing the SQLite adapter](/docs/nitro-ui). Vec links to the SQLite engine in the adapter.
Install `nitro-sqlite-vec` alongside `nitro-sqlite`. Both must be direct app dependencies:

```sh
bun add --exact nitro-sqlite@alpha nitro-sqlite-vec@alpha
```

Prepare and rebuild the native app after adding Vec, just as when [installing the SQLite adapter](/docs/nitro-ui). Vec links to the SQLite engine in the adapter.

Call `registerVectorExtensions()` once at startup, before opening your first connection. Registration applies to connections opened afterward and lasts for the rest of the process.

Expand Down
Loading
Loading