{"id":22836548,"url":"https://github.com/outerbase/starbasedb","last_synced_at":"2025-04-14T01:50:16.702Z","repository":{"id":257982299,"uuid":"864969495","full_name":"outerbase/starbasedb","owner":"outerbase","description":"HTTP SQLite scale-to-zero database on the edge built on Cloudflare Durable Objects.","archived":false,"fork":false,"pushed_at":"2025-03-21T11:20:35.000Z","size":7081,"stargazers_count":980,"open_issues_count":19,"forks_count":29,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-04-06T23:02:08.998Z","etag":null,"topics":["cloudflare","database","durableobjects","sqlite"],"latest_commit_sha":null,"homepage":"https://starbasedb.com","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/outerbase.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-29T16:43:47.000Z","updated_at":"2025-04-03T18:02:46.000Z","dependencies_parsed_at":"2024-11-28T20:23:12.970Z","dependency_job_id":"ae502a60-25b3-4787-8ce7-29f6fbfad389","html_url":"https://github.com/outerbase/starbasedb","commit_stats":{"total_commits":85,"total_committers":3,"mean_commits":"28.333333333333332","dds":0.09411764705882353,"last_synced_commit":"fd3289006eb198cb5879f9c8386bdf0e551b7ece"},"previous_names":["brayden/starbasedb","outerbase/starbasedb"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outerbase%2Fstarbasedb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outerbase%2Fstarbasedb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outerbase%2Fstarbasedb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outerbase%2Fstarbasedb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/outerbase","download_url":"https://codeload.github.com/outerbase/starbasedb/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248809024,"owners_count":21164895,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloudflare","database","durableobjects","sqlite"],"created_at":"2024-12-12T23:11:31.344Z","updated_at":"2025-04-14T01:50:16.680Z","avatar_url":"https://github.com/outerbase.png","language":"TypeScript","readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://starbasedb.com\"\u003e\n    \u003cimg alt=\"StarbaseDB – Scale-to-zero HTTP SQLite database\" src=\"https://github.com/Brayden/starbasedb/blob/main/banner.png?raw=true\" width=\"1280\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003eStarbaseDB\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n  \u003ci\u003eOpen source, scale-to-zero, HTTP SQLite database built on top of \u003ca href=\"https://developers.cloudflare.com/durable-objects/\" target=\"_blank\"\u003eCloudflare Durable Objects\u003c/a\u003e.\u003c/i\u003e\n\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://github.com/Brayden/starbasedb/releases\"\u003e\u003cimg src=\"https://img.shields.io/github/v/release/Brayden/starbasedb?display_name=tag\u0026style=flat\"\u003e\u003c/img\u003e\u003c/a\u003e\n  \u003ca href=\"https://starbasedb.hashnode.space/default-guide/introduction/quick-start\"\u003e\u003cimg src=\"https://img.shields.io/static/v1?label=Read\u0026message=Documentation\u0026color=purple\u0026style=flat\"\u003e\u003c/img\u003e\u003c/a\u003e\n  \u003ca href=\"https://starbasedb.com\"\u003e\u003cimg src=\"https://img.shields.io/static/v1?label=Website\u0026message=StarbaseDB\u0026color=%23be185d\u0026style=flat\"\u003e\u003c/img\u003e\u003c/a\u003e\n  \u003ca href=\"https://twitter.com/BraydenWilmoth\"\u003e\u003cimg src=\"https://img.shields.io/static/v1?label=Follow\u0026message=@BraydenWilmoth\u0026color=black\u0026style=flat\"\u003e\u003c/img\u003e\u003c/a\u003e\n  \u003ca href=\"https://discord.gg/k2J7jcJCvd\"\u003e\u003cimg src=\"https://img.shields.io/static/v1?label=Join us on\u0026message=Discord\u0026color=%237289da\u0026style=flat\"\u003e\u003c/img\u003e\u003c/a\u003e\n  \u003ca href=\"https://outerbase.com\"\u003e\u003cimg src=\"https://img.shields.io/static/v1?label=Check out\u0026message=Outerbase\u0026color=gray\u0026style=flat\"\u003e\u003c/img\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n\u003cbr /\u003e\n\u003ch2\u003eFeatures\u003c/h2\u003e\n\u003cul\u003e\n  \u003cli\u003e\u003cstrong\u003e\u003ca href=\"https://starbasedb.hashnode.space/default-guide/http-endpoints/query\"\u003eHTTPS Endpoints\u003c/a\u003e\u003c/strong\u003e to query \u0026 interact with your database\u003c/li\u003e\n  \u003cli\u003e\u003cstrong\u003e\u003ca href=\"https://starbasedb.hashnode.space/default-guide/web-sockets/introduction\"\u003eWeb Socket Connections\u003c/a\u003e\u003c/strong\u003e to query your database with low-latency web sockets\u003c/li\u003e\n  \u003cli\u003e\u003cstrong\u003e\u003ca href=\"https://starbasedb.hashnode.space/default-guide/http-endpoints/transactions\"\u003eTransactions Support\u003c/a\u003e\u003c/strong\u003e for executing interdependent collections of queries\u003c/li\u003e\n  \u003cli\u003e\u003cstrong\u003e\u003ca href=\"https://starbasedb.hashnode.space/default-guide/rest-api/introduction\"\u003eREST API Support\u003c/a\u003e\u003c/strong\u003e automatically included for interacting with your tables\u003c/li\u003e\n  \u003cli\u003e\u003cstrong\u003e\u003ca href=\"https://github.com/Brayden/starbasedb/edit/main/README.md#deploy-a-starbasedb\"\u003eDatabase Interface\u003c/a\u003e\u003c/strong\u003e included out of the box deployed with your Cloudflare Worker\u003c/li\u003e\n  \u003cli\u003e\u003cstrong\u003e\u003ca href=\"https://starbasedb.hashnode.space/default-guide/import-export/sql-dump\"\u003eImport \u0026 Export Data\u003c/a\u003e\u003c/strong\u003e to import \u0026 extract your schema and data into a local `.sql`, `.json` or `.csv` file\u003c/li\u003e\n  \u003cli\u003e\u003cstrong\u003e\u003ca href=\"https://github.com/Brayden/starbasedb/pull/26\"\u003eBindable Microservices\u003c/a\u003e\u003c/strong\u003e via templates to kickstart development and own the logic (e.g. user authentication)\u003c/li\u003e\n  \u003cli\u003e\u003cstrong\u003e\u003ca href=\"https://starbasedb.hashnode.space/default-guide/introduction/connect-external-database\"\u003eConnect to External Databases\u003c/a\u003e\u003c/strong\u003e such as Postgres and MySQL and access it with the methods above\u003c/li\u003e\n  \u003cli\u003e\u003cstrong\u003eScale-to-zero Compute\u003c/strong\u003e to reduce costs when your database is not in use\u003c/li\u003e\n\u003c/ul\u003e\n\u003cbr /\u003e\n\u003cp\u003eThroughout building this offering we are documenting as much of the journey as possible. Join us in our adventure and join the conversation on talking through our design decisions as we continue to move fast. Find more details on how we implement core features \u003ca href=\"https://starbasedb.com/blog/\"\u003eon our blog\u003c/a\u003e.\u003c/p\u003e\n\n\u003cbr /\u003e\n\u003ch2\u003eRoadmap\u003c/h2\u003e\n\u003cul\u003e\n  \u003cli\u003e\u003cstrong\u003eMigrations\u003c/strong\u003e for applying schema updates in safe sequential order\u003c/li\u003e\n  \u003cli\u003e\u003cstrong\u003eJWT Authentication\u003c/strong\u003e template for quickly allowing user auth flows\u003c/li\u003e\n  \u003cli\u003e\u003cstrong\u003eRow Level Security (RLS)\u003c/strong\u003e template for preventing data access on unauthorized rows\u003c/li\u003e\n  \u003cli\u003e\u003cstrong\u003ePoint in Time Rollbacks\u003c/strong\u003e for rolling back your database to any minute in the past 30 days\u003c/li\u003e\n  \u003cli\u003e\u003cstrong\u003eData Replication\u003c/strong\u003e to scale reads beyond the 1,000 RPS limitation\u003c/li\u003e\n  \u003cli\u003e\u003cstrong\u003eData Syncing\u003c/strong\u003e between local source and your database\u003c/li\u003e\n  \u003cli\u003e\u003cstrong\u003eScheduled CRON Tasks\u003c/strong\u003e to execute code at desired intervals\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cbr /\u003e\n\u003cp\u003eThe above list is not an exhaustive list of features planned, but a glimpse at the direction we have in mind. We welcome any and all ideas from the community on what features or issues you would like to see be included as part of StarbaseDB. You can create new \u003ca href=\"https://github.com/Brayden/starbasedb/issues/new?assignees=\u0026labels=\u0026projects=\u0026template=bug_report.md\u0026title=\"\u003eBug Reports\u003c/a\u003e and \u003ca href=\"https://github.com/Brayden/starbasedb/issues/new?assignees=\u0026labels=\u0026projects=\u0026template=feature_request.md\u0026title=\"\u003eFeature Requests\u003c/a\u003e and each will be reviewed.\u003c/p\u003e\n\n\u003cbr /\u003e\n\u003ch2\u003eDeploy a StarbaseDB\u003c/h2\u003e\n\u003cp\u003eDeploying a new SQLite database instance to a Cloudflare Durable Object can be done via a single command:\u003c/p\u003e\n\n```bash\ncurl https://starbasedb.com/install.sh | bash\n```\n\n\u003cp\u003e\n  The above command will create two new resources in your Cloudflare account, a Worker and a Durable Object.\n  Your Worker will be what clients make network requests to for fetching data from your database, and the Durable\n  Object itself is the SQLite storage.\n\u003c/p\u003e\n\n\u003cp\u003eAfter your worker has been deployed, you'll receive a console message similar to the one below:\u003c/p\u003e\n\n\u003cpre\u003e\n\u003ccode\u003e\n==========================================\nWelcome to the StarbaseDB installation script!\n \nThis script will deploy a Cloudflare Worker and create an Outerbase Starlink session.\nIf you don't have a paid Cloudflare account, your deployment will fail.\n \nIMPORTANT: You _MUST_ have a paid Cloudflare account to use SQLite in Durable Objects.\n==========================================\n \nCloning the repository...\n \nPlease enter your Cloudflare account_id (from 'wrangler whoami' or the Cloudflare dashboard):\n{{YOUR_ACCOUNT_ID}}\n \nDeploying your worker...\nWorker deployed successfully at https://starbasedb.{YOUR-IDENTIFIER}.workers.dev.\n \n==========================================\n \nOuterbase Studio user account created!\nUse the following URL to view your database:\n\nhttps://starbasedb.{YOUR-IDENTIFIER}.workers.dev/studio\n\nUsername: admin\nPassword: password\n\nNOTE: You can change your Outerbase Studio password in the wrangler.toml file and redeploy.\n\n==========================================\n\u003c/code\u003e\n\u003c/pre\u003e\n\n\u003cbr /\u003e\n\u003ch2\u003eExecuting Queries\u003c/h2\u003e\n\u003cp\u003eStart executing queries against your database with the following cURL commands:\u003c/p\u003e\n\n\u003ch3\u003eCreate Table\u003c/h3\u003e\n\u003cpre\u003e\n\u003ccode\u003e\ncurl --location --request POST 'https://starbasedb.YOUR-ID-HERE.workers.dev/query' \\\n--header 'Content-Type: application/json' \\\n--header 'Authorization: Bearer ABC123' \\\n--data-raw '{\n    \"sql\": \"CREATE TABLE IF NOT EXISTS artist(artistid INTEGER PRIMARY KEY, artistname TEXT);\"\n}'\n\u003c/code\u003e\n\u003c/pre\u003e\n\n\u003ch3\u003eInsert Values\u003c/h3\u003e\n\u003cpre\u003e\n\u003ccode\u003e\ncurl --location --request POST 'https://starbasedb.YOUR-ID-HERE.workers.dev/query' \\\n--header 'Content-Type: application/json' \\\n--header 'Authorization: Bearer ABC123' \\\n--data-raw '{\n    \"sql\": \"INSERT INTO artist (artistid, artistname) VALUES (123, '\\''Alice'\\''), (456, '\\''Bob'\\''), (789, '\\''Charlie'\\'');\"\n}'\n\u003c/code\u003e\n\u003c/pre\u003e\n\n\u003ch3\u003eRetrieve Values\u003c/h3\u003e\n\u003cpre\u003e\n\u003ccode\u003e\ncurl --location --request POST 'https://starbasedb.YOUR-ID-HERE.workers.dev/query' \\\n--header 'Content-Type: application/json' \\\n--header 'Authorization: Bearer ABC123' \\\n--data-raw '{\n    \"sql\": \"SELECT * FROM artist WHERE artistid=$1;\",\n    \"params\": [123]\n}'\n\u003c/code\u003e\n\u003c/pre\u003e\n\n\u003ch3\u003eTransactions\u003c/h3\u003e\n\u003cpre\u003e\n\u003ccode\u003e\ncurl --location --request POST 'https://starbasedb.YOUR-ID-HERE.workers.dev/query' \\\n--header 'Content-Type: application/json' \\\n--header 'Authorization: Bearer ABC123' \\\n--data-raw '{\n    \"transaction\": [\n        {\n            \"sql\": \"SELECT * FROM artist WHERE artistid=$1;\",\n            \"params\": [123]\n        },\n        {\n            \"sql\": \"SELECT * FROM artist;\",\n            \"params\": []\n        }\n    ]\n}'\n\u003c/code\u003e\n\u003c/pre\u003e\n\n\u003ch3\u003eRaw Query Response\u003c/h3\u003e\n\u003cpre\u003e\n\u003ccode\u003e\ncurl --location --request POST 'https://starbasedb.YOUR-ID-HERE.workers.dev/query/raw' \\\n--header 'Content-Type: application/json' \\\n--header 'Authorization: Bearer ABC123' \\\n--data-raw '{\n    \"sql\": \"SELECT * FROM artist;\",\n    \"params\": []\n}'\n\u003c/code\u003e\n\u003c/pre\u003e\n\n\u003ch3\u003eWeb Sockets\u003c/h3\u003e\nBelow is an example HTML script function showing how you can connect via Web Sockets.\n\n```javascript\nlet socket\n\nfunction connectWebSocket() {\n    logMessage('Connecting to WebSocket...')\n\n    socket = new WebSocket(\n        'wss://starbasedb.YOUR-ID-HERE.workers.dev/socket?token=ABC123'\n    )\n\n    socket.onopen = function () {\n        logMessage('WebSocket connection opened.')\n    }\n\n    socket.onmessage = function (event) {\n        logMessage('Received: ' + event.data)\n    }\n\n    socket.onclose = function (event) {\n        logMessage(\n            `WebSocket closed with code: ${event.code}, reason: ${event.reason}`\n        )\n    }\n\n    socket.onerror = function (error) {\n        logMessage('WebSocket error: ' + error.message)\n    }\n}\n\nfunction sendMessage() {\n    const message = document.getElementById('messageInput').value\n    if (socket \u0026\u0026 socket.readyState === WebSocket.OPEN) {\n        logMessage('Sending: ' + message)\n\n        socket.send(\n            JSON.stringify({\n                sql: message,\n                params: [],\n                action: 'query',\n            })\n        )\n    } else {\n        logMessage('WebSocket is not open.')\n    }\n}\n\nwindow.onload = connectWebSocket\n```\n\n\u003ch3\u003eSQL Dump\u003c/h3\u003e\nYou can request a `database_dump.sql` file that exports your database schema and data into a single file.\n\n\u003cpre\u003e\n\u003ccode\u003e\ncurl --location 'https://starbasedb.YOUR-ID-HERE.workers.dev/export/dump' \\\n--header 'Authorization: Bearer ABC123' \\\n--output database_dump.sql\n\u003c/code\u003e\n\u003c/pre\u003e\n\n\u003ch3\u003eJSON Data Export\u003c/h3\u003e\n\u003cpre\u003e\n\u003ccode\u003e\ncurl --location 'https://starbasedb.YOUR-ID-HERE.workers.dev/export/json/users' \\\n--header 'Authorization: Bearer ABC123' \\\n--output output.json\n\u003c/code\u003e\n\u003c/pre\u003e\n\n\u003ch3\u003eCSV Data Export\u003c/h3\u003e\n\u003cpre\u003e\n\u003ccode\u003e\ncurl --location 'https://starbasedb.YOUR-ID-HERE.workers.dev/export/csv/users' \\\n--header 'Authorization: Bearer ABC123' \\\n--output output.csv\n\u003c/code\u003e\n\u003c/pre\u003e\n\n\u003ch3\u003eSQL Import\u003c/h3\u003e\n\u003cpre\u003e\n\u003ccode\u003e\ncurl --location 'https://starbasedb.YOUR-ID-HERE.workers.dev/import/dump' \\\n--header 'Authorization: Bearer ABC123' \\\n--form 'sqlFile=@\"./Desktop/sqldump.sql\"'\n\u003c/code\u003e\n\u003c/pre\u003e\n\n\u003cbr /\u003e\n\u003ch2\u003eContributing\u003c/h2\u003e\n\u003cp\u003eWe welcome contributions! Please refer to our \u003ca href=\"./CONTRIBUTING.md\"\u003eContribution Guide\u003c/a\u003e for more details.\u003c/p\u003e\n\n\u003cbr /\u003e\n\u003ch2\u003eLicense\u003c/h2\u003e\n\u003cp\u003eThis project is licensed under the AGPL-3.0 license. See the \u003ca href=\"./LICENSE\"\u003eLICENSE\u003c/a\u003e file for more info.\u003c/p\u003e\n\n\u003cbr /\u003e\n\u003ch2\u003eContributors\u003c/h2\u003e\n\u003cp\u003e\n  \u003cimg align=\"left\" src=\"https://contributors-img.web.app/image?repo=brayden/starbasedb\" alt=\"Contributors\"/\u003e\n\u003c/p\u003e\n","funding_links":[],"categories":["Libraries","TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fouterbase%2Fstarbasedb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fouterbase%2Fstarbasedb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fouterbase%2Fstarbasedb/lists"}