https://github.com/horiuchi/passkey-cloudflare
Example of running passkey on cloudflare
https://github.com/horiuchi/passkey-cloudflare
cloudflare-pages passkey remix
Last synced: 11 months ago
JSON representation
Example of running passkey on cloudflare
- Host: GitHub
- URL: https://github.com/horiuchi/passkey-cloudflare
- Owner: horiuchi
- License: mit
- Created: 2023-11-24T02:30:52.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-28T07:59:02.000Z (over 2 years ago)
- Last Synced: 2025-04-19T20:54:28.826Z (about 1 year ago)
- Topics: cloudflare-pages, passkey, remix
- Language: TypeScript
- Homepage: https://passkey-cloudflare.pages.dev/
- Size: 592 KB
- Stars: 8
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Example for Passkey authentication with Cloudflare Pages
- [Demo](https://passkey-cloudflare.pages.dev/)
To log in with Passkey, you need to create an account once you login with your Github account.
After logging in, you will be able to log in by adding Passkey.
## Stack
- TypeScript
- Remix
- cloudflare pages
- cloudflare KV workers
- cloudflare D1
- drizzle-orm
- simplewebauthn
## Setup
### Create a Cloudflare account
Go to [Cloudflare](https://dash.cloudflare.com/sign-up) and create an account.
### Create a Cloudflare Pages application
Go to [Cloudflare Pages](https://dash.cloudflare.com/?to=/:account/workers-and-pages) and create a application.
```bash
# setup wrangler command
npx wrangler login
```
### Create a Cloudflare KV namespace
Create a KV namespace for session storage.
```bash
npx wrangler kv:namespace create session
npx wrangler kv:namespace create session --preview
```
And add the following to `wrangler.toml`.
```toml
name = ""
...
[[kv_namespaces]]
binding = "KV"
id = ""
preview_id = ""
```
### Create a Cloudflare D1 database
Create a D1 database.
```bash
npx wrangler d1 create
```
And add the following to `wrangler.toml`.
```toml
...
[[d1_databases]]
binding = "DB"
database_name = ""
database_id = ""
```
### Initialize migration files
```bash
rm -rf migrations/*
npm run migrate:create
npm run migrate:apply # apply to local sqlite database
```
### Start development server
```bash
npm run dev
open http://localhost:8788/
```
## Development
Deploy to Cloudflare Pages.
```bash
npm run migrate:apply-prod
npm run deploy-prod
```