diff --git a/.github/workflows/search.yml b/.github/workflows/search.yml index 4a9ee05..903abdf 100644 --- a/.github/workflows/search.yml +++ b/.github/workflows/search.yml @@ -13,7 +13,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: sqlitecloud/docsearch-action@v4 + - uses: sqlitecloud/docsearch-action@v5 with: project-string: ${{ secrets.PROJECT_STRING }} base-url: ${{ vars.BASE_URL }} diff --git a/sqlite-cloud/platform/scaling.mdx b/_architecture.mdx similarity index 71% rename from sqlite-cloud/platform/scaling.mdx rename to _architecture.mdx index 122a8a3..6f37729 100644 --- a/sqlite-cloud/platform/scaling.mdx +++ b/_architecture.mdx @@ -1,11 +1,19 @@ --- -title: Scaling -description: How to scale your SQLite Cloud cluster. -category: platform -status: publish -slug: scaling +title: Architecture +description: SQLite Cloud Architecture +category: getting-started +status: draft +slug: architecture --- +## Architecture +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. + +SQLite Cloud is written in ANSI C and GO, and it works on most POSIX systems (Linux, *BSD, Mac OS X) and Windows. + +SQLite Cloud supports all the SQLite features without any limitations, including ACID compliance and non-deterministic SQL statements. + +## Scaling your cluster 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. ## Overview of Node types diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 80d7863..44ada7a 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -1,206 +1,625 @@ import type { SidebarNavStruct } from "@docs-website/types/sidebar-navigation"; const sidebarNav: SidebarNavStruct = [ - { title: "", type: "primary" }, - { title: "Getting Started", type: "secondary", icon: "docs-star" }, - { title: "Introduction", href: "/docs/sqlite-cloud", type: "inner", level: 0 }, // should be index page for /docs and highlight "introduction" in nav - { title: "Fundamentals", type: "inner", level: 0 }, - { title: "Connecting", filePath: "connect-cluster", type: "inner", level: 1 }, - { title: "Creating a database", filePath: "create-database", type: "inner", level: 1 }, - { title: "Writing data", filePath: "write-data", type: "inner", level: 1 }, - { title: "Quick Start Guides", type: "inner", level: 0 }, - { title: "CDN", filePath: "quick-start-cdn", type: "inner", level: 1 }, - { title: "Node.js", filePath: "quick-start-node", type: "inner", level: 1 }, - { title: "React", filePath: "quick-start-react", type: "inner", level: 1 }, - { title: "React Native", filePath: "quick-start-react-native", type: "inner", level: 1 }, - { title: "Apollo / GraphQL", filePath: "quick-start-apollo-graphql", type: "inner", level: 1 }, - { title: "Next.js", filePath: "quick-start-next", type: "inner", level: 1 }, - { title: "Django", filePath: "quick-start-django", type: "inner", level: 1 }, - { title: "Flask", filePath: "quick-start-flask", type: "inner", level: 1 }, - { title: "SQLAlchemy", filePath: "quick-start-sqlalchemy-orm", type: "inner", level: 1 }, - { title: "Streamlit", filePath: "quick-start-streamlit", type: "inner", level: 1 }, - { title: "PHP / Laravel", filePath: "quick-start-php-laravel", type: "inner", level: 1 }, - { title: "Gin", filePath: "quick-start-gin", type: "inner", level: 1 }, - { title: "Tutorials", type: "inner", level: 0 }, - { title: "Geopoly", filePath: "tutorial-geopoly", type: "inner", level: 1 }, - { title: "Integrations", type: "inner", level: 0 }, - { title: "Knex.js", filePath: "knex-integration", type: "inner", level: 1 }, - - { title: "Platform", type: "secondary", icon: "docs-plat" }, - { title: "Edge Functions", filePath: "edge-functions", type: "inner", level: 0 }, - { title: "Webhooks", filePath: "webhooks", type: "inner", level: 0 }, - { title: "Pub/Sub", filePath: "pub-sub", type: "inner", level: 0 }, - { title: "Vector", filePath: "vector", type: "inner", level: 0 }, - { title: "Scaling", type: "inner", filePath: "scaling", level: 0 }, - { title: "Security and Access Control", filePath: "security", type: "inner", level: 0 }, - { title: "Backups", filePath: "backups", type: "inner", level: 0 }, - { title: "Query Analyzer", filePath: "analyzer", type: "inner", level: 0 }, - { title: "Extensions", filePath: "extensions", type: "inner", level: 0 }, - { title: "Weblite", filePath: "weblite", type: "inner", level: 0 }, - // { title: "Storage", type: "inner", level: 0 }, - // { title: "Partitioning", type: "inner", level: 0 }, - { title: "Settings", filePath: "settings", type: "inner", level: 0 }, - - { title: "SDKs", type: "secondary", icon: "docs-sdk" }, - { title: "C/C++", type: "inner", level: 0 }, - { title: "Introduction", type: "inner", filePath: "sdk-c-introduction", level: 1, }, - { title: 'Basic APIs', type: "inner", level: 1 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudConnect', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudConnectWithString', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudExec', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudExecArray', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudUUID', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudDisconnect', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudConfig', type: "inner", level: 2 }, - - { title: 'Result APIs', type: "inner", level: 1 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudResultIsOK', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudResultIsError', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudResultType', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudResultLen', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudResultInt32', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudResultInt64', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudResultFloat', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudResultDouble', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudResultFree', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudResultDump', type: "inner", level: 2 }, - - { title: "Rowset APIs", type: "inner", level: 1 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetValueType', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetColumnName', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetValue', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetInt32Value', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetInt64Value', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetFloatValue', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetDoubleValue', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetDump', type: "inner", level: 2 }, - - - { title: "Array APIs", type: "inner", level: 1 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudArrayValueType', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudArrayCount', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudArrayValue', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudArrayInt32Value', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudArrayInt64Value', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudArrayFloatValue', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudArrayDoubleValue', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudArrayDump', type: "inner", level: 2 }, - - { title: "Error APIs", type: "inner", level: 1 }, - { title: 'SQCloudIsError', filePath: 'sqlite-cloud/sdks/c/SQCloudError', type: "inner", level: 2 }, - { title: 'SQCloudIsSQLiteError', filePath: 'sqlite-cloud/sdks/c/SQCloudError', type: "inner", level: 2 }, - { title: 'SQCloudErrorCode', filePath: 'sqlite-cloud/sdks/c/SQCloudError', type: "inner", level: 2 }, - { title: 'SQCloudExtendedErrorCode', filePath: 'sqlite-cloud/sdks/c/SQCloudError', type: "inner", level: 2 }, - { title: 'SQCloudErrorOffset', filePath: 'sqlite-cloud/sdks/c/SQCloudError', type: "inner", level: 2 }, - { title: 'SQCloudErrorMsg', filePath: 'sqlite-cloud/sdks/c/SQCloudError', type: "inner", level: 2 }, - - { title: "VM APIs", type: "inner", level: 1 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMCompile', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMStep', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMResult', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMClose', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMErrorMsg', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMErrorCode', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMIsReadOnly', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMIsExplain', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMIsFinalized', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMBindParameterCount', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMBindParameterIndex', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMBindParameterName', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMColumnCount', type: "inner", level: 2 }, - { title: 'SQCloudVMBindDouble', filePath: 'sqlite-cloud/sdks/c/SQCloudVMBind', type: "inner", level: 2 }, - { title: 'SQCloudVMBindInt', filePath: 'sqlite-cloud/sdks/c/SQCloudVMBind', type: "inner", level: 2 }, - { title: 'SQCloudVMBindInt64', filePath: 'sqlite-cloud/sdks/c/SQCloudVMBind', type: "inner", level: 2 }, - { title: 'SQCloudVMBindNull', filePath: 'sqlite-cloud/sdks/c/SQCloudVMBind', type: "inner", level: 2 }, - { title: 'SQCloudVMBindText', filePath: 'sqlite-cloud/sdks/c/SQCloudVMBind', type: "inner", level: 2 }, - { title: 'SQCloudVMBindBlob', filePath: 'sqlite-cloud/sdks/c/SQCloudVMBind', type: "inner", level: 2 }, - { title: 'SQCloudVMBindZeroBlob', filePath: 'sqlite-cloud/sdks/c/SQCloudVMBind', type: "inner", level: 2 }, - { title: 'SQCloudVMColumnBlob', filePath: 'sqlite-cloud/sdks/c/SQCloudVMColumn', type: "inner", level: 2 }, - { title: 'SQCloudVMColumnText', filePath: 'sqlite-cloud/sdks/c/SQCloudVMColumn', type: "inner", level: 2 }, - { title: 'SQCloudVMColumnDouble', filePath: 'sqlite-cloud/sdks/c/SQCloudVMColumn', type: "inner", level: 2 }, - { title: 'SQCloudVMColumnInt32', filePath: 'sqlite-cloud/sdks/c/SQCloudVMColumn', type: "inner", level: 2 }, - { title: 'SQCloudVMColumnInt64', filePath: 'sqlite-cloud/sdks/c/SQCloudVMColumn', type: "inner", level: 2 }, - { title: 'SQCloudVMColumnLen', filePath: 'sqlite-cloud/sdks/c/SQCloudVMColumn', type: "inner", level: 2 }, - { title: 'SQCloudVMColumnType', filePath: 'sqlite-cloud/sdks/c/SQCloudVMColumn', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMLastRowID', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMChanges', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMTotalChanges', type: "inner", level: 2 }, - { title: "Blob APIs", type: "inner", level: 1 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudBlobOpen', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudBlobReOpen', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudBlobClose', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudBlobBytes', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudBlobRead', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudBlobWrite', type: "inner", level: 2 }, - { title: "Pub/Sub APIs", type: "inner", level: 1 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudSetPubSubCallback', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudSetPubSubOnly', type: "inner", level: 2 }, - { title: "Upload/Download APIs", type: "inner", level: 1 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudUploadDatabase', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudDownloadDatabase', type: "inner", level: 2 }, - - { title: "JavaScript", type: "inner", level: 0 }, - { title: 'Introduction', type: "inner", filePath: "sdk-js-introduction", level: 1 }, - { title: "Quick Starts", type: "inner", level: 1 }, - { title: "React", ref: "/docs/quick-start-react", type: "inner", level: 2 }, - { title: "Node.js", ref: "/docs/quick-start-node", type: "inner", level: 2 }, - { title: "Next.js", ref: "/docs/quick-start-next", type: "inner", level: 2 }, - { title: "Tutorials", type: "inner", level: 1 }, - { title: "Using SQLite Extensions - Geopoly", ref: "/docs/tutorial-geopoly", type: "inner", level: 2 }, - { title: "Classes", type: "inner", level: 1 }, - { title: "Database", filePath: 'sqlite-cloud/sdks/js/classes/Database', type: "inner", level: 2 }, - { title: "SQLiteCloudConnection", filePath: 'sqlite-cloud/sdks/js/classes/SQLiteCloudConnection', type: "inner", level: 2 }, - { title: "SQLiteCloudError", filePath: 'sqlite-cloud/sdks/js/classes/SQLiteCloudError', type: "inner", level: 2 }, - { title: "SQLiteCloudRow", filePath: 'sqlite-cloud/sdks/js/classes/SQLiteCloudRow', type: "inner", level: 2 }, - { title: "SQLiteCloudRowset", filePath: 'sqlite-cloud/sdks/js/classes/SQLiteCloudRowset', type: "inner", level: 2 }, - { title: "SQLiteCloudStatement", filePath: 'sqlite-cloud/sdks/js/classes/Statement', type: "inner", level: 2 }, - - { title: 'Interfaces', type: "inner", level: 1 }, - { title: "SQLCloudRowsetMetadata", filePath: 'sqlite-cloud/sdks/js/interfaces/SQLCloudRowsetMetadata', type: "inner", level: 2 }, - { title: "SQLiteCloudConfig", filePath: 'sqlite-cloud/sdks/js/interfaces/SQLiteCloudConfig', type: "inner", level: 2 }, - { title: "Modules", filePath: "sdk-js-modules", type: "inner", level: 1 }, - - - { title: "Python", type: "inner", level: 0 }, - { title: 'Introduction', type: "inner", filePath: "sdk-python-introduction", level: 1 }, - { title: "Django", ref: "/docs/quick-start-django", type: "inner", level: 1 }, - { title: "Flask", ref: "/docs/quick-start-flask", type: "inner", level: 1 }, - { title: "SQLAlchemy", ref: "/docs/quick-start-sqlalchemy-orm", type: "inner", level: 1 }, - - { title: "Go", type: "inner", level: 0 }, - { title: 'Introduction', type: "inner", filePath: "sdk-go-introduction", level: 1 }, - - { title: "PHP", type: "inner", level: 0 }, - { title: 'Introduction', type: "inner", filePath: "sdk-php-introduction", level: 1 }, - { title: "Methods", filePath: "sdk-php-methods", type: "inner", level: 1 }, - - { title: "Swift", type: "inner", level: 0 }, - { title: 'Introduction', type: "inner", filePath: "sdk-swift-introduction", level: 1 }, - - { title: "Reference", type: "secondary", icon: "docs-ref" }, - { title: "Server-side Commands", type: "inner", level: 0 }, - { title: "Introduction", filePath: "server-side-commands", type: "inner", level: 1 }, - { title: "API Keys", filePath: "api-key-commands", type: "inner", level: 1 }, - { title: "Authentication", filePath: "auth-commands", type: "inner", level: 1 }, - { title: "Backups", filePath: "backup-commands", type: "inner", level: 1 }, - { title: "Cluster", filePath: "cluster-commands", type: "inner", level: 1 }, - { title: "Database", filePath: "database-commands", type: "inner", level: 1 }, - { title: "General Info", filePath: "general-commands", type: "inner", level: 1 }, - { title: "IP", filePath: "ip-commands", type: "inner", level: 1 }, - { title: "Logs", filePath: "log-commands", type: "inner", level: 1 }, - { title: "Plugins", filePath: "plugin-commands", type: "inner", level: 1 }, - { title: "Privileges", filePath: "privilege-commands", type: "inner", level: 1 }, - { title: "Pub/Sub", filePath: "pub-sub-commands", type: "inner", level: 1 }, - { title: "Query Analyzer", filePath: "query-analyzer-commands", type: "inner", level: 1 }, - { title: "Roles", filePath: "role-commands", type: "inner", level: 1 }, - { title: "Settings", filePath: "settings-commands", type: "inner", level: 1 }, - { title: "User", filePath: "user-commands", type: "inner", level: 1 }, - - { title: "CLI", type: "inner", level: 0 }, - { title: "Introduction", filePath: "cli-commands", type: "inner", level: 1 }, - - { title: "SQLite", type: "inner", level: 0, href: "/docs/sqlite/" } + { title: "", type: "primary" }, + { title: "Introduction", type: "secondary", icon: "docs-star" }, + { title: "Overview", href: "/docs/sqlite-cloud", type: "inner", level: 0 }, + { title: "Getting Started", type: "inner", level: 0 }, + { title: "Connecting", filePath: "connect-cluster", type: "inner", level: 1 }, + { + title: "Creating a database", + filePath: "create-database", + type: "inner", + level: 1, + }, + { title: "Writing data", filePath: "write-data", type: "inner", level: 1 }, + { title: "Quick Start Guides", type: "inner", level: 0 }, + { title: "CDN", filePath: "quick-start-cdn", type: "inner", level: 1 }, + { title: "Node.js", filePath: "quick-start-node", type: "inner", level: 1 }, + { title: "React", filePath: "quick-start-react", type: "inner", level: 1 }, + { + title: "React Native", + filePath: "quick-start-react-native", + type: "inner", + level: 1, + }, + { + title: "Apollo / GraphQL", + filePath: "quick-start-apollo-graphql", + type: "inner", + level: 1, + }, + { title: "Next.js", filePath: "quick-start-next", type: "inner", level: 1 }, + { title: "Django", filePath: "quick-start-django", type: "inner", level: 1 }, + { title: "Flask", filePath: "quick-start-flask", type: "inner", level: 1 }, + { + title: "SQLAlchemy", + filePath: "quick-start-sqlalchemy-orm", + type: "inner", + level: 1, + }, + { + title: "Streamlit", + filePath: "quick-start-streamlit", + type: "inner", + level: 1, + }, + { + title: "PHP / Laravel", + filePath: "quick-start-php-laravel", + type: "inner", + level: 1, + }, + { title: "Gin", filePath: "quick-start-gin", type: "inner", level: 1 }, + { title: "Tutorials", type: "inner", level: 0 }, + { title: "Geopoly", filePath: "tutorial-geopoly", type: "inner", level: 1 }, + { title: "Integrations", type: "inner", level: 0 }, + { title: "Knex.js", filePath: "knex-integration", type: "inner", level: 1 }, + { + title: "Platform", + filePath: "platform", + type: "secondary", + icon: "docs-plat", + }, + { + title: "Edge Functions", + filePath: "edge-functions", + type: "inner", + level: 0, + }, + { title: "Webhooks", filePath: "webhooks", type: "inner", level: 0 }, + { title: "Pub/Sub", filePath: "pub-sub", type: "inner", level: 0 }, + { title: "Vector", filePath: "vector", type: "inner", level: 0 }, + { title: "Scaling", type: "inner", filePath: "scaling", level: 0 }, + { + title: "Security and Access Control", + filePath: "security", + type: "inner", + level: 0, + }, + { title: "Backups", filePath: "backups", type: "inner", level: 0 }, + { title: "Query Analyzer", filePath: "analyzer", type: "inner", level: 0 }, + { title: "Extensions", filePath: "extensions", type: "inner", level: 0 }, + { title: "Weblite", filePath: "weblite", type: "inner", level: 0 }, + // { title: "Storage", type: "inner", level: 0 }, + // { title: "Partitioning", type: "inner", level: 0 }, + + { title: "SDKs", filePath: "sdks", type: "secondary", icon: "docs-sdk" }, + { title: "C/C++", type: "inner", level: 0 }, + { + title: "Introduction", + type: "inner", + filePath: "sdk-c-introduction", + level: 1, + }, + { title: "Basic APIs", type: "inner", level: 1 }, + { filePath: "sqlite-cloud/sdks/c/SQCloudConnect", type: "inner", level: 2 }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudConnectWithString", + type: "inner", + level: 2, + }, + { filePath: "sqlite-cloud/sdks/c/SQCloudExec", type: "inner", level: 2 }, + { filePath: "sqlite-cloud/sdks/c/SQCloudExecArray", type: "inner", level: 2 }, + { filePath: "sqlite-cloud/sdks/c/SQCloudUUID", type: "inner", level: 2 }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudDisconnect", + type: "inner", + level: 2, + }, + { filePath: "sqlite-cloud/sdks/c/SQCloudConfig", type: "inner", level: 2 }, + + { title: "Result APIs", type: "inner", level: 1 }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudResultIsOK", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudResultIsError", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudResultType", + type: "inner", + level: 2, + }, + { filePath: "sqlite-cloud/sdks/c/SQCloudResultLen", type: "inner", level: 2 }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudResultInt32", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudResultInt64", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudResultFloat", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudResultDouble", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudResultFree", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudResultDump", + type: "inner", + level: 2, + }, + + { title: "Rowset APIs", type: "inner", level: 1 }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudRowsetValueType", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudRowsetColumnName", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudRowsetValue", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudRowsetInt32Value", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudRowsetInt64Value", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudRowsetFloatValue", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudRowsetDoubleValue", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudRowsetDump", + type: "inner", + level: 2, + }, + + { title: "Array APIs", type: "inner", level: 1 }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudArrayValueType", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudArrayCount", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudArrayValue", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudArrayInt32Value", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudArrayInt64Value", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudArrayFloatValue", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudArrayDoubleValue", + type: "inner", + level: 2, + }, + { filePath: "sqlite-cloud/sdks/c/SQCloudArrayDump", type: "inner", level: 2 }, + + { title: "Error APIs", type: "inner", level: 1 }, + { + title: "SQCloudIsError", + filePath: "sqlite-cloud/sdks/c/SQCloudError", + type: "inner", + level: 2, + }, + { + title: "SQCloudIsSQLiteError", + filePath: "sqlite-cloud/sdks/c/SQCloudError", + type: "inner", + level: 2, + }, + { + title: "SQCloudErrorCode", + filePath: "sqlite-cloud/sdks/c/SQCloudError", + type: "inner", + level: 2, + }, + { + title: "SQCloudExtendedErrorCode", + filePath: "sqlite-cloud/sdks/c/SQCloudError", + type: "inner", + level: 2, + }, + { + title: "SQCloudErrorOffset", + filePath: "sqlite-cloud/sdks/c/SQCloudError", + type: "inner", + level: 2, + }, + { + title: "SQCloudErrorMsg", + filePath: "sqlite-cloud/sdks/c/SQCloudError", + type: "inner", + level: 2, + }, + + { title: "VM APIs", type: "inner", level: 1 }, + { filePath: "sqlite-cloud/sdks/c/SQCloudVMCompile", type: "inner", level: 2 }, + { filePath: "sqlite-cloud/sdks/c/SQCloudVMStep", type: "inner", level: 2 }, + { filePath: "sqlite-cloud/sdks/c/SQCloudVMResult", type: "inner", level: 2 }, + { filePath: "sqlite-cloud/sdks/c/SQCloudVMClose", type: "inner", level: 2 }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudVMErrorMsg", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudVMErrorCode", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudVMIsReadOnly", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudVMIsExplain", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudVMIsFinalized", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudVMBindParameterCount", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudVMBindParameterIndex", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudVMBindParameterName", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudVMColumnCount", + type: "inner", + level: 2, + }, + { + title: "SQCloudVMBindDouble", + filePath: "sqlite-cloud/sdks/c/SQCloudVMBind", + type: "inner", + level: 2, + }, + { + title: "SQCloudVMBindInt", + filePath: "sqlite-cloud/sdks/c/SQCloudVMBind", + type: "inner", + level: 2, + }, + { + title: "SQCloudVMBindInt64", + filePath: "sqlite-cloud/sdks/c/SQCloudVMBind", + type: "inner", + level: 2, + }, + { + title: "SQCloudVMBindNull", + filePath: "sqlite-cloud/sdks/c/SQCloudVMBind", + type: "inner", + level: 2, + }, + { + title: "SQCloudVMBindText", + filePath: "sqlite-cloud/sdks/c/SQCloudVMBind", + type: "inner", + level: 2, + }, + { + title: "SQCloudVMBindBlob", + filePath: "sqlite-cloud/sdks/c/SQCloudVMBind", + type: "inner", + level: 2, + }, + { + title: "SQCloudVMBindZeroBlob", + filePath: "sqlite-cloud/sdks/c/SQCloudVMBind", + type: "inner", + level: 2, + }, + { + title: "SQCloudVMColumnBlob", + filePath: "sqlite-cloud/sdks/c/SQCloudVMColumn", + type: "inner", + level: 2, + }, + { + title: "SQCloudVMColumnText", + filePath: "sqlite-cloud/sdks/c/SQCloudVMColumn", + type: "inner", + level: 2, + }, + { + title: "SQCloudVMColumnDouble", + filePath: "sqlite-cloud/sdks/c/SQCloudVMColumn", + type: "inner", + level: 2, + }, + { + title: "SQCloudVMColumnInt32", + filePath: "sqlite-cloud/sdks/c/SQCloudVMColumn", + type: "inner", + level: 2, + }, + { + title: "SQCloudVMColumnInt64", + filePath: "sqlite-cloud/sdks/c/SQCloudVMColumn", + type: "inner", + level: 2, + }, + { + title: "SQCloudVMColumnLen", + filePath: "sqlite-cloud/sdks/c/SQCloudVMColumn", + type: "inner", + level: 2, + }, + { + title: "SQCloudVMColumnType", + filePath: "sqlite-cloud/sdks/c/SQCloudVMColumn", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudVMLastRowID", + type: "inner", + level: 2, + }, + { filePath: "sqlite-cloud/sdks/c/SQCloudVMChanges", type: "inner", level: 2 }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudVMTotalChanges", + type: "inner", + level: 2, + }, + { title: "Blob APIs", type: "inner", level: 1 }, + { filePath: "sqlite-cloud/sdks/c/SQCloudBlobOpen", type: "inner", level: 2 }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudBlobReOpen", + type: "inner", + level: 2, + }, + { filePath: "sqlite-cloud/sdks/c/SQCloudBlobClose", type: "inner", level: 2 }, + { filePath: "sqlite-cloud/sdks/c/SQCloudBlobBytes", type: "inner", level: 2 }, + { filePath: "sqlite-cloud/sdks/c/SQCloudBlobRead", type: "inner", level: 2 }, + { filePath: "sqlite-cloud/sdks/c/SQCloudBlobWrite", type: "inner", level: 2 }, + { title: "Pub/Sub APIs", type: "inner", level: 1 }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudSetPubSubCallback", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudSetPubSubOnly", + type: "inner", + level: 2, + }, + { title: "Upload/Download APIs", type: "inner", level: 1 }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudUploadDatabase", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudDownloadDatabase", + type: "inner", + level: 2, + }, + + { title: "JavaScript", type: "inner", level: 0 }, + { + title: "Introduction", + type: "inner", + filePath: "sdk-js-introduction", + level: 1, + }, + { title: "Quick Starts", type: "inner", level: 1 }, + { title: "React", ref: "/docs/quick-start-react", type: "inner", level: 2 }, + { title: "Node.js", ref: "/docs/quick-start-node", type: "inner", level: 2 }, + { title: "Next.js", ref: "/docs/quick-start-next", type: "inner", level: 2 }, + { title: "Tutorials", type: "inner", level: 1 }, + { + title: "Using SQLite Extensions - Geopoly", + ref: "/docs/tutorial-geopoly", + type: "inner", + level: 2, + }, + { title: "Classes", type: "inner", level: 1 }, + { + title: "Database", + filePath: "sqlite-cloud/sdks/js/classes/Database", + type: "inner", + level: 2, + }, + { + title: "SQLiteCloudConnection", + filePath: "sqlite-cloud/sdks/js/classes/SQLiteCloudConnection", + type: "inner", + level: 2, + }, + { + title: "SQLiteCloudError", + filePath: "sqlite-cloud/sdks/js/classes/SQLiteCloudError", + type: "inner", + level: 2, + }, + { + title: "SQLiteCloudRow", + filePath: "sqlite-cloud/sdks/js/classes/SQLiteCloudRow", + type: "inner", + level: 2, + }, + { + title: "SQLiteCloudRowset", + filePath: "sqlite-cloud/sdks/js/classes/SQLiteCloudRowset", + type: "inner", + level: 2, + }, + { + title: "SQLiteCloudStatement", + filePath: "sqlite-cloud/sdks/js/classes/Statement", + type: "inner", + level: 2, + }, + + { title: "Interfaces", type: "inner", level: 1 }, + { + title: "SQLCloudRowsetMetadata", + filePath: "sqlite-cloud/sdks/js/interfaces/SQLCloudRowsetMetadata", + type: "inner", + level: 2, + }, + { + title: "SQLiteCloudConfig", + filePath: "sqlite-cloud/sdks/js/interfaces/SQLiteCloudConfig", + type: "inner", + level: 2, + }, + { title: "Modules", filePath: "sdk-js-modules", type: "inner", level: 1 }, + + { title: "Python", type: "inner", level: 0 }, + { + title: "Introduction", + type: "inner", + filePath: "sdk-python-introduction", + level: 1, + }, + { title: "Django", ref: "/docs/quick-start-django", type: "inner", level: 1 }, + { title: "Flask", ref: "/docs/quick-start-flask", type: "inner", level: 1 }, + { + title: "SQLAlchemy", + ref: "/docs/quick-start-sqlalchemy-orm", + type: "inner", + level: 1, + }, + + { title: "Go", type: "inner", level: 0 }, + { + title: "Introduction", + type: "inner", + filePath: "sdk-go-introduction", + level: 1, + }, + + { title: "PHP", type: "inner", level: 0 }, + { + title: "Introduction", + type: "inner", + filePath: "sdk-php-introduction", + level: 1, + }, + { title: "Methods", filePath: "sdk-php-methods", type: "inner", level: 1 }, + + { title: "Swift", type: "inner", level: 0 }, + { + title: "Introduction", + type: "inner", + filePath: "sdk-swift-introduction", + level: 1, + }, + + { + title: "Reference", + filePath: "reference", + type: "secondary", + icon: "docs-ref", + }, + { title: "Server-side Commands", type: "inner", level: 0 }, + { + title: "Introduction", + filePath: "server-side-commands", + type: "inner", + level: 1, + }, + { title: "API Keys", filePath: "api-key-commands", type: "inner", level: 1 }, + { + title: "Authentication", + filePath: "auth-commands", + type: "inner", + level: 1, + }, + { title: "Backups", filePath: "backup-commands", type: "inner", level: 1 }, + { title: "Cluster", filePath: "cluster-commands", type: "inner", level: 1 }, + { title: "Database", filePath: "database-commands", type: "inner", level: 1 }, + { + title: "General Info", + filePath: "general-commands", + type: "inner", + level: 1, + }, + { title: "IP", filePath: "ip-commands", type: "inner", level: 1 }, + { title: "Logs", filePath: "log-commands", type: "inner", level: 1 }, + { title: "Plugins", filePath: "plugin-commands", type: "inner", level: 1 }, + { + title: "Privileges", + filePath: "privilege-commands", + type: "inner", + level: 1, + }, + { title: "Pub/Sub", filePath: "pub-sub-commands", type: "inner", level: 1 }, + { + title: "Query Analyzer", + filePath: "query-analyzer-commands", + type: "inner", + level: 1, + }, + { title: "Roles", filePath: "role-commands", type: "inner", level: 1 }, + { title: "Settings", filePath: "settings-commands", type: "inner", level: 1 }, + { title: "User", filePath: "user-commands", type: "inner", level: 1 }, + + { title: "CLI", type: "inner", level: 0 }, + { title: "Introduction", filePath: "cli-commands", type: "inner", level: 1 }, + + { title: "SQLite", type: "inner", level: 0, href: "/docs/sqlite/" }, ]; -export default sidebarNav +export default sidebarNav; diff --git a/sqlite-cloud/connect-cluster.mdx b/sqlite-cloud/connect-cluster.mdx index 8a75622..6fa8f72 100644 --- a/sqlite-cloud/connect-cluster.mdx +++ b/sqlite-cloud/connect-cluster.mdx @@ -8,10 +8,7 @@ slug: connect-cluster 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. -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. -{/* ![Project connection string modal](@docs-website-assets/connect-cluster-1.png) */} - -Copy the connection string and use it with a client library to connect to your cluster. +Click "Connect" in the bottom left-hand corner of your dashboard to get your connection string to use with a SQLite Cloud client library. ## Connecting with JavaScript 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() ``` ## Next Steps +- [Creating a database](/docs/create-database) - [Writing data](/docs/write-data) diff --git a/sqlite-cloud/create-database.mdx b/sqlite-cloud/create-database.mdx index d2d7167..852f8f4 100644 --- a/sqlite-cloud/create-database.mdx +++ b/sqlite-cloud/create-database.mdx @@ -6,13 +6,25 @@ status: publish slug: create-database --- -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. +You can import an existing SQLite databases, or create new databases using the SQLite Cloud UI, API, or client libraries. -## Importing an existing SQLite database -SQLite Cloud allows you to import existing SQLite databases into the platform. +## Uploading an existing SQLite Database +### Via HTTP API +You can upload an existing SQLite database to your cluster using the SQLite Cloud UI or the Weblite API. -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. +To upload a local SQLite database via weblite, make a POST request to the `/v2/weblite/.sqlite` endpoint. +```bash +curl -X 'POST' \ + 'https://.sqlite.cloud:8090/v2/weblite/.sqlite' \ + -H 'accept: application/json' \ + -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' \ + -d '' +``` + +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. + +### Via Dashboard UI To import a database from the UI, navigate to the Databases tab and click the "Upload Database" button. ![Dashbord Upload Database](@docs-website-assets/introduction/dashboard_upload_db.png) @@ -27,7 +39,7 @@ To create a new database from the SQLite Cloud UI, navigate to the Databases tab The default encoding is set to UTF-8, and the default page size is 4096KB. ### From the API -To create a new database or upload an existing database via [Weblite](#), our REST API, you can make a request with the following parameters: +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: ```bash curl -X 'POST' \ 'https://.sqlite.cloud:8090/v2/weblite/.sqlite' \ @@ -37,11 +49,15 @@ curl -X 'POST' \ ``` ### From client libraries -To create a new database from a client library, use the CREATE DATABASE command. +To create a new database from a client library, connect to your cluster using a connection string without a specified database. + +Then, use the CREATE DATABASE command to create a new database. + +To start using the database within the connection, you can use the `USE DATABASE` command. ```javascript import { Database } from '@sqlitecloud/drivers'; - +// note that no database name is specified in the connection string path const db = new Database('sqlitecloud://.sqlite.cloud:?apikey=') const createDatabase = async () => await db.sql`CREATE DATABASE ;`; @@ -49,5 +65,16 @@ const createDatabase = async () => await db.sql`CREATE DATABASE ; createDatabase().then((res) => console.log(res)); // "OK" + +db.exec('USE DATABASE ;') + +// now you can use the database +const fetchAlbums = async () => await db.exec`SELECT * FROM albums;`; + +fetchAlbums().then((albums) => console.log(albums)); + +// [{ Title: 'For Those About To Rock We Salute You', ... }, ...] ``` +## Next Steps +- [Writing data](/docs/write-data) diff --git a/sqlite-cloud/index.mdx b/sqlite-cloud/index.mdx index ee4cd6d..846ab7f 100644 --- a/sqlite-cloud/index.mdx +++ b/sqlite-cloud/index.mdx @@ -1,5 +1,5 @@ --- -title: Introduction to SQLite Cloud +title: Getting Started with SQLite Cloud description: SQLite Cloud is a distributed relational database system built on top of the SQLite database engine. category: getting-started status: publish @@ -8,27 +8,22 @@ status: publish ## Overview **SQLite Cloud** is a managed, distributed relational database system built on top of the SQLite database engine. -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. +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. -**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. +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. ---- - -## Architecture - -**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. +You can access SQLite Cloud from the most popular programming languages or its REST API. -**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. +Like SQLite, each database in SQLite Cloud is a separate file, giving you flexible deployment options: -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. +* Create separate databases for each customer in a multi-tenant application +* Share a single database among multiple users with built-in access controls +* Mix both approaches based on your application's needs -## Features -SQLite Cloud provides a comprehensive suite of tools for building realtime, local-first applications. -* **Local Sync**: Query your local SQLite database and synchronize with the cloud and across devices in real-time (**In development**). -* **Offline-first**: Resolve conflicts between devices and the cloud with CRDTs (**In development**). -* **[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. -* **[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. +### Features +SQLite Cloud provides a comprehensive suite of tools for building realtime, local-first, edge AI applications. +* **[Webhooks](/docs/webhooks)**: Trigger edge functions or send change payloads via HTTP, Websockets, or on database events like INSERT, UPDATE, and DELETE. +* **[Edge Functions](/docs/edge-functions)**: Run serverless functions on the same nodes that store your data for lightning-fast data access. * **[Pub/Sub](/docs/pub-sub)**: Subscribe to changes in your database to replicate data, power notifications, and build multiplayer experiences. -* **Weblite**: Autogenerated REST APIs to interact with your database and edge functions. -* **[Query Analyzer](/docs/analyzer)**: Receive optimization recommendations for your queries to improve performance. -* **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. +* **[Weblite](/docs/weblite)**: Autogenerated REST APIs to interact with the SQLite Cloud platform. +* **[Query Analyzer](/docs/analyzer)**: Receive optimization recommendations for your queries to improve performance. \ No newline at end of file diff --git a/sqlite-cloud/introduction.mdx b/sqlite-cloud/introduction.mdx new file mode 100644 index 0000000..04228a3 --- /dev/null +++ b/sqlite-cloud/introduction.mdx @@ -0,0 +1,35 @@ +--- +title: Introduction to SQLite Cloud +description: SQLite Cloud is a distributed relational database system built on top of the SQLite database engine. +category: getting-started +status: publish +slug: introduction +--- + +## Overview +**SQLite Cloud** is a managed, distributed relational database system built on top of the SQLite database engine. + +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. + +**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. + +--- + +## Architecture + +**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. + +**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. + +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. + +## Features +SQLite Cloud provides a comprehensive suite of tools for building realtime, local-first applications. +* **Local Sync**: Query your local SQLite database and synchronize with the cloud and across devices in real-time (**In development**). +* **Offline-first**: Resolve conflicts between devices and the cloud with CRDTs (**In development**). +* **[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. +* **[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. +* **[Pub/Sub](/docs/pub-sub)**: Subscribe to changes in your database to replicate data, power notifications, and build multiplayer experiences. +* **Weblite**: Autogenerated REST APIs to interact with your database and edge functions. +* **[Query Analyzer](/docs/analyzer)**: Receive optimization recommendations for your queries to improve performance. +* **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. diff --git a/sqlite-cloud/platform/_wip-index-with-card.mdx b/sqlite-cloud/platform/_wip-index-with-card.mdx new file mode 100644 index 0000000..875df1e --- /dev/null +++ b/sqlite-cloud/platform/_wip-index-with-card.mdx @@ -0,0 +1,84 @@ +--- +title: Platform +description: Index page for platform section +category: platform +status: publish +icon: docs-plat +slug: platform +--- +import IndexPage from "@docs-website-components/Docs/IndexPage.astro" + + +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." + +export const sections = [ + { + icon: "puzzle", + title: "Edge Functions", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/edge-functions", + }, + { + icon: "puzzle", + title: "Webhooks", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/webhooks", + }, + { + icon: "puzzle", + title: "Pub/Sub", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/pub-sub", + }, + { + icon: "puzzle", + title: "Vector", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/vector", + }, + { + icon: "puzzle", + title: "Scaling", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/scaling", + }, + { + icon: "puzzle", + title: "Security and Access Control", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/security", + }, + { + icon: "puzzle", + title: "Backups", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/backups", + }, + { + icon: "puzzle", + title: "Query Analyzer", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/analyzer", + }, + { + icon: "puzzle", + title: "Extensions", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/extensions", + }, + { + icon: "puzzle", + title: "Weblite", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/weblite", + }, + { + icon: "puzzle", + title: "Settings", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/settings", + }, +] + + + \ No newline at end of file diff --git a/sqlite-cloud/platform/backups.mdx b/sqlite-cloud/platform/backups.mdx index b726ff8..969d7e1 100644 --- a/sqlite-cloud/platform/backups.mdx +++ b/sqlite-cloud/platform/backups.mdx @@ -7,7 +7,7 @@ slug: backups --- ## Overview -Backups provide a robust solution for mitigating data loss and resolving data corruption issues. +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. SQLite Cloud creates a full snapshot backup of your data once a day, and stores incremental changes once per second, on commodity object storage. diff --git a/sqlite-cloud/platform/edge-functions.mdx b/sqlite-cloud/platform/edge-functions.mdx index fd8e721..5f2def1 100644 --- a/sqlite-cloud/platform/edge-functions.mdx +++ b/sqlite-cloud/platform/edge-functions.mdx @@ -6,7 +6,7 @@ status: publish slug: edge-functions --- -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. +Edge functions let you define custom logic to run on the same nodes as your database files for ultra-fast performance. You can write edge functions directly in the SQLite Cloud dashboard using JavaScript, TypeScript, or SQL. Importing modules is not currently supported. diff --git a/sqlite-cloud/platform/index.mdx b/sqlite-cloud/platform/index.mdx new file mode 100644 index 0000000..ec07706 --- /dev/null +++ b/sqlite-cloud/platform/index.mdx @@ -0,0 +1,83 @@ +--- +title: Platform +description: Index page for platform section +category: platform +status: publish +icon: docs-plat +slug: platform +--- +import IndexPage from "@docs-website-components/Docs/IndexPage.astro" + +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." + +export const sections = [ + { + icon: "puzzle", + title: "Edge Functions", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/edge-functions", + }, + { + icon: "puzzle", + title: "Webhooks", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/webhooks", + }, + { + icon: "puzzle", + title: "Pub/Sub", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/pub-sub", + }, + { + icon: "puzzle", + title: "Vector", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/vector", + }, + { + icon: "puzzle", + title: "Scaling", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/scaling", + }, + { + icon: "puzzle", + title: "Security and Access Control", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/security", + }, + { + icon: "puzzle", + title: "Backups", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/backups", + }, + { + icon: "puzzle", + title: "Query Analyzer", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/analyzer", + }, + { + icon: "puzzle", + title: "Extensions", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/extensions", + }, + { + icon: "puzzle", + title: "Weblite", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/weblite", + }, + { + icon: "puzzle", + title: "Settings", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/settings", + }, +] + + + \ No newline at end of file diff --git a/sqlite-cloud/platform/settings.mdx b/sqlite-cloud/platform/settings.mdx deleted file mode 100644 index 3e1cc46..0000000 --- a/sqlite-cloud/platform/settings.mdx +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: Settings -description: The Settings panel displays a list of all the settings currently applied to your cluster. -category: platform -status: publish -slug: settings ---- - -The Settings panel displays a list of all the settings currently applied to your cluster. You have the option to modify each setting individually or reset them to their default values. - -![Dashboard Settings](@docs-website-assets/introduction/dashboard_settings.png) \ No newline at end of file diff --git a/sqlite-cloud/platform/webhooks.mdx b/sqlite-cloud/platform/webhooks.mdx index e306a7d..f805bd3 100644 --- a/sqlite-cloud/platform/webhooks.mdx +++ b/sqlite-cloud/platform/webhooks.mdx @@ -6,14 +6,10 @@ status: publish slug: webhooks --- -Utilize the Webhooks panel to effortlessly establish real-time notifications for write operations within your SQLite database. In this instance, we'll seamlessly notify a webhook.site service each time a write operation occurs within the albums table of the chinook.sqlite database. +Webhooks in SQLite Cloud are a powerful way to receive and send event-based notifications. -![Dashboard Projects](@docs-website-assets/introduction/dashboard_webhook_create.png) +## Change Data Capture +With change data webhooks, you can send notifications from SQLite Cloud to any HTTP endpoint when an insert, update or delete operation occurs on a specified database and/or table. The webhook payload includes the database name, table name, and the row data that was changed. -Upon creation, you'll receive a secret value that ensures the authenticity of each notification request. - -![Dashboard Projects](@docs-website-assets/introduction/dashboard_webhook_create2.png) - -Additionally, access a comprehensive list of all enabled webhooks for your project. - -![Dashboard Projects](@docs-website-assets/introduction/dashboard_webhook_list.png) \ No newline at end of file +## Trigger Edge Functions +Webhooks can also be used to trigger your edge functions, either via HTTP or Websockets request, or on a database event. \ No newline at end of file diff --git a/sqlite-cloud/reference/index.mdx b/sqlite-cloud/reference/index.mdx new file mode 100644 index 0000000..f6669b2 --- /dev/null +++ b/sqlite-cloud/reference/index.mdx @@ -0,0 +1,35 @@ +--- +title: Reference +description: Index page for reference section +category: reference +status: publish +icon: docs-ref +slug: reference +--- +import IndexPage from "@docs-website-components/Docs/IndexPage.astro" + +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." + +export const sections = [ + { + icon: "curvedArrow", + title: "Server-side Commands", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/server-side-commands", + }, + { + icon: "twoColsGrid", + title: "CLI", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/cli-commands", + }, + { + icon: "sqlite-stacked", + title: "SQLite", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/sqlite", + }, +] + + + \ No newline at end of file diff --git a/sqlite-cloud/sdks/index.mdx b/sqlite-cloud/sdks/index.mdx new file mode 100644 index 0000000..0556522 --- /dev/null +++ b/sqlite-cloud/sdks/index.mdx @@ -0,0 +1,53 @@ +--- +title: SDKs +description: Index page for sdks section +category: sdks +status: publish +icon: docs-sdks +slug: sdks +--- +import IndexPage from "@docs-website-components/Docs/IndexPage.astro" + +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." + +export const sections = [ + { + icon: "docsSdkC", + title: "C/C++", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/sdk-c-introduction", + }, + { + icon: "docsSdkJs", + title: "JavaScript", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/sdk-js-introduction", + }, + { + icon: "docsSdkPython", + title: "Python", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/sdk-python-introduction", + }, + { + icon: "docsSdkGo", + title: "Go", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/sdk-go-introduction", + }, + { + icon: "docsSdkPhp", + title: "PHP", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/sdk-php-introduction", + }, + { + icon: "docsSdkSwift", + title: "Swift", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/sdk-swift-introduction", + }, +] + + + \ No newline at end of file diff --git a/sqlite-cloud/write-data.mdx b/sqlite-cloud/write-data.mdx index 32bd329..01a7c62 100644 --- a/sqlite-cloud/write-data.mdx +++ b/sqlite-cloud/write-data.mdx @@ -8,21 +8,6 @@ slug: write-data After you've created a database in SQLite Cloud, you can start writing data to it. You can write data to your cluster using the SQLite Cloud UI, API, or client libraries. -## Upload an existing SQLite Database -You can upload an existing SQLite database to your cluster using the SQLite Cloud UI or the Weblite API. - -To upload a local SQLite database via weblite, make a POST request to the `/v2/weblite/.sqlite` endpoint. - -```bash -curl -X 'POST' \ - 'https://.sqlite.cloud:8090/v2/weblite/.sqlite' \ - -H 'accept: application/json' \ - -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=.sqlite; -- Create your table -CREATE TABLE sports_cars (sc_id INTEGER PRIMARY KEY, sc_name TEXT NOT NULL, sc_year INTEGER NOT NULL, image BLOB); +CREATE TABLE sports_cars (sc_id INTEGER PRIMARY KEY, sc_make TEXT NOT NULL, sc_year INTEGER NOT NULL); -- Insert data into your table -INSERT INTO sports_cars (sc_name, sc_year, image) VALUES ('Ferrari', 2021, 'https://example.com/ferrari.jpg'); +INSERT INTO sports_cars (sc_make, sc_year) VALUES ('Ferrari', 2021); ``` ## Writing data with the Weblite API -You can use the API to run SQL commands against your cluster. +You can use the [Weblite API](/docs/weblite) to run SQL commands against your cluster. Here is an example cURL request: ```bash curl -X 'POST' \ @@ -56,10 +41,10 @@ To write data to your cluster using a client library, use the INSERT INTO SQL co import { Database } from '@sqlitecloud/drivers'; const db = new Database('sqlitecloud://.sqlite.cloud:?apikey=') -db.exec('USE DATABASE mydatabase.sqlite;') -db.exec('CREATE TABLE sports_cars (sc_id INTEGER PRIMARY KEY, sc_name TEXT NOT NULL, sc_year INTEGER NOT NULL, image BLOB);') +db.exec('USE DATABASE .sqlite;') +db.exec('CREATE TABLE sports_cars (sc_id INTEGER PRIMARY KEY, sc_make TEXT NOT NULL, sc_year INTEGER NOT NULL);') db.commit() -const insertData = async () => await db.sql`INSERT INTO sports_cars (sc_name, sc_year, image) VALUES ('Ferrari', 2021, 'https://example.com/ferrari.jpg');`; +const insertData = async () => await db.sql`INSERT INTO sports_cars (sc_make, sc_year) VALUES ('Ferrari', 2021);`; insertData().then((res) => console.log(res)); // "OK"