Skip to content

Commit af5d418

Browse files
authored
Merge pull request #108 from sqlitecloud/jacob/update-architecture
Architecture update and clean up
2 parents 88a6fbe + 4341d99 commit af5d418

File tree

14 files changed

+285
-88
lines changed

14 files changed

+285
-88
lines changed
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
---
2-
title: Scaling
3-
description: How to scale your SQLite Cloud cluster.
4-
category: platform
5-
status: publish
6-
slug: scaling
7-
---
81

2+
3+
## Architecture
4+
SQLite Cloud uses the [Raft](https://raft.github.io) consensus algorithm to distribute your data changes across a cluster of computing systems, ensuring that each node in the cluster agrees upon the same series of state transitions. Raft implements consensus with a leader approach.
5+
6+
SQLite Cloud is written in ANSI C and GO, and it works on most POSIX systems (Linux, *BSD, Mac OS X) and Windows.
7+
8+
SQLite Cloud supports all the SQLite features without any limitations, including ACID compliance and non-deterministic SQL statements.
9+
10+
## Scaling your cluster
911
SQLite Cloud leverages a customized Raft algorithm to maintain a robust and highly available database cluster. Here’s an essential guide on the node types within SQLite Cloud and strategic tips for scaling your cluster effectively.
1012

1113
## Overview of Node types

sqlite-cloud/_nav.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import type { SidebarNavStruct } from "@docs-website/types/sidebar-navigation";
22

33
const sidebarNav: SidebarNavStruct = [
44
{ title: "", type: "primary" },
5-
{ title: "Getting Started", type: "secondary", icon: "docs-star" },
6-
{ title: "Introduction", href: "/docs/sqlite-cloud", type: "inner", level: 0 }, // should be index page for /docs and highlight "introduction" in nav
7-
{ title: "Fundamentals", type: "inner", level: 0 },
5+
{ title: "Introduction", type: "secondary", icon: "docs-star" },
6+
{ title: "Overview", href: "/docs/sqlite-cloud", type: "inner", level: 0 },
7+
{ title: "Getting Started", type: "inner", level: 0 },
88
{ title: "Connecting", filePath: "connect-cluster", type: "inner", level: 1 },
99
{ title: "Creating a database", filePath: "create-database", type: "inner", level: 1 },
1010
{ title: "Writing data", filePath: "write-data", type: "inner", level: 1 },
@@ -26,7 +26,7 @@ const sidebarNav: SidebarNavStruct = [
2626
{ title: "Integrations", type: "inner", level: 0 },
2727
{ title: "Knex.js", filePath: "knex-integration", type: "inner", level: 1 },
2828

29-
{ title: "Platform", type: "secondary", icon: "docs-plat" },
29+
{ title: "Platform", type: "secondary", icon: "docs-plat" },
3030
{ title: "Edge Functions", filePath: "edge-functions", type: "inner", level: 0 },
3131
{ title: "Webhooks", filePath: "webhooks", type: "inner", level: 0 },
3232
{ title: "Pub/Sub", filePath: "pub-sub", type: "inner", level: 0 },
@@ -39,9 +39,8 @@ const sidebarNav: SidebarNavStruct = [
3939
{ title: "Weblite", filePath: "weblite", type: "inner", level: 0 },
4040
// { title: "Storage", type: "inner", level: 0 },
4141
// { title: "Partitioning", type: "inner", level: 0 },
42-
{ title: "Settings", filePath: "settings", type: "inner", level: 0 },
4342

44-
{ title: "SDKs", type: "secondary", icon: "docs-sdk" },
43+
{ title: "SDKs", type: "secondary", icon: "docs-sdk" },
4544
{ title: "C/C++", type: "inner", level: 0 },
4645
{ title: "Introduction", type: "inner", filePath: "sdk-c-introduction", level: 1, },
4746
{ title: 'Basic APIs', type: "inner", level: 1 },
@@ -177,7 +176,7 @@ const sidebarNav: SidebarNavStruct = [
177176
{ title: "Swift", type: "inner", level: 0 },
178177
{ title: 'Introduction', type: "inner", filePath: "sdk-swift-introduction", level: 1 },
179178

180-
{ title: "Reference", type: "secondary", icon: "docs-ref" },
179+
{ title: "Reference", type: "secondary", icon: "docs-ref" },
181180
{ title: "Server-side Commands", type: "inner", level: 0 },
182181
{ title: "Introduction", filePath: "server-side-commands", type: "inner", level: 1 },
183182
{ title: "API Keys", filePath: "api-key-commands", type: "inner", level: 1 },

sqlite-cloud/connect-cluster.mdx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ slug: connect-cluster
88

99
SQLite databases in SQLite Cloud are distributed across a cluster of nodes. Each cluster comes with a multi-region load balancer that routes traffic to the nearest appropriate node.
1010

11-
For this reason, we strongly recommend connecting to your cluster via your project connection string. To retrieve your project connection string, navigate to the **Nodes** page and click on any node.
12-
{/* ![Project connection string modal](@docs-website-assets/connect-cluster-1.png) */}
13-
14-
Copy the connection string and use it with a client library to connect to your cluster.
11+
Click "Connect" in the bottom left-hand corner of your dashboard to get your connection string to use with a SQLite Cloud client library.
1512

1613
## Connecting with JavaScript
1714
Here's an example of how you can connect to your cluster using the `@sqlitecloud/drivers` JavaScript client library:
@@ -63,4 +60,5 @@ conn.close()
6360
```
6461

6562
## Next Steps
63+
- [Creating a database](/docs/create-database)
6664
- [Writing data](/docs/write-data)

sqlite-cloud/create-database.mdx

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,25 @@ status: publish
66
slug: create-database
77
---
88

9-
SQLite Cloud allows you to import existing SQLite Databases, or create a new database in SQLite Cloud by importing an existing SQLite database, or using the SQLite Cloud UI, API, or client libraries.
9+
You can import an existing SQLite databases, or create new databases using the SQLite Cloud UI, API, or client libraries.
1010

11-
## Importing an existing SQLite database
12-
SQLite Cloud allows you to import existing SQLite databases into the platform.
11+
## Uploading an existing SQLite Database
12+
### Via HTTP API
13+
You can upload an existing SQLite database to your cluster using the SQLite Cloud UI or the Weblite API.
1314

14-
Note that you can download, modify, and re-upload the database file at any time. You can also upload encrypted SQLite databases if you used the official SEE SQLite encryption extension.
15+
To upload a local SQLite database via weblite, make a POST request to the `/v2/weblite/<database-name>.sqlite` endpoint.
1516

17+
```bash
18+
curl -X 'POST' \
19+
'https://<your-project-id>.sqlite.cloud:8090/v2/weblite/<database-name>.sqlite' \
20+
-H 'accept: application/json' \
21+
-H 'Authorization: Bearer sqlitecloud://<your-project-id>.sqlite.cloud:8860?apikey=<your-api-key>' \
22+
-d ''
23+
```
24+
25+
To upload a local SQLite database via the SQLite Cloud UI, navigate to the Database tab in the left-hand navigation. Click the "Upload Database" button and select your local SQLite database.
26+
27+
### Via Dashboard UI
1628
To import a database from the UI, navigate to the Databases tab and click the "Upload Database" button.
1729
![Dashbord Upload Database](@docs-website-assets/introduction/dashboard_upload_db.png)
1830

@@ -27,7 +39,7 @@ To create a new database from the SQLite Cloud UI, navigate to the Databases tab
2739
The default encoding is set to UTF-8, and the default page size is 4096KB.
2840

2941
### From the API
30-
To create a new database or upload an existing database via [Weblite](#), our REST API, you can make a request with the following parameters:
42+
To create a new database or upload an existing database via [Weblite](/docs/weblite), our REST API, you can make a request with the following parameters:
3143
```bash
3244
curl -X 'POST' \
3345
'https://<your-project-id>.sqlite.cloud:8090/v2/weblite/<database-name>.sqlite' \
@@ -37,17 +49,32 @@ curl -X 'POST' \
3749
```
3850

3951
### From client libraries
40-
To create a new database from a client library, use the CREATE DATABASE command.
52+
To create a new database from a client library, connect to your cluster using a connection string without a specified database.
53+
54+
Then, use the CREATE DATABASE command to create a new database.
55+
56+
To start using the database within the connection, you can use the `USE DATABASE` command.
4157

4258
```javascript
4359
import { Database } from '@sqlitecloud/drivers';
44-
60+
// note that no database name is specified in the connection string path
4561
const db = new Database('sqlitecloud://<your-project-id>.sqlite.cloud:<your-host-port>?apikey=<your-api-key>')
4662

4763
const createDatabase = async () => await db.sql`CREATE DATABASE <database-name>;`;
4864

4965
createDatabase().then((res) => console.log(res));
5066

5167
// "OK"
68+
69+
db.exec('USE DATABASE <database-name>;')
70+
71+
// now you can use the database
72+
const fetchAlbums = async () => await db.exec`SELECT * FROM albums;`;
73+
74+
fetchAlbums().then((albums) => console.log(albums));
75+
76+
// [{ Title: 'For Those About To Rock We Salute You', ... }, ...]
5277
```
5378

79+
## Next Steps
80+
- [Writing data](/docs/write-data)

sqlite-cloud/index.mdx

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Introduction to SQLite Cloud
2+
title: Getting Started with SQLite Cloud
33
description: SQLite Cloud is a distributed relational database system built on top of the SQLite database engine.
44
category: getting-started
55
status: publish
@@ -8,27 +8,22 @@ status: publish
88
## Overview
99
**SQLite Cloud** is a managed, distributed relational database system built on top of the SQLite database engine.
1010

11-
It has been designed from the ground up to ensure strong consistency across all nodes in a cluster while simultaneously managing the technical aspects of scaling, security, and data distribution. This ensures that you can focus on your core tasks while relying on **SQLite Cloud** to handle the complexities of managing your databases.
11+
It has been designed from the ground up to ensure strong consistency across all nodes in a cluster while simultaneously managing the technical aspects of scaling, security, and data distribution. This ensures that you can focus on your core tasks while relying on SQLite Cloud to handle the complexities of managing your databases.
1212

13-
**SQLite Cloud** is written in ANSI C and GO, and it works on most POSIX systems like Linux, *BSD, and Mac OS X (Windows is supported too). You can use **SQLite Cloud** from the most popular programming languages or its REST API.
13+
SQLite Cloud is built on the open source SQLite engine, ensuring complete feature parity. You get all of SQLite's core strengths: ACID compliance, support for complex SQL operations, and compatibility with the rich SQLite extension ecosystem.
1414

15-
---
16-
17-
## Architecture
18-
19-
**SQLite Cloud** uses the [Raft](https://raft.github.io) consensus algorithm to distribute your data changes across a cluster of computing systems, ensuring that each node in the cluster agrees upon the same series of state transitions. Raft implements consensus with a leader approach.
15+
You can access SQLite Cloud from the most popular programming languages or its REST API.
2016

21-
**SQLite Cloud** supports all the SQLite features without any limitations. It is fully ACID compliant, supports non-deterministic SQL statements, and guarantees strong consistency across all your cluster nodes. This ensures that data read from any node in the system returns the most up-to-date version of the data that has been committed.
17+
Like SQLite, each database in SQLite Cloud is a separate file, giving you flexible deployment options:
2218

23-
In a distributed database system, where data is distributed across multiple nodes, ensuring strong consistency can be challenging due to the potential for network delays, node failures, and concurrent transactions. Maintaining strong consistency is crucial for ensuring that the system behaves as expected and that applications built on top of the system can rely on the accuracy and integrity of the data.
19+
* Create separate databases for each customer in a multi-tenant application
20+
* Share a single database among multiple users with built-in access controls
21+
* Mix both approaches based on your application's needs
2422

25-
## Features
26-
SQLite Cloud provides a comprehensive suite of tools for building realtime, local-first applications.
27-
* **Local Sync**: Query your local SQLite database and synchronize with the cloud and across devices in real-time (**In development**).
28-
* **Offline-first**: Resolve conflicts between devices and the cloud with CRDTs (**In development**).
29-
* **[Webhooks](/docs/webhooks)**: Send changes to your database to external endpoints, or use to trigger edge functions via HTTP, Websockets, or on database events like INSERT, UPDATE, and DELETE.
30-
* **[Edge Functions](/docs/edge-functions)**: Run serverless functions on the same node that stores your data for low-latency operations. Trigger with webhooks or on database operations.
23+
### Features
24+
SQLite Cloud provides a comprehensive suite of tools for building realtime, local-first, edge AI applications.
25+
* **[Webhooks](/docs/webhooks)**: Trigger edge functions or send change payloads via HTTP, Websockets, or on database events like INSERT, UPDATE, and DELETE.
26+
* **[Edge Functions](/docs/edge-functions)**: Run serverless functions on the same nodes that store your data for lightning-fast data access.
3127
* **[Pub/Sub](/docs/pub-sub)**: Subscribe to changes in your database to replicate data, power notifications, and build multiplayer experiences.
32-
* **Weblite**: Autogenerated REST APIs to interact with your database and edge functions.
33-
* **[Query Analyzer](/docs/analyzer)**: Receive optimization recommendations for your queries to improve performance.
34-
* **Multi-region Load Balancer**: Connect to SQLite Cloud from anywhere in the world and SQLite Cloud automatically routes traffic to the nearest node for optimal performance.
28+
* **[Weblite](/docs/weblite)**: Autogenerated REST APIs to interact with the SQLite Cloud platform.
29+
* **[Query Analyzer](/docs/analyzer)**: Receive optimization recommendations for your queries to improve performance.

sqlite-cloud/introduction.mdx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
title: Introduction to SQLite Cloud
3+
description: SQLite Cloud is a distributed relational database system built on top of the SQLite database engine.
4+
category: getting-started
5+
status: publish
6+
slug: introduction
7+
---
8+
9+
## Overview
10+
**SQLite Cloud** is a managed, distributed relational database system built on top of the SQLite database engine.
11+
12+
It has been designed from the ground up to ensure strong consistency across all nodes in a cluster while simultaneously managing the technical aspects of scaling, security, and data distribution. This ensures that you can focus on your core tasks while relying on **SQLite Cloud** to handle the complexities of managing your databases.
13+
14+
**SQLite Cloud** is written in ANSI C and GO, and it works on most POSIX systems like Linux, *BSD, and Mac OS X (Windows is supported too). You can use **SQLite Cloud** from the most popular programming languages or its REST API.
15+
16+
---
17+
18+
## Architecture
19+
20+
**SQLite Cloud** uses the [Raft](https://raft.github.io) consensus algorithm to distribute your data changes across a cluster of computing systems, ensuring that each node in the cluster agrees upon the same series of state transitions. Raft implements consensus with a leader approach.
21+
22+
**SQLite Cloud** supports all the SQLite features without any limitations. It is fully ACID compliant, supports non-deterministic SQL statements, and guarantees strong consistency across all your cluster nodes. This ensures that data read from any node in the system returns the most up-to-date version of the data that has been committed.
23+
24+
In a distributed database system, where data is distributed across multiple nodes, ensuring strong consistency can be challenging due to the potential for network delays, node failures, and concurrent transactions. Maintaining strong consistency is crucial for ensuring that the system behaves as expected and that applications built on top of the system can rely on the accuracy and integrity of the data.
25+
26+
## Features
27+
SQLite Cloud provides a comprehensive suite of tools for building realtime, local-first applications.
28+
* **Local Sync**: Query your local SQLite database and synchronize with the cloud and across devices in real-time (**In development**).
29+
* **Offline-first**: Resolve conflicts between devices and the cloud with CRDTs (**In development**).
30+
* **[Webhooks](/docs/webhooks)**: Send changes to your database to external endpoints, or use to trigger edge functions via HTTP, Websockets, or on database events like INSERT, UPDATE, and DELETE.
31+
* **[Edge Functions](/docs/edge-functions)**: Run serverless functions on the same node that stores your data for low-latency operations. Trigger with webhooks or on database operations.
32+
* **[Pub/Sub](/docs/pub-sub)**: Subscribe to changes in your database to replicate data, power notifications, and build multiplayer experiences.
33+
* **Weblite**: Autogenerated REST APIs to interact with your database and edge functions.
34+
* **[Query Analyzer](/docs/analyzer)**: Receive optimization recommendations for your queries to improve performance.
35+
* **Multi-region Load Balancer**: Connect to SQLite Cloud from anywhere in the world and SQLite Cloud automatically routes traffic to the nearest node for optimal performance.

sqlite-cloud/platform/backups.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ slug: backups
77
---
88

99
## Overview
10-
Backups provide a robust solution for mitigating data loss and resolving data corruption issues.
10+
Backups provide a robust solution for mitigating data loss and resolving data corruption issues. Backups are available for databases in all [Pro and Scale](https://www.sqlitecloud.io/pricing) projects.
1111

1212
SQLite Cloud creates a full snapshot backup of your data once a day, and stores incremental changes once per second, on commodity object storage.
1313

sqlite-cloud/platform/edge-functions.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ status: publish
66
slug: edge-functions
77
---
88

9-
Edge Functions are server-side functions that run directly within your database environment. Edge functions in SQLite Cloud ensure maximum performance and minimal latency by running functions on the same server as your database.
9+
Edge functions let you define custom logic to run on the same nodes as your database files for ultra-fast performance.
1010

1111
You can write edge functions directly in the SQLite Cloud dashboard using JavaScript, TypeScript, or SQL. Importing modules is not currently supported.
1212

sqlite-cloud/platform/index.mdx

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
title: Platform
3+
description: Index page for platform section
4+
category: platform
5+
status: publish
6+
icon: docs-plat
7+
slug: platform
8+
---
9+
import IndexPage from "@docs-website-components/Docs/IndexPage.astro"
10+
11+
export const introduction = "SQLite Cloud is a distributed relational database system built on top of the SQLite database engine. It has been specifically designed from the ground up to ensure the strong consistency of your data across all nodes in a cluster while simultaneously managing the technical aspects of scaling, security, and data distribution."
12+
13+
export const sections = [
14+
{
15+
icon: "puzzle",
16+
title: "Edge Functions",
17+
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
18+
href: "/docs/edge-functions",
19+
},
20+
{
21+
icon: "puzzle",
22+
title: "Webhooks",
23+
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
24+
href: "/docs/webhooks",
25+
},
26+
{
27+
icon: "puzzle",
28+
title: "Pub/Sub",
29+
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
30+
href: "/docs/pub-sub",
31+
},
32+
{
33+
icon: "puzzle",
34+
title: "Vector",
35+
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
36+
href: "/docs/vector",
37+
},
38+
{
39+
icon: "puzzle",
40+
title: "Scaling",
41+
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
42+
href: "/docs/scaling",
43+
},
44+
{
45+
icon: "puzzle",
46+
title: "Security and Access Control",
47+
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
48+
href: "/docs/security",
49+
},
50+
{
51+
icon: "puzzle",
52+
title: "Backups",
53+
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
54+
href: "/docs/backups",
55+
},
56+
{
57+
icon: "puzzle",
58+
title: "Query Analyzer",
59+
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
60+
href: "/docs/analyzer",
61+
},
62+
{
63+
icon: "puzzle",
64+
title: "Extensions",
65+
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
66+
href: "/docs/extensions",
67+
},
68+
{
69+
icon: "puzzle",
70+
title: "Weblite",
71+
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
72+
href: "/docs/weblite",
73+
},
74+
{
75+
icon: "puzzle",
76+
title: "Settings",
77+
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
78+
href: "/docs/settings",
79+
},
80+
]
81+
82+
83+
<IndexPage introduction={introduction} sections={sections} />

0 commit comments

Comments
 (0)