{"id":21062965,"url":"https://github.com/harshil1712/remix-d1-auth-template","last_synced_at":"2025-07-08T23:03:21.996Z","repository":{"id":247428868,"uuid":"825753279","full_name":"harshil1712/remix-d1-auth-template","owner":"harshil1712","description":"A Remix template that uses Cloudflare D1 for storing user data","archived":false,"fork":false,"pushed_at":"2024-07-09T09:27:21.000Z","size":128,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-04T01:39:34.101Z","etag":null,"topics":["cloudflare-d1","cloudflare-pages","prisma-orm","remix","remix-auth"],"latest_commit_sha":null,"homepage":"https://remix-d1-auth-template.pages.dev","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/harshil1712.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":"2024-07-08T12:33:20.000Z","updated_at":"2025-05-07T14:29:09.000Z","dependencies_parsed_at":"2024-11-19T17:45:46.189Z","dependency_job_id":"3b368f72-2503-464f-b173-0327b1f9d95b","html_url":"https://github.com/harshil1712/remix-d1-auth-template","commit_stats":null,"previous_names":["harshil1712/remix-d1-auth-template"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/harshil1712/remix-d1-auth-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harshil1712%2Fremix-d1-auth-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harshil1712%2Fremix-d1-auth-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harshil1712%2Fremix-d1-auth-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harshil1712%2Fremix-d1-auth-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/harshil1712","download_url":"https://codeload.github.com/harshil1712/remix-d1-auth-template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harshil1712%2Fremix-d1-auth-template/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264363743,"owners_count":23596501,"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-d1","cloudflare-pages","prisma-orm","remix","remix-auth"],"created_at":"2024-11-19T17:43:37.736Z","updated_at":"2025-07-08T23:03:21.975Z","avatar_url":"https://github.com/harshil1712.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Remix D1 Auth Demo\n\nA template to quickly get started with an authenticated Remix application.\n\n## Features\n\n- [Remix](https://remix.run/): A modern and flexible framework for building web applications.\n- [Cloudflare D1](https://www.cloudflare.com/en-gb/developer-platform/d1/): A fast and scalable serverless SQL database.\n- [Prisma](https://www.prisma.io/): A powerful and type-safe ORM for database interactions.\n- [Cloudflare Pages](https://www.cloudflare.com/en-gb/developer-platform/pages/): Efficient hosting with seamless deployment.\n- GitHub Authentication: Pre-configured GitHub OAuth strategy for user authentication.\n- Extensibility: Easily extendable to support other authentication providers.\n\n## Getting Started\n\n### Prerequisites\n\n- Node.js\n- [Cloudflare account](https://dash.cloudflare.com/sign-up)\n- [GitHub OAuth app](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/creating-an-oauth-app)\n\n### Installation\n\n#### 1. Clone the repository\n\n```sh\ngit clone https://github.com/harshil1712/remix-d1-auth-template.git\n\ncd remix-d1-auth-template\n```\n\n#### 2. Install dependencies\n\n```sh\nnpm install\n```\n\n#### 3. Configure environment variables\n\nRename `.dev.vars.example` to `.dev.vars` and add the credentials. The file should look as follows:\n\n```\nGITHUB_CLIENT_ID=\"client_id\"\nGITHUB_CLIENT_SECRET=\"client_secret\"\nCOOKIE_SESSION_SECRET=\"secret\"\n```\n\n\u003e Generate a new value for `COOKIE_SESSION_SECRET`\n\n#### 4. Set up Cloudflare D1\n\nFollow the [Cloudflare D1 documentation](https://developers.cloudflare.com/d1/get-started/#3-create-a-database) to set up your database.\n\nOnce the database is created, add the bindings to `wrangler.toml` file.\n\n```toml\n[[d1_databases]]\nbinding = \"DB\"\ndatabase_name = \"DATABASE_NAME\"\ndatabase_id = \"DATABASE_ID\"\n```\n\n#### 5. Set up Prisma\n\nGenerate the Prisma client by running:\n\n```sh\nnpx prisma generate\n```\n\nApply database migrations,\n\nLocally:\n\n```sh\nnpx wrangler d1 migrations apply DATABASE_NAME --local\n```\n\nRemote (production):\n\n```sh\nnpx wrangler d1 migrations apply DATABASE_NAME --remote\n```\n\n#### 6. Deploy to Cloudflar Pages\n\nFollow the instructions on the [Cloudflare Pages documentation](https://developers.cloudflare.com/pages/framework-guides/deploy-a-remix-site/) to deploy your Remix app.\n\n### Running Locally\n\nTo run the application locallly:\n\n```sh\nnpm run dev\n```\n\n## Extending Authentication\n\nYou can add support for other providers, or also add username and password auth mechanism to your app. To add other authentication providers (strategy):\n\n### 1. Install the required package\n\n```sh\nnpm install remix-auth-STRATEGY\n```\n\u003e Find the list of all available at [this GitHub discussion](https://github.com/sergiodxa/remix-auth/discussions/111)\n\n### 2. Update authentication strategy\n\nModiy the authentication strategy in `app/services/auth.server.ts`.\n\n```ts\n...\nimport {NewStrategy} from 'remix-auth-NEW_STRATEGY';\n\n....\n\nthis.authenticator.use(new NewStrategy({\n    // configurations\n}, async ()=\u003e {\n    // insert into table\n}))\n\n```\n\n### 3. Update environment variables\n\nAdd the necessary environment variables for the new provider to you `.dev.vars` file.\n\n### 4. Update the table (optional)\n\nBased on the new provider added, you might want to store some more information of the user. To do so, you need to update the table. Follow the instructions in the [Prisma documentation](https://www.prisma.io/docs/orm/prisma-migrate/getting-started) to learn how to update the schema.\n\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request with your improvements.\n\n## Learn more\n\n- 📖 [Remix docs](https://remix.run/docs)\n- 📖 [Remix Cloudflare docs](https://remix.run/guides/vite#cloudflare)\n- 📖 [Cloudflare D1](https://developers.cloudflare.com/d1/)\n- 📖 [Prisma](https://www.prisma.io/docs/orm)\n- 📖 [Cloudflare Pages](https://developers.cloudflare.com/pages/)\n- 📖 [Remix Auth](https://remix.run/resources/remix-auth)\n\n\u003e This README.md file was generated with the help of Chat-GPT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharshil1712%2Fremix-d1-auth-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharshil1712%2Fremix-d1-auth-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharshil1712%2Fremix-d1-auth-template/lists"}