{"id":16877047,"url":"https://github.com/penberg/future-frontend-sqlite-demo","last_synced_at":"2025-04-11T11:33:49.025Z","repository":{"id":219083206,"uuid":"748084219","full_name":"penberg/future-frontend-sqlite-demo","owner":"penberg","description":"Future Frontend January 2024 meetup SQLite demo app","archived":false,"fork":false,"pushed_at":"2024-02-28T10:49:12.000Z","size":2116,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-25T07:51:14.836Z","etag":null,"topics":["drizzle","drizzle-orm","edge","edge-computing","libsql","sqlite","sqlite3"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/penberg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-01-25T08:38:55.000Z","updated_at":"2025-03-13T15:09:14.000Z","dependencies_parsed_at":"2024-01-29T10:45:38.073Z","dependency_job_id":"30bec427-49f3-40e7-a717-a479aee7f652","html_url":"https://github.com/penberg/future-frontend-sqlite-demo","commit_stats":null,"previous_names":["penberg/future-frontend-sqlite-demo"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/penberg%2Ffuture-frontend-sqlite-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/penberg%2Ffuture-frontend-sqlite-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/penberg%2Ffuture-frontend-sqlite-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/penberg%2Ffuture-frontend-sqlite-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/penberg","download_url":"https://codeload.github.com/penberg/future-frontend-sqlite-demo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248384257,"owners_count":21094692,"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":["drizzle","drizzle-orm","edge","edge-computing","libsql","sqlite","sqlite3"],"created_at":"2024-10-13T15:41:25.333Z","updated_at":"2025-04-11T11:33:49.003Z","avatar_url":"https://github.com/penberg.png","language":"JavaScript","readme":"# Future Frontend: SQLite Demo\n\nThis is the source repository for the SQLite demo app presented at [Future Frontend January 2024 meetup](https://meetabit.com/events/future-frontend-january-2024/).\n\n## Backend (Bun)\n\nThe app in [backend/bun-todo-api](./backend/bun-todo-api) directory is an API server implemented with Bun and Stric.\n\nFirst install dependencies:\n\n```console\nbun i\n```\n\nConfigure local SQLite:\n\n```console\necho \"DATABASE_URL=file:todo.db\" \u003e .env\n```\n\nGenerate migrations:\n\n```console\nbun x drizzle-kit generate:sqlite --out migrations --schema db/schema.ts\n```\n\nPush the migrations to the database:\n\n```console\nbun x drizzle-kit push:sqlite\n```\n\nInspect the database with Drizzle studio:\n\n```console\nbun x drizzle-kit studio\n```\n\nOr in the shell:\n\n```console\nsqlite3 todo.db\n```\n\nAnd start the server:\n\n```console\nbun run index.ts\n```\n\nThe REST API server is now running on `http://localhost:3000`.\n\n## Frontend\n\nThe app in [frontend/react](./frontend/react) directory is the frontend for a Todo app, forked from https://github.com/tastejs/todomvc/tree/master/examples/react\n\nTo get started, install dependencies:\n\n```console\nbun i\n```\n\nStart the server:\n\n```console\nbun run serve\n```\n\nOpen the application in [your browser](http://127.0.0.1:7002).\n\n## Moving your database to Turso\n\nYou can import a SQLite database file with the following command:\n\n```console\nturso db create --from-file todo.db todo\n```\n\nRun the following to generate configuration to access a remote Turso database:\n\n```console\necho \"DATABASE_URL=$(turso db show --url todo)\" \u003e .env.remote\necho \"DATABASE_AUTH_TOKEN=$(turso db tokens create todo)\" \u003e\u003e .env.remote\ncp .env.remote .env\n```\n\nRun the following to access an embedded database with offline sync:\n\n```console\necho \"DATABASE_URL=file:local.db\" \u003e .env.sync\necho \"SYNC_URL=$(turso db show --url todo)\" \u003e\u003e .env.sync\necho \"DATABASE_AUTH_TOKEN=$(turso db tokens create todo)\" \u003e\u003e .env.sync\ncp .env.sync .env\n``````\n\n## Backend (Cloudflare Workers)\n\nThe app in [backend/workers-todo-api](./backend/workers-todo-api) directory an API server implemented with Cloudflare Workers.\n\nStart the server locally:\n\n```console\nnpm start\n```\n\nTo deploy it on Workers platform, you first configure database access credentials.\n\nUpdate the `wrangler.toml` with a `DATABASE_URL` variable:\n\n```console\n[vars]\nDATABASE_URL = \"\u003cYOUR_DATABASE_URL\u003e\"\n```\n\nThen configure database access token in `.dev.vars`:\n\n```\n.dev.vars\nDATABASE_AUTH_TOKEN=\"\u003cYOUR_AUTH_TOKEN\u003e\"\n```\n\nand configure it as a secret:\n\n```console\nnpx wrangler secret put DATABASE_AUTH_TOKEN\n```\n\nFinally, deploy to the Workers platform:\n\n```console\nnpm run deploy\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpenberg%2Ffuture-frontend-sqlite-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpenberg%2Ffuture-frontend-sqlite-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpenberg%2Ffuture-frontend-sqlite-demo/lists"}