{"id":15715521,"url":"https://github.com/cloudflare/d1-northwind","last_synced_at":"2025-04-04T23:07:20.603Z","repository":{"id":63303766,"uuid":"509150891","full_name":"cloudflare/d1-northwind","owner":"cloudflare","description":"Northwind Traders D1 Demo","archived":false,"fork":false,"pushed_at":"2025-03-25T10:41:53.000Z","size":5819,"stargazers_count":130,"open_issues_count":2,"forks_count":34,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-03-28T22:12:14.896Z","etag":null,"topics":["cloudflare-workers","d1"],"latest_commit_sha":null,"homepage":"https://northwind.d1sql.com/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudflare.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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":"2022-06-30T16:17:07.000Z","updated_at":"2025-03-27T20:00:03.000Z","dependencies_parsed_at":"2025-02-03T20:41:16.176Z","dependency_job_id":null,"html_url":"https://github.com/cloudflare/d1-northwind","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Fd1-northwind","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Fd1-northwind/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Fd1-northwind/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Fd1-northwind/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudflare","download_url":"https://codeload.github.com/cloudflare/d1-northwind/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247261600,"owners_count":20910108,"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-workers","d1"],"created_at":"2024-10-03T21:41:50.493Z","updated_at":"2025-04-04T23:07:20.582Z","avatar_url":"https://github.com/cloudflare.png","language":"TypeScript","funding_links":[],"categories":["Templates \u0026 Examples"],"sub_categories":["Example Applications"],"readme":"# D1 Northwind Demo\n\nThis repo has the code for https://northwind.d1sql.com/\n\n## What we use\n\n- Cloudflare [Workers](https://workers.cloudflare.com/) for computing\n- [D1](https://blog.cloudflare.com/introducing-d1/) for database\n- [Wrangler](https://github.com/cloudflare/wrangler2) for building\n- [Typescript](https://www.typescriptlang.org/) for better Javascript\n- [Tailwind CSS](https://tailwindcss.com/) for the UI\n- [React](https://reactjs.org/) for DOM interaction\n- [Remix](https://remix.run/docs/en/main/) for the React framework\n\n## Get the demo running\n\nRequirements:\n\n- You need a Cloudflare Account\n- You need to get D1 [enabled](https://www.cloudflare.com/en-gb/lp/d1/) for your account\n- Please join our [developers Discord](https://discord.com/invite/cloudflaredev)\n- Please install [nodejs](https://github.com/nvm-sh/nvm) (we're using v18.8.0), npm and [npx](https://www.npmjs.com/package/npx)\n\n### Clone this repo\n\n```\ngit clone https://github.com/cloudflare/d1-northwind\n```\n\nNote that this repository uses [npm workspaces](https://docs.npmjs.com/cli/v9/using-npm/workspaces?v=true) to manage dependencies. You can run either Worker's npm commands from the root of the repo by adding either `-w frontend` or `-w worker` to your npm command.\n\n### Install packages\n\n```\nnpm install\n```\n\n### Creating the database\n\n```\nnpm run db:new\n```\n\nGet the output database id and add it to worker/wrangler.toml\n\n```\n[[d1_databases]]\nbinding = \"DB\"\ndatabase_name = \"northwind\"\ndatabase_id = \"...\"\n```\n\n### Importing the database\n\n```\nnpm run db:init\nnpm run db:load\n```\n\n## React application\n\nNorthwind is a React/Remix/Tailwind CSS application. The source code is in the [app folder](./frontend) folder.\n\nTo build a new version run:\n\n```\nnpm run build -w frontend\n```\n\nTo run the dev server, run:\n\n```\nnpm run dev -w frontend\n```\n\n## Worker backend\n\nWorker serves the Database API endpoints. The source code is in the [worker](./worker) folder.\n\n## Local development\n\nWrangler D1 has support for local development:\n\n```\nnpm run local:init -w worker\nnpm run local:load -w worker\nnpm run dev -w worker\n```\n\nThis will start the Worker at `http://127.0.0.1:8787` with the database loaded with data. At this point you can start the frontend in a separate terminal window:\n\n```\nnpm run dev -w frontend\n```\n\nWrangler will persist a local SQLite compatible sql file which you can access to with other clients:\n\n```\nsqlite3 worker/.wrangler/state/v3/d1/*/db.sqlite\n.tables\n```\n\n## Deploying\n\nDeploy to production when you're done.\n\n```\nnpm run deploy -w worker\nnpm run deploy -w frontend\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudflare%2Fd1-northwind","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudflare%2Fd1-northwind","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudflare%2Fd1-northwind/lists"}