{"id":25439999,"url":"https://github.com/mellowagain/honc-d1","last_synced_at":"2025-05-15T12:32:29.381Z","repository":{"id":277764646,"uuid":"932121537","full_name":"mellowagain/honc-d1","owner":"mellowagain","description":"refactoring test for d1 migrations with the honc stack","archived":false,"fork":false,"pushed_at":"2025-02-13T12:01:07.000Z","size":31,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-14T21:55:47.968Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/mellowagain.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},"funding":{"github":"mellowagain"}},"created_at":"2025-02-13T12:00:17.000Z","updated_at":"2025-02-13T12:34:47.000Z","dependencies_parsed_at":"2025-02-15T23:52:07.940Z","dependency_job_id":"6e1d1661-527b-4484-8c20-665c98457780","html_url":"https://github.com/mellowagain/honc-d1","commit_stats":null,"previous_names":["mellowagain/honc-d1"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mellowagain%2Fhonc-d1","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mellowagain%2Fhonc-d1/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mellowagain%2Fhonc-d1/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mellowagain%2Fhonc-d1/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mellowagain","download_url":"https://codeload.github.com/mellowagain/honc-d1/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254341344,"owners_count":22055020,"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":[],"created_at":"2025-02-17T11:19:47.339Z","updated_at":"2025-05-15T12:32:24.352Z","avatar_url":"https://github.com/mellowagain.png","language":"TypeScript","funding_links":["https://github.com/sponsors/mellowagain"],"categories":[],"sub_categories":[],"readme":"## 🪿 HONC\n\nThis is a project created with the `create-honc-app` template. \n\nLearn more about the HONC stack on the [website](https://honc.dev) or the main [repo](https://github.com/fiberplane/create-honc-app).\n\n### Getting started\n[D1](https://developers.cloudflare.com/d1/) is Cloudflare's serverless SQL database. Running HONC with a D1 database involves two key steps: first, setting up the project locally, and second, deploying it in production. You can spin up your D1 database locally using Wrangler. If you're planning to deploy your application for production use, ensure that you have created a D1 instance in your Cloudflare account.\n\n### Project structure\n\n```#\n├── src\n│   ├── index.ts # Hono app entry point\n│   └── db\n│       └── schema.ts # Database schema\n├── .dev.vars.example # Example .dev.vars file\n├── .prod.vars.example # Example .prod.vars file\n├── seed.ts # Optional script to seed the db\n├── drizzle.config.ts # Drizzle configuration\n├── package.json\n├── tsconfig.json # TypeScript configuration\n└── wrangler.toml # Cloudflare Workers configuration\n```\n\n### Commands for local development\n\nRun the migrations and (optionally) seed the database:\n\n```sh\n# this is a convenience script that runs db:touch, db:generate, db:migrate, and db:seed\nnpm run db:setup\n```\n\nRun the development server:\n\n```sh\nnpm run dev\n```\n\nAs you iterate on the database schema, you'll need to generate a new migration file and apply it like so:\n\n```sh\nnpm run db:generate\nnpm run db:migrate\n```\n\n### Commands for deployment\n\nBefore deploying your worker to Cloudflare, ensure that you have a running D1 instance on Cloudflare to connect your worker to.\n\nYou can create a D1 instance by navigating to the `Workers \u0026 Pages` section and selecting `D1 SQL Database.`\n\nAlternatively, you can create a D1 instance using the CLI:\n\n```sh\nnpx wrangler d1 create \u003cdatabase-name\u003e\n```\n\nAfter creating the database, update the `wrangler.toml` file with the database id.\n\n```toml\n[[d1_databases]]\nbinding = \"DB\"\ndatabase_name = \"honc-d1-database\"\ndatabase_id = \"\u003cdatabase-id-you-just-created\u003e\"\nmigrations_dir = \"drizzle/migrations\"\n```\n\nInclude the following information in a `.prod.vars` file:\n\n```sh\nCLOUDFLARE_D1_TOKEN=\"\" # An API token with D1 edit permissions. You can create API tokens from your Cloudflare profile\nCLOUDFLARE_ACCOUNT_ID=\"\" # Find your Account id on the Workers \u0026 Pages overview (upper right)\nCLOUDFLARE_DATABASE_ID=\"\" # Find the database ID under workers \u0026 pages under D1 SQL Database and by selecting the created database\n```\n\nIf you haven’t generated the latest migration files yet, run:\n```shell\nnpm run db:generate\n```\n\nAfterwards, run the migration script for production:\n```shell\nnpm run db:migrate:prod\n```\n\nChange the name of the project in `wrangler.toml` to something appropriate for your project:\n\n```toml\nname = \"my-d1-project\"\n```\n\nFinally, deploy your worker\n\n```shell \nnpm run deploy\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmellowagain%2Fhonc-d1","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmellowagain%2Fhonc-d1","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmellowagain%2Fhonc-d1/lists"}