From 9ad702673712d3bc217cfe7eac39d7fbdc3c4a59 Mon Sep 17 00:00:00 2001 From: AJ Matthews Date: Thu, 11 Dec 2025 15:07:54 +0000 Subject: [PATCH 1/8] Claude's initial changes. --- src/frontend/config/sidebar/sidebar.topics.ts | 19 +- .../docs/integrations/databases/sqlite.mdx | 159 ----------- .../databases/sqlite/sqlite-client.mdx | 180 ++++++++++++ .../databases/sqlite/sqlite-get-started.mdx | 256 ++++++++++++++++++ .../databases/sqlite/sqlite-host.mdx | 154 +++++++++++ 5 files changed, 608 insertions(+), 160 deletions(-) delete mode 100644 src/frontend/src/content/docs/integrations/databases/sqlite.mdx create mode 100644 src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-client.mdx create mode 100644 src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-get-started.mdx create mode 100644 src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-host.mdx diff --git a/src/frontend/config/sidebar/sidebar.topics.ts b/src/frontend/config/sidebar/sidebar.topics.ts index 48274499..5d0afb0c 100644 --- a/src/frontend/config/sidebar/sidebar.topics.ts +++ b/src/frontend/config/sidebar/sidebar.topics.ts @@ -1191,7 +1191,24 @@ export const sidebarTopics: StarlightSidebarTopicsUserConfig = [ }, ], }, - { label: 'SQLite', slug: 'integrations/databases/sqlite' }, + { + label: 'SQLite', + collapsed: true, + items: [ + { + label: 'Get started', + slug: 'integrations/databases/sqlite/sqlite-get-started', + }, + { + label: 'Hosting integration (AppHost)', + slug: 'integrations/databases/sqlite/sqlite-host', + }, + { + label: 'Client integration (Your app)', + slug: 'integrations/databases/sqlite/sqlite-client', + }, + ], + }, { label: 'SurrealDB', slug: 'integrations/databases/surrealdb' }, ], }, diff --git a/src/frontend/src/content/docs/integrations/databases/sqlite.mdx b/src/frontend/src/content/docs/integrations/databases/sqlite.mdx deleted file mode 100644 index 6a8036f7..00000000 --- a/src/frontend/src/content/docs/integrations/databases/sqlite.mdx +++ /dev/null @@ -1,159 +0,0 @@ ---- -title: SQLite integration -description: Learn how to use the SQLite integration for efficient data management within your applications. -next: false ---- - -import { Aside } from '@astrojs/starlight/components'; -import { Badge } from '@astrojs/starlight/components'; -import InstallPackage from '@components/InstallPackage.astro'; -import InstallDotNetPackage from '@components/InstallDotNetPackage.astro'; -import { Image } from 'astro:assets'; -import sqliteIcon from '@assets/icons/sqlite-icon.png'; - - - -SQLite logo - -[SQLite](https://www.sqlite.org/index.html) is a lightweight, serverless, self-contained SQL database engine that is widely used for local data storage in applications. The Aspire SQLite integration provides a way to use SQLite databases within your Aspire applications, and access them via the [`Microsoft.Data.Sqlite`](https://www.nuget.org/packages/Microsoft.Data.Sqlite) client. - -## Hosting integration - -The SQLite hosting integration models a SQLite database as the `SQLiteResource` type and will create the database file in the specified location. To access these types and APIs, install the [📦 CommunityToolkit.Aspire.Hosting.SQLite](https://nuget.org/packages/CommunityToolkit.Aspire.Hosting.SQLite) NuGet package in the AppHost project. - - - -### Add SQLite resource - -In the AppHost project, register and consume the SQLite integration using the `AddSQLite` extension method to add the SQLite database to the application builder. - -```csharp title="C# — AppHost.cs" -var builder = DistributedApplication.CreateBuilder(args); - -var sqlite = builder.AddSQLite("my-database"); - -var exampleProject = builder.AddProject() - .WithReference(sqlite); -``` - -When Aspire adds a SQLite database to the AppHost, as shown in the preceding example, it creates a new SQLite database file in the users temp directory. - -Alternatively, if you want to specify a custom location for the SQLite database file, provide the relevant arguments to the `AddSqlite` method. - -```csharp -var sqlite = builder.AddSQLite("my-database", "C:\\Database\\Location", "my-database.db"); -``` - -### Add SQLiteWeb resource - -When adding the SQLite resource, you can also add the SQLiteWeb resource, which provides a web interface to interact with the SQLite database. To do this, use the `WithSqliteWeb` extension method. - -```csharp -var sqlite = builder.AddSQLite("my-database") - .WithSqliteWeb(); -``` - -This code adds a container based on `ghcr.io/coleifer/sqlite-web` to the AppHost, which provides a web interface to interact with the SQLite database it is connected to. Each SQLiteWeb instance is connected to a single SQLite database, meaning that if you add multiple SQLiteWeb instances, there will be multiple SQLiteWeb containers. - -### Adding SQLite extensions - -SQLite supports extensions that can be added to the SQLite database. Extensions can either be provided via a NuGet package, or via a location on disk. Use either the `WithNuGetExtension` or `WithLocalExtension` extension methods to add extensions to the SQLite database. - - - -## Client integration - -To get started with the Aspire SQLite client integration, install the [📦 CommunityToolkit.Aspire.Microsoft.Data.Sqlite](https://www.nuget.org/packages/CommunityToolkit.Aspire.Microsoft.Data.Sqlite) NuGet package in the client-consuming project. The SQLite client integration registers a [`SqliteConnection`](https://learn.microsoft.com/dotnet/api/microsoft.data.sqlite.sqliteconnection) instance that you can use to interact with SQLite. - - - -### Add SQLite client - -In the `Program.cs` file of your client-consuming project, call the `AddSqliteConnection` extension method to register a `SqliteConnection` for use via the dependency injection container. The method takes a connection name parameter. - -```csharp -builder.AddSqliteConnection(name: "sqlite"); -``` - - - -After adding `SqliteConnection` to the builder, you can get the `SqliteConnection` instance using dependency injection. For example, to retrieve your connection object from an example service define it as a constructor parameter: - -```csharp -public class ExampleService(SqliteConnection connection) -{ - // Use connection... -} -``` - -### Add keyed SQLite client - -There might be situations where you want to register multiple `SqliteConnection` instances with different connection names. To register keyed SQLite clients, call the `AddKeyedSqliteConnection` method: - -```csharp -builder.AddKeyedSqliteConnection(name: "chat"); -builder.AddKeyedSqliteConnection(name: "queue"); -``` - -Then you can retrieve the `SqliteConnection` instances using dependency injection: - -```csharp -public class ExampleService( - [FromKeyedServices("chat")] SqliteConnection chatConnection, - [FromKeyedServices("queue")] SqliteConnection queueConnection) -{ - // Use connections... -} -``` - -### Configuration - -The SQLite client integration provides multiple configuration approaches and options to meet the requirements and conventions of your project. - -#### Use a connection string - -When using a connection string from the `ConnectionStrings` configuration section, you can provide the name of the connection string when calling the `AddSqliteConnection` method: - -```csharp -builder.AddSqliteConnection("sqlite"); -``` - -Then the connection string will be retrieved from the `ConnectionStrings` configuration section: - -```json -{ - "ConnectionStrings": { - "sqlite": "Data Source=C:\\Database\\Location\\my-database.db" - } -} -``` - -#### Use configuration providers - -The SQLite client integration supports configuration. It loads the settings from configuration using the `Aspire:Sqlite:Client` key. Example `appsettings.json` that configures some of the options: - -```json -{ - "Aspire": { - "Sqlite": { - "Client": { - "ConnectionString": "Data Source=C:\\Database\\Location\\my-database.db", - "DisableHealthCheck": true - } - } - } -} -``` diff --git a/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-client.mdx b/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-client.mdx new file mode 100644 index 00000000..c1b0e12a --- /dev/null +++ b/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-client.mdx @@ -0,0 +1,180 @@ +--- +title: SQLite Client integration reference +description: Learn how to use the Aspire SQLite Client integration to query SQLite databases from your Aspire projects. +--- + +import { Aside } from '@astrojs/starlight/components'; +import { Badge } from '@astrojs/starlight/components'; +import InstallPackage from '@components/InstallPackage.astro'; +import InstallDotNetPackage from '@components/InstallDotNetPackage.astro'; +import { Image } from 'astro:assets'; +import sqliteIcon from '@assets/icons/sqlite-icon.png'; + + + +SQLite logo + +To get started with the Aspire SQLite integrations, follow the [Get started with SQLite integrations](../sqlite-get-started/) guide. + +This article includes full details about the Aspire SQLite Client integration, which allows you to connect to and interact with SQLite databases from your Aspire consuming projects. + +## Installation + +To get started with the Aspire SQLite client integration, install the [📦 CommunityToolkit.Aspire.Microsoft.Data.Sqlite](https://www.nuget.org/packages/CommunityToolkit.Aspire.Microsoft.Data.Sqlite) NuGet package in the client-consuming project, that is, the project for the application that uses the SQLite client. The SQLite client integration registers a [`SqliteConnection`](https://learn.microsoft.com/dotnet/api/microsoft.data.sqlite.sqliteconnection) instance that you can use to interact with SQLite. + + + +## Add SQLite client + +In the `Program.cs` file of your client-consuming project, call the `AddSqliteConnection` extension method to register a `SqliteConnection` for use via the dependency injection container. The method takes a connection name parameter. + +```csharp title="C# — Program.cs" +builder.AddSqliteConnection(connectionName: "sqlite"); +``` + + + +After adding `SqliteConnection` to the builder, you can get the `SqliteConnection` instance using dependency injection. For example, to retrieve your connection object from an example service define it as a constructor parameter: + +```csharp title="C# — ExampleService.cs" +public class ExampleService(SqliteConnection connection) +{ + // Use connection... +} +``` + +For more information on dependency injection, see [.NET dependency injection](https://learn.microsoft.com/dotnet/core/extensions/dependency-injection). + +## Add keyed SQLite client + +There might be situations where you want to register multiple `SqliteConnection` instances with different connection names. To register keyed SQLite clients, call the `AddKeyedSqliteConnection` method: + +```csharp title="C# — Program.cs" +builder.AddKeyedSqliteConnection(name: "chat"); +builder.AddKeyedSqliteConnection(name: "queue"); +``` + + + +Then you can retrieve the `SqliteConnection` instances using dependency injection: + +```csharp title="C# — ExampleService.cs" +public class ExampleService( + [FromKeyedServices("chat")] SqliteConnection chatConnection, + [FromKeyedServices("queue")] SqliteConnection queueConnection) +{ + // Use connections... +} +``` + +For more information on keyed services, see [.NET dependency injection: Keyed services](https://learn.microsoft.com/dotnet/core/extensions/dependency-injection#keyed-services). + +## Properties of the SQLite resources + +When you use the `WithReference` method to pass a SQLite database resource from the AppHost project to a consuming client project, several properties are available to use in the consuming project. + +Aspire exposes the connection string as an environment variable with a standardized naming convention. + +### SQLite database resource + +The SQLite database resource exposes the following connection properties: + +| Property Name | Description | Environment Variable Format | +|---------------|-------------|----------------------------| +| `ConnectionString` | The connection string containing the database file path, in the format `Data Source={FilePath}` | `ConnectionStrings__{ResourceName}` | + +**Example:** + +For a resource named `sqlite`, the environment variable would be: +- `ConnectionStrings__sqlite` with a value like `Data Source=/tmp/my-database.db` + + + +## Configuration + +The SQLite client integration provides multiple options to configure the connection based on the requirements and conventions of your project. + +### Use a connection string + +When using a connection string from the `ConnectionStrings` configuration section, you can provide the name of the connection string when calling the `AddSqliteConnection` method: + +```csharp title="C# — Program.cs" +builder.AddSqliteConnection("sqlite"); +``` + +Then the connection string will be retrieved from the `ConnectionStrings` configuration section: + +```json title="JSON — appsettings.json" +{ + "ConnectionStrings": { + "sqlite": "Data Source=C:\\Database\\Location\\my-database.db" + } +} +``` + +For more information on how to format this connection string, see [Microsoft.Data.Sqlite connection strings](https://learn.microsoft.com/dotnet/standard/data/sqlite/connection-strings). + +### Use configuration providers + +The SQLite client integration supports `Microsoft.Extensions.Configuration`. It loads the settings from configuration using the `Aspire:Sqlite:Client` key. Example `appsettings.json` that configures some of the options: + +```json title="JSON — appsettings.json" +{ + "Aspire": { + "Sqlite": { + "Client": { + "ConnectionString": "Data Source=C:\\Database\\Location\\my-database.db", + "DisableHealthCheck": true + } + } + } +} +``` + +### Use inline delegates + +You can also pass the `Action` delegate to set up some or all the options inline: + +```csharp title="C# — Program.cs" +builder.AddSqliteConnection( + "sqlite", + static settings => settings.DisableHealthCheck = true); +``` + +## Client integration health checks + +By default, Aspire integrations enable [health checks](/fundamentals/health-checks/) for all services. For more information, see [Aspire integrations overview](/integrations/overview/). + +The Aspire SQLite integration: + +- Adds the health check when `SqliteConnectionSettings.DisableHealthCheck` is `false`, which attempts to open a connection to the SQLite database. +- Integrates with the `/health` HTTP endpoint, which specifies all registered health checks must pass for app to be considered ready to accept traffic. + +## Observability and telemetry + +Aspire integrations automatically set up Logging, Tracing, and Metrics configurations, which are sometimes known as *the pillars of observability*. Depending on the backing service, some integrations may only support some of these features. For example, some integrations support logging and tracing, but not metrics. Telemetry features can also be disabled using the techniques presented in the [Configuration](#configuration) section. + +### Logging + +The Aspire SQLite integration uses standard .NET logging mechanisms for database operations. + +### Tracing + +The Aspire SQLite integration will emit tracing activities for database operations using OpenTelemetry when configured. + +### Metrics + +The Aspire SQLite integration currently has limited metrics support compared to other database integrations due to the nature of SQLite as an embedded database engine. diff --git a/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-get-started.mdx b/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-get-started.mdx new file mode 100644 index 00000000..1d974d9d --- /dev/null +++ b/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-get-started.mdx @@ -0,0 +1,256 @@ +--- +title: Get started with the SQLite integrations +description: Learn how to set up the Aspire SQLite Hosting and Client integrations simply. +prev: false +--- + +import { Image } from 'astro:assets'; +import { Kbd } from 'starlight-kbd/components'; +import { Badge } from '@astrojs/starlight/components'; +import InstallPackage from '@components/InstallPackage.astro'; +import InstallDotNetPackage from '@components/InstallDotNetPackage.astro'; +import { Aside, CardGrid, LinkCard, Code, Steps, Tabs, TabItem } from '@astrojs/starlight/components'; +import PivotSelector from '@components/PivotSelector.astro'; +import Pivot from '@components/Pivot.astro'; +import ThemeImage from '@components/ThemeImage.astro'; +import sqliteIcon from '@assets/icons/sqlite-icon.png'; + + + + + +SQLite logo + +[SQLite](https://www.sqlite.org/index.html) is a lightweight, serverless, self-contained SQL database engine that is widely used for local data storage in applications. The Aspire SQLite integration provides a way to use SQLite databases within your Aspire applications, and access them via the [`Microsoft.Data.Sqlite`](https://www.nuget.org/packages/Microsoft.Data.Sqlite) client. + +In this introduction, you'll see how to install and use the Aspire SQLite integrations in a simple configuration. If you already have this knowledge, see [SQLite Hosting integration](../sqlite-host/) for full reference details. + + + +## Set up hosting integration + +To begin, install the Aspire SQLite Hosting integration in your Aspire AppHost project. This integration allows you to create and manage SQLite database instances from your Aspire hosting projects: + + + +Next, in the AppHost project, create an instance of a SQLite database resource, then pass the database to the consuming client projects: + + + +```csharp title="C# — AppHost.cs" +var builder = DistributedApplication.CreateBuilder(args); + +var sqlite = builder.AddSQLite("sqlite"); + +var exampleProject = builder.AddProject("apiservice") + .WithReference(sqlite); +``` + + + + + +```csharp title="C# — AppHost.cs" +var builder = DistributedApplication.CreateBuilder(args); + +var sqlite = builder.AddSQLite("sqlite"); + +var exampleProject = builder.AddUvicornApp("api", "./api", "main.app") + .WithExternalHttpEndpoints() + .WithReference(sqlite); +``` + + + + + +```csharp title="C# — AppHost.cs" +var builder = DistributedApplication.CreateBuilder(args); + +var sqlite = builder.AddSQLite("sqlite"); + +var api = builder.AddNodeApp("api", "./api", scriptPath: "index.js") + .WithExternalHttpEndpoints() + .WithReference(sqlite); +``` + + + + + +## Use the integration in client projects + +Now that the hosting integration is ready, the next step is to install and configure the client integration in any projects that need to use it. + +### Set up client projects + + + +In each of these consuming client projects, install the Aspire SQLite client integration: + + + +In the `Program.cs` file of your client-consuming project, call the `AddSqliteConnection` extension method on any `IHostApplicationBuilder` to register a `SqliteConnection` for use via the dependency injection container. The method takes a connection name parameter. + +```csharp title="C# — Program.cs" +builder.AddSqliteConnection(connectionName: "sqlite"); +``` + + + + + + + +To interact with SQLite databases in your Python consuming projects, you can use the built-in `sqlite3` module (included in Python's standard library). No additional installation is required: + +```python title="Python - Import sqlite3" +import sqlite3 +import os +``` + + + + + +To interact with SQLite databases in your JavaScript consuming projects, you need to include a SQLite client library. A popular option is `better-sqlite3` (a synchronous, fast SQLite client). You can install this library using npm: + +```bash +npm install better-sqlite3 +``` + +Ensure that you `import better-sqlite3` in code files that interact with the database: + +```javascript title="JavaScript - Import better-sqlite3" +import Database from 'better-sqlite3'; +``` + + + +### Use injected SQLite properties + +In the AppHost, when you used the `WithReference` method to pass a SQLite database resource to a consuming client project, Aspire injects several configuration properties that you can use in the consuming project. + +Aspire exposes each property as an environment variable named `[RESOURCE]_[PROPERTY]`. For instance, the `ConnectionString` property of a resource called `sqlite` becomes `SQLITE_CONNECTIONSTRING`. + + + +Use the `GetValue()` method to obtain these environment variables in consuming projects: + +```csharp title="C# - Obtain configuration properties" +string connectionString = builder.Configuration.GetValue("ConnectionStrings__sqlite"); +``` + + + + + +Use the `os.getenv()` method to obtain these environment variables in consuming projects: + +```python title="Python - Obtain configuration properties" +connection_string = os.getenv("ConnectionStrings__sqlite") +``` + + + + + +Use the `process.env` method to obtain these environment variables in consuming projects: + +```javascript title="JavaScript - Obtain configuration properties" +const connectionString = process.env.ConnectionStrings__sqlite; +``` + + + + + +### Use SQLite resources in client code + + + +Now that you've added `SqliteConnection` to the builder in the consuming project, you can use the SQLite resource to get and store data. Get the `SqliteConnection` instance using dependency injection. For example, to retrieve your connection object from an example service define it as a constructor parameter and ensure the `ExampleService` class is registered with the dependency injection container: + +```csharp title="C# — ExampleService.cs" +public class ExampleService(SqliteConnection connection) +{ + // Use connection to query the database... +} +``` + +Having obtained the connection, you can work with the SQLite database as you would in any other C# application. + + + + + +Use the information you have obtained about the SQLite resource to connect to the database. Here is an example of how to connect using `sqlite3`: + +```python title="Python - Connect to SQLite" +# Extract the database file path from the connection string +# ConnectionStrings typically look like: "Data Source=/path/to/file.db" +db_path = connection_string.replace("Data Source=", "") + +connection = sqlite3.connect(db_path) +cursor = connection.cursor() +``` + +Having obtained the connection, you can work with the SQLite database as you would in any other Python application. + + + + + +Use the information you have obtained about the SQLite resource to connect to the database. Here is an example of how to connect using `better-sqlite3`: + +```javascript title="JavaScript - Connect to SQLite" +// Extract the database file path from the connection string +// ConnectionStrings typically look like: "Data Source=/path/to/file.db" +const dbPath = connectionString.replace("Data Source=", ""); + +const db = new Database(dbPath); +``` + +Having obtained the connection, you can work with the SQLite database as you would in any other JavaScript application. + + + +## Next steps + +Now, that you have an Aspire app with SQLite integrations up and running, you can use the following reference documents to learn how to configure and interact with the SQLite resources: + + + + + diff --git a/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-host.mdx b/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-host.mdx new file mode 100644 index 00000000..7b971d28 --- /dev/null +++ b/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-host.mdx @@ -0,0 +1,154 @@ +--- +title: SQLite Hosting integration reference +description: Learn how to use the Aspire SQLite Hosting integration to create and manage SQLite database resources in your Aspire projects. +--- + +import { Aside } from '@astrojs/starlight/components'; +import { Badge } from '@astrojs/starlight/components'; +import InstallPackage from '@components/InstallPackage.astro'; +import { Image } from 'astro:assets'; +import sqliteIcon from '@assets/icons/sqlite-icon.png'; + + + +SQLite logo + +To get started with the Aspire SQLite integrations, follow the [Get started with SQLite integrations](../sqlite-get-started/) guide. + +This article includes full details about the Aspire SQLite Hosting integration, which models a SQLite database as the `SQLiteResource` type. To access these types and APIs, you need to install the SQLite Hosting integration in your AppHost project. + +## Installation + +The SQLite hosting integration models a SQLite database as the `SQLiteResource` type and will create the database file in the specified location. To get started with the Aspire SQLite hosting integration, install the [📦 CommunityToolkit.Aspire.Hosting.SQLite](https://nuget.org/packages/CommunityToolkit.Aspire.Hosting.SQLite) NuGet package in your AppHost project: + + + +## Add SQLite resource + +In the AppHost project, register and consume the SQLite integration using the `AddSQLite` extension method to add the SQLite database to the application builder. + +```csharp title="C# — AppHost.cs" +var builder = DistributedApplication.CreateBuilder(args); + +var sqlite = builder.AddSQLite("my-database"); + +var exampleProject = builder.AddProject() + .WithReference(sqlite); +``` + +When Aspire adds a SQLite database to the AppHost, as shown in the preceding example, it creates a new SQLite database file in the users temp directory. + +Alternatively, if you want to specify a custom location for the SQLite database file, provide the relevant arguments to the `AddSqlite` method. + +```csharp title="C# — AppHost.cs" +var builder = DistributedApplication.CreateBuilder(args); + +var sqlite = builder.AddSQLite("my-database", "C:\\Database\\Location", "my-database.db"); + +var exampleProject = builder.AddProject() + .WithReference(sqlite); +``` + +The preceding code creates a SQLite database file at `C:\Database\Location\my-database.db`. The database file is created if it doesn't already exist. + +## Add SQLiteWeb resource + +When adding the SQLite resource, you can also add the SQLiteWeb resource, which provides a web interface to interact with the SQLite database. To do this, use the `WithSqliteWeb` extension method. + +```csharp title="C# — AppHost.cs" +var builder = DistributedApplication.CreateBuilder(args); + +var sqlite = builder.AddSQLite("my-database") + .WithSqliteWeb(); + +var exampleProject = builder.AddProject() + .WithReference(sqlite); +``` + +This code adds a container based on `ghcr.io/coleifer/sqlite-web` to the AppHost, which provides a web interface to interact with the SQLite database it is connected to. Each SQLiteWeb instance is connected to a single SQLite database, meaning that if you add multiple SQLiteWeb instances, there will be multiple SQLiteWeb containers. + +When you run the solution, the Aspire dashboard displays the SQLiteWeb resource with an endpoint. Select the link to the endpoint to view SQLiteWeb in a new browser tab. + +## Adding SQLite extensions + +SQLite supports extensions that can be added to the SQLite database. Extensions can either be provided via a NuGet package, or via a location on disk. Use either the `WithNuGetExtension` or `WithLocalExtension` extension methods to add extensions to the SQLite database. + +```csharp title="C# — AppHost.cs (NuGet extension)" +var builder = DistributedApplication.CreateBuilder(args); + +var sqlite = builder.AddSQLite("my-database") + .WithNuGetExtension("SQLitePCLRaw.lib.e_sqlite3"); + +var exampleProject = builder.AddProject() + .WithReference(sqlite); +``` + +```csharp title="C# — AppHost.cs (Local extension)" +var builder = DistributedApplication.CreateBuilder(args); + +var sqlite = builder.AddSQLite("my-database") + .WithLocalExtension("C:\\Extensions\\my-extension.dll"); + +var exampleProject = builder.AddProject() + .WithReference(sqlite); +``` + + + +## Using with non-.NET applications + +When you use the `WithReference` method to pass a SQLite database resource to a non-.NET application (such as Python or JavaScript), Aspire automatically injects environment variables that describe the connection information. + +For example, if you reference a SQLite database resource named `sqlite`: + +```csharp title="C# — AppHost.cs" +var sqlite = builder.AddSQLite("sqlite"); + +var pythonApp = builder.AddUvicornApp("api", "./api", "main.app") + .WithReference(sqlite); +``` + +The following environment variable is available in the Python application: + +- `ConnectionStrings__sqlite` - The connection string containing the database file path + +You can access this environment variable in your application code: + +```python title="Python example" +import os +import sqlite3 + +connection_string = os.getenv("ConnectionStrings__sqlite") +# Extract the database file path from the connection string +# ConnectionStrings typically look like: "Data Source=/path/to/file.db" +db_path = connection_string.replace("Data Source=", "") + +connection = sqlite3.connect(db_path) +cursor = connection.cursor() +``` + +```javascript title="JavaScript example" +import Database from 'better-sqlite3'; + +const connectionString = process.env.ConnectionStrings__sqlite; +// Extract the database file path from the connection string +const dbPath = connectionString.replace("Data Source=", ""); + +const db = new Database(dbPath); +``` + +For the complete list of properties available, see [Properties of the SQLite resources](../sqlite-client/#properties-of-the-sqlite-resources). + +## Client integration + +To learn how to connect to and interact with SQLite databases from your consuming projects, see [SQLite Client integration](../sqlite-client/). From 81a692b7c6eb76e8dbf21d20fffedce50346c928 Mon Sep 17 00:00:00 2001 From: AJ Matthews Date: Thu, 11 Dec 2025 16:09:04 +0000 Subject: [PATCH 2/8] My corrections. --- .../databases/sqlite/sqlite-client.mdx | 1 + .../databases/sqlite/sqlite-get-started.mdx | 57 +++++++++---------- .../databases/sqlite/sqlite-host.mdx | 4 -- 3 files changed, 27 insertions(+), 35 deletions(-) diff --git a/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-client.mdx b/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-client.mdx index c1b0e12a..12dee80a 100644 --- a/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-client.mdx +++ b/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-client.mdx @@ -1,6 +1,7 @@ --- title: SQLite Client integration reference description: Learn how to use the Aspire SQLite Client integration to query SQLite databases from your Aspire projects. +next: false --- import { Aside } from '@astrojs/starlight/components'; diff --git a/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-get-started.mdx b/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-get-started.mdx index 1d974d9d..396b2ec5 100644 --- a/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-get-started.mdx +++ b/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-get-started.mdx @@ -17,16 +17,6 @@ import sqliteIcon from '@assets/icons/sqlite-icon.png'; - - SQLite logo + ```csharp title="C# — AppHost.cs" @@ -60,6 +60,7 @@ var builder = DistributedApplication.CreateBuilder(args); var sqlite = builder.AddSQLite("sqlite"); var exampleProject = builder.AddProject("apiservice") + .WaitFor(sqlite) .WithReference(sqlite); ``` @@ -74,6 +75,7 @@ var sqlite = builder.AddSQLite("sqlite"); var exampleProject = builder.AddUvicornApp("api", "./api", "main.app") .WithExternalHttpEndpoints() + .WaitFor(sqlite) .WithReference(sqlite); ``` @@ -88,6 +90,7 @@ var sqlite = builder.AddSQLite("sqlite"); var api = builder.AddNodeApp("api", "./api", scriptPath: "index.js") .WithExternalHttpEndpoints() + .WaitFor(sqlite) .WithReference(sqlite); ``` @@ -112,11 +115,11 @@ In each of these consuming client projects, install the Aspire SQLite client int In the `Program.cs` file of your client-consuming project, call the `AddSqliteConnection` extension method on any `IHostApplicationBuilder` to register a `SqliteConnection` for use via the dependency injection container. The method takes a connection name parameter. ```csharp title="C# — Program.cs" -builder.AddSqliteConnection(connectionName: "sqlite"); +builder.AddSqliteConnection("sqlite"); ``` @@ -134,16 +137,16 @@ import os -To interact with SQLite databases in your JavaScript consuming projects, you need to include a SQLite client library. A popular option is `better-sqlite3` (a synchronous, fast SQLite client). You can install this library using npm: +To interact with SQLite databases in your JavaScript consuming projects, you need to include a SQLite client library. A popular option is `sqlite3`. You can install this library using npm: ```bash -npm install better-sqlite3 +npm install sqlite3 ``` -Ensure that you `import better-sqlite3` in code files that interact with the database: +Ensure that you `import sqlite3` in code files that interact with the database: -```javascript title="JavaScript - Import better-sqlite3" -import Database from 'better-sqlite3'; +```javascript title="JavaScript - Import sqlite3" +import sqlite3 from 'sqlite3'; ``` @@ -159,7 +162,7 @@ Aspire exposes each property as an environment variable named `[RESOURCE]_[PROPE Use the `GetValue()` method to obtain these environment variables in consuming projects: ```csharp title="C# - Obtain configuration properties" -string connectionString = builder.Configuration.GetValue("ConnectionStrings__sqlite"); +string sqldatasource = builder.Configuration.GetValue("SQLITE_DATASOURCE"); ``` @@ -169,7 +172,7 @@ string connectionString = builder.Configuration.GetValue("ConnectionStri Use the `os.getenv()` method to obtain these environment variables in consuming projects: ```python title="Python - Obtain configuration properties" -connection_string = os.getenv("ConnectionStrings__sqlite") +connection_string = os.getenv("SQLITE_DATASOURCE") ``` @@ -179,7 +182,7 @@ connection_string = os.getenv("ConnectionStrings__sqlite") Use the `process.env` method to obtain these environment variables in consuming projects: ```javascript title="JavaScript - Obtain configuration properties" -const connectionString = process.env.ConnectionStrings__sqlite; +const connectionString = process.env.SQLITE_DATASOURCE; ``` @@ -210,11 +213,7 @@ Having obtained the connection, you can work with the SQLite database as you wou Use the information you have obtained about the SQLite resource to connect to the database. Here is an example of how to connect using `sqlite3`: ```python title="Python - Connect to SQLite" -# Extract the database file path from the connection string -# ConnectionStrings typically look like: "Data Source=/path/to/file.db" -db_path = connection_string.replace("Data Source=", "") - -connection = sqlite3.connect(db_path) +connection = sqlite3.connect(connection_string) cursor = connection.cursor() ``` @@ -224,14 +223,10 @@ Having obtained the connection, you can work with the SQLite database as you wou -Use the information you have obtained about the SQLite resource to connect to the database. Here is an example of how to connect using `better-sqlite3`: +Use the information you have obtained about the SQLite resource to connect to the database. Here is an example of how to connect using `sqlite3`: ```javascript title="JavaScript - Connect to SQLite" -// Extract the database file path from the connection string -// ConnectionStrings typically look like: "Data Source=/path/to/file.db" -const dbPath = connectionString.replace("Data Source=", ""); - -const db = new Database(dbPath); +const db = new sqlite3.Database(connectionString); ``` Having obtained the connection, you can work with the SQLite database as you would in any other JavaScript application. diff --git a/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-host.mdx b/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-host.mdx index 7b971d28..5aa26aed 100644 --- a/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-host.mdx @@ -148,7 +148,3 @@ const db = new Database(dbPath); ``` For the complete list of properties available, see [Properties of the SQLite resources](../sqlite-client/#properties-of-the-sqlite-resources). - -## Client integration - -To learn how to connect to and interact with SQLite databases from your consuming projects, see [SQLite Client integration](../sqlite-client/). From c7e14149f7c1d3f632e89ec9a39c9040eccc8149 Mon Sep 17 00:00:00 2001 From: AJ Matthews Date: Wed, 17 Dec 2025 14:16:38 +0000 Subject: [PATCH 3/8] Fixed out-of-date links to SQLite docs. --- src/frontend/src/data/integration-docs.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/frontend/src/data/integration-docs.json b/src/frontend/src/data/integration-docs.json index 6d8473c8..85554d9c 100644 --- a/src/frontend/src/data/integration-docs.json +++ b/src/frontend/src/data/integration-docs.json @@ -449,7 +449,7 @@ }, { "match": "CommunityToolkit.Aspire.Hosting.Sqlite", - "href": "/integrations/databases/sqlite/" + "href": "/integrations/databases/sqlite/sqlite-host/" }, { "match": "CommunityToolkit.Aspire.Hosting.SqlServer.Extensions", @@ -469,11 +469,11 @@ }, { "match": "CommunityToolkit.Aspire.Microsoft.Data.Sqlite", - "href": "/integrations/databases/sqlite/" + "href": "/integrations/databases/sqlite/sqlite-client/" }, { "match": "CommunityToolkit.Aspire.Microsoft.EntityFrameworkCore.Sqlite", - "href": "/integrations/databases/sqlite/" + "href": "/integrations/databases/sqlite/sqlite-host/" }, { "match": "CommunityToolkit.Aspire.OllamaSharp", From 76206ce9419cff5d76a8da3020d7305f4e77892d Mon Sep 17 00:00:00 2001 From: AJ Matthews Date: Fri, 19 Dec 2025 14:58:07 +0000 Subject: [PATCH 4/8] Corrected environment variables. --- .../databases/sqlite/sqlite-client.mdx | 17 +++-------------- .../databases/sqlite/sqlite-get-started.mdx | 16 ++++++++-------- .../databases/sqlite/sqlite-host.mdx | 12 ++++++------ 3 files changed, 17 insertions(+), 28 deletions(-) diff --git a/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-client.mdx b/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-client.mdx index 12dee80a..f7091e59 100644 --- a/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-client.mdx +++ b/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-client.mdx @@ -83,25 +83,14 @@ For more information on keyed services, see [.NET dependency injection: Keyed se ## Properties of the SQLite resources -When you use the `WithReference` method to pass a SQLite database resource from the AppHost project to a consuming client project, several properties are available to use in the consuming project. - -Aspire exposes the connection string as an environment variable with a standardized naming convention. - -### SQLite database resource - -The SQLite database resource exposes the following connection properties: +When you use the `WithReference` method to pass a SQLite database resource from the AppHost project to a consuming client project, Aspire exposes the data source as an environment variable with a standardized naming convention: | Property Name | Description | Environment Variable Format | |---------------|-------------|----------------------------| -| `ConnectionString` | The connection string containing the database file path, in the format `Data Source={FilePath}` | `ConnectionStrings__{ResourceName}` | - -**Example:** - -For a resource named `sqlite`, the environment variable would be: -- `ConnectionStrings__sqlite` with a value like `Data Source=/tmp/my-database.db` +| `DataSource` | The data source path containing the database file path. | `C:\{Path}\{Databasefile}.db` | ## Configuration diff --git a/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-get-started.mdx b/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-get-started.mdx index 396b2ec5..3d1ffd66 100644 --- a/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-get-started.mdx +++ b/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-get-started.mdx @@ -57,7 +57,7 @@ Next, in the AppHost project, create an instance of a SQLite database resource, ```csharp title="C# — AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var sqlite = builder.AddSQLite("sqlite"); +var sqlite = builder.AddSqlite("sqlite"); var exampleProject = builder.AddProject("apiservice") .WaitFor(sqlite) @@ -71,7 +71,7 @@ var exampleProject = builder.AddProject("apiservice") ```csharp title="C# — AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var sqlite = builder.AddSQLite("sqlite"); +var sqlite = builder.AddSqlite("sqlite"); var exampleProject = builder.AddUvicornApp("api", "./api", "main.app") .WithExternalHttpEndpoints() @@ -86,7 +86,7 @@ var exampleProject = builder.AddUvicornApp("api", "./api", "main.app") ```csharp title="C# — AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var sqlite = builder.AddSQLite("sqlite"); +var sqlite = builder.AddSqlite("sqlite"); var api = builder.AddNodeApp("api", "./api", scriptPath: "index.js") .WithExternalHttpEndpoints() @@ -153,13 +153,13 @@ import sqlite3 from 'sqlite3'; ### Use injected SQLite properties -In the AppHost, when you used the `WithReference` method to pass a SQLite database resource to a consuming client project, Aspire injects several configuration properties that you can use in the consuming project. +In the AppHost, when you used the `WithReference` method to pass a SQLite database resource to a consuming client project, Aspire injects the data source configuration property that you can use in the consuming project. -Aspire exposes each property as an environment variable named `[RESOURCE]_[PROPERTY]`. For instance, the `ConnectionString` property of a resource called `sqlite` becomes `SQLITE_CONNECTIONSTRING`. +Aspire exposes the property as an environment variable named `[RESOURCE]_DATASOURCE`. For instance, the data source of a resource called `sqlite` becomes `SQLITE_DATASOURCE`. -Use the `GetValue()` method to obtain these environment variables in consuming projects: +Use the `GetValue()` method to obtain this environment variable in consuming projects: ```csharp title="C# - Obtain configuration properties" string sqldatasource = builder.Configuration.GetValue("SQLITE_DATASOURCE"); @@ -169,7 +169,7 @@ string sqldatasource = builder.Configuration.GetValue("SQLITE_DATASOURCE -Use the `os.getenv()` method to obtain these environment variables in consuming projects: +Use the `os.getenv()` method to obtain this environment variable in consuming projects: ```python title="Python - Obtain configuration properties" connection_string = os.getenv("SQLITE_DATASOURCE") @@ -179,7 +179,7 @@ connection_string = os.getenv("SQLITE_DATASOURCE") -Use the `process.env` method to obtain these environment variables in consuming projects: +Use the `process.env` method to obtain this environment variable in consuming projects: ```javascript title="JavaScript - Obtain configuration properties" const connectionString = process.env.SQLITE_DATASOURCE; diff --git a/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-host.mdx b/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-host.mdx index 5aa26aed..81ae7714 100644 --- a/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-host.mdx @@ -37,7 +37,7 @@ In the AppHost project, register and consume the SQLite integration using the `A ```csharp title="C# — AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var sqlite = builder.AddSQLite("my-database"); +var sqlite = builder.AddSqlite("my-database"); var exampleProject = builder.AddProject() .WithReference(sqlite); @@ -50,7 +50,7 @@ Alternatively, if you want to specify a custom location for the SQLite database ```csharp title="C# — AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var sqlite = builder.AddSQLite("my-database", "C:\\Database\\Location", "my-database.db"); +var sqlite = builder.AddSqlite("my-database", "C:\\Database\\Location", "my-database.db"); var exampleProject = builder.AddProject() .WithReference(sqlite); @@ -65,7 +65,7 @@ When adding the SQLite resource, you can also add the SQLiteWeb resource, which ```csharp title="C# — AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var sqlite = builder.AddSQLite("my-database") +var sqlite = builder.AddSqlite("my-database") .WithSqliteWeb(); var exampleProject = builder.AddProject() @@ -83,7 +83,7 @@ SQLite supports extensions that can be added to the SQLite database. Extensions ```csharp title="C# — AppHost.cs (NuGet extension)" var builder = DistributedApplication.CreateBuilder(args); -var sqlite = builder.AddSQLite("my-database") +var sqlite = builder.AddSqlite("my-database") .WithNuGetExtension("SQLitePCLRaw.lib.e_sqlite3"); var exampleProject = builder.AddProject() @@ -93,7 +93,7 @@ var exampleProject = builder.AddProject() ```csharp title="C# — AppHost.cs (Local extension)" var builder = DistributedApplication.CreateBuilder(args); -var sqlite = builder.AddSQLite("my-database") +var sqlite = builder.AddSqlite("my-database") .WithLocalExtension("C:\\Extensions\\my-extension.dll"); var exampleProject = builder.AddProject() @@ -112,7 +112,7 @@ When you use the `WithReference` method to pass a SQLite database resource to a For example, if you reference a SQLite database resource named `sqlite`: ```csharp title="C# — AppHost.cs" -var sqlite = builder.AddSQLite("sqlite"); +var sqlite = builder.AddSqlite("sqlite"); var pythonApp = builder.AddUvicornApp("api", "./api", "main.app") .WithReference(sqlite); From 08ac0270f7a4b0a84de9f6309e1d28d7b01fac7d Mon Sep 17 00:00:00 2001 From: AJ Matthews Date: Fri, 2 Jan 2026 16:26:53 +0000 Subject: [PATCH 5/8] Integrated some feedback from @Copilot. More to come. --- .../docs/integrations/databases/sqlite/sqlite-client.mdx | 2 +- .../docs/integrations/databases/sqlite/sqlite-get-started.mdx | 3 --- .../docs/integrations/databases/sqlite/sqlite-host.mdx | 4 ++-- src/frontend/src/data/integration-docs.json | 2 +- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-client.mdx b/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-client.mdx index f7091e59..5c7dca3a 100644 --- a/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-client.mdx +++ b/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-client.mdx @@ -65,7 +65,7 @@ builder.AddKeyedSqliteConnection(name: "queue"); ``` Then you can retrieve the `SqliteConnection` instances using dependency injection: diff --git a/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-get-started.mdx b/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-get-started.mdx index 3d1ffd66..df4fa24a 100644 --- a/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-get-started.mdx +++ b/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-get-started.mdx @@ -60,7 +60,6 @@ var builder = DistributedApplication.CreateBuilder(args); var sqlite = builder.AddSqlite("sqlite"); var exampleProject = builder.AddProject("apiservice") - .WaitFor(sqlite) .WithReference(sqlite); ``` @@ -75,7 +74,6 @@ var sqlite = builder.AddSqlite("sqlite"); var exampleProject = builder.AddUvicornApp("api", "./api", "main.app") .WithExternalHttpEndpoints() - .WaitFor(sqlite) .WithReference(sqlite); ``` @@ -90,7 +88,6 @@ var sqlite = builder.AddSqlite("sqlite"); var api = builder.AddNodeApp("api", "./api", scriptPath: "index.js") .WithExternalHttpEndpoints() - .WaitFor(sqlite) .WithReference(sqlite); ``` diff --git a/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-host.mdx b/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-host.mdx index 81ae7714..383f3d0f 100644 --- a/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-host.mdx @@ -32,7 +32,7 @@ The SQLite hosting integration models a SQLite database as the `SQLiteResource` ## Add SQLite resource -In the AppHost project, register and consume the SQLite integration using the `AddSQLite` extension method to add the SQLite database to the application builder. +In the AppHost project, register and consume the SQLite integration using the `AddSqlite` extension method to add the SQLite database to the application builder. ```csharp title="C# — AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); @@ -43,7 +43,7 @@ var exampleProject = builder.AddProject() .WithReference(sqlite); ``` -When Aspire adds a SQLite database to the AppHost, as shown in the preceding example, it creates a new SQLite database file in the users temp directory. +When Aspire adds a SQLite database to the AppHost, as shown in the preceding example, it creates a new SQLite database file in the user's temp directory. Alternatively, if you want to specify a custom location for the SQLite database file, provide the relevant arguments to the `AddSqlite` method. diff --git a/src/frontend/src/data/integration-docs.json b/src/frontend/src/data/integration-docs.json index 85554d9c..826b77fd 100644 --- a/src/frontend/src/data/integration-docs.json +++ b/src/frontend/src/data/integration-docs.json @@ -473,7 +473,7 @@ }, { "match": "CommunityToolkit.Aspire.Microsoft.EntityFrameworkCore.Sqlite", - "href": "/integrations/databases/sqlite/sqlite-host/" + "href": "/integrations/databases/sqlite/sqlite-client/" }, { "match": "CommunityToolkit.Aspire.OllamaSharp", From 899bbecd8be3c1e61c18cb7041ee34bb0e0d1e2c Mon Sep 17 00:00:00 2001 From: AJ Matthews Date: Fri, 2 Jan 2026 16:48:06 +0000 Subject: [PATCH 6/8] Integrated remaining feedback from @Copilot. --- .../databases/sqlite/sqlite-host.mdx | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-host.mdx b/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-host.mdx index 383f3d0f..5c723cd5 100644 --- a/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-host.mdx @@ -120,7 +120,7 @@ var pythonApp = builder.AddUvicornApp("api", "./api", "main.app") The following environment variable is available in the Python application: -- `ConnectionStrings__sqlite` - The connection string containing the database file path +- `SQLITE_DATASOURCE` - The connection string for the `sqlite` resource, containing the database file path You can access this environment variable in your application code: @@ -128,23 +128,18 @@ You can access this environment variable in your application code: import os import sqlite3 -connection_string = os.getenv("ConnectionStrings__sqlite") -# Extract the database file path from the connection string -# ConnectionStrings typically look like: "Data Source=/path/to/file.db" -db_path = connection_string.replace("Data Source=", "") +connection_string = os.getenv("SQLITE_DATASOURCE") -connection = sqlite3.connect(db_path) +connection = sqlite3.connect(connection_string) cursor = connection.cursor() ``` ```javascript title="JavaScript example" -import Database from 'better-sqlite3'; +import sqlite3 from 'sqlite3'; -const connectionString = process.env.ConnectionStrings__sqlite; -// Extract the database file path from the connection string -const dbPath = connectionString.replace("Data Source=", ""); +const connectionString = process.env.SQLITE_DATASOURCE; -const db = new Database(dbPath); +const db = new sqlite3.Database(connectionString); ``` For the complete list of properties available, see [Properties of the SQLite resources](../sqlite-client/#properties-of-the-sqlite-resources). From 2c9a57446aa1028ecef6e1cd7a56acf6d1c33015 Mon Sep 17 00:00:00 2001 From: AJ Matthews Date: Mon, 5 Jan 2026 15:49:14 +0000 Subject: [PATCH 7/8] Added redirect. --- src/frontend/config/redirects.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/frontend/config/redirects.mjs b/src/frontend/config/redirects.mjs index c1f05143..5e430b83 100644 --- a/src/frontend/config/redirects.mjs +++ b/src/frontend/config/redirects.mjs @@ -4,6 +4,7 @@ export const redirects = { // '/original/path/': '/new/path' '/get-started/welcome/': '/docs/', '/integrations/postgres/': '/integrations/databases/postgres/postgres-getting-started/', + '/integrations/sqlite/': '/integrations/databases/sqlite/sqlite-getting-started/', '/integrations/rabbitmq/': '/integrations/messaging/rabbitmq/', '/integrations/eventstore/': '/integrations/databases/kurrentdb/', }; From dd53f3458c3a94dfea1bd4330b3acc081084d8f0 Mon Sep 17 00:00:00 2001 From: AJ Matthews Date: Mon, 5 Jan 2026 16:12:27 +0000 Subject: [PATCH 8/8] Fixed the redirects. --- src/frontend/config/redirects.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/frontend/config/redirects.mjs b/src/frontend/config/redirects.mjs index 5e430b83..90513d34 100644 --- a/src/frontend/config/redirects.mjs +++ b/src/frontend/config/redirects.mjs @@ -3,8 +3,8 @@ export const redirects = { // For example: // '/original/path/': '/new/path' '/get-started/welcome/': '/docs/', - '/integrations/postgres/': '/integrations/databases/postgres/postgres-getting-started/', - '/integrations/sqlite/': '/integrations/databases/sqlite/sqlite-getting-started/', + '/integrations/postgres/': '/integrations/databases/postgres/postgres-get-started/', + '/integrations/sqlite/': '/integrations/databases/sqlite/sqlite-get-started/', '/integrations/rabbitmq/': '/integrations/messaging/rabbitmq/', '/integrations/eventstore/': '/integrations/databases/kurrentdb/', };