![GitHub Repo Cover](https://private-user-images.githubusercontent.com/18458907/291711345-aa4f9df6-980b-4b24-bb2f-d71c0f480971.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxMDE5ODUsIm5iZiI6MTczOTEwMTY4NSwicGF0aCI6Ii8xODQ1ODkwNy8yOTE3MTEzNDUtYWE0ZjlkZjYtOTgwYi00YjI0LWJiMmYtZDcxYzBmNDgwOTcxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA5VDExNDgwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFmYTE4YjNkZmUxNTViZDI3ODNkYTRlNzg5NzM2YmZhMjA4N2JhNzhhYjAwNjAyZGFhZWU1OWI0MmFiODM0YzQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.AGMLsT1Qp23mI9_5wsW80RZrngvtmzdBUaGU1uuuWpU)
This is a sample implementation of the Corbado passkeys-first authentication solution using React and Hono. The following packages are being used:
frontend
: Separate directory for the Vue.js frontendfrontend/.env.example
: Example file for environment variablesfrontend/src/pages
: Contains all pages used in the frontendfrontend/src/app.tsx
: Contains configuration like providers and routesfrontend/src/context/user.tsx
: Global store for user data from our own backendbackend
: Separate directory for the Hono backendbackend/.env.example
: Example file for environment variablesbackend/src/app.ts
: Configuration file for the Hono appbackend/src/utils
: Collection of utility functions, e.g. helper functions for authenticationbackend/src/routes
: Directory configuring the routes for the appbackend/src/middleware
: Middleware, e.g. for authenticationbackend/src/db
: Database configuration and queries
Please follow the steps in Getting started to create and configure a project in the Corbado developer panel.
You need to have Node and npm
installed to run it.
Use the values you obtained in Prerequisites to configure the following variables inside a .env
file you create in frontend and backend directories respectively:
The backend needs an api secret to authenticate with the Corbado backend API.
CORBADO_PROJECT_ID=pro-XXX
CORBADO_API_SECRET=corbado1_XXX
CORBADO_FRONTEND_API=https://{$CORBADO_PROJECT_ID}.frontendapi.cloud.corbado.io
CORBADO_BACKEND_API=https://backendapi.cloud.corbado.io
The frontend needs the project ID and the backend base URL.
VITE_CORBADO_PROJECT_ID=pro-XXX
VITE_BACKEND_BASE_URL=http://localhost:3001
Run the following command in the root directory
(cd backend && npm install)
(cd frontend && npm install)
to install all dependencies.
Finally, you can run the project locally with the provided start script or individually for frontend and backend.
./start.sh
In one terminal session, run the following command in the frontend
directory:
npm run dev
In another terminal session, run the following command in the backend
directory:
npm run dev
- Community for Developer Support: https://bit.ly/passkeys-community
- Passkeys Debugger: https://www.passkeys-debugger.io/
- Passkey Subreddit: https://www.reddit.com/r/passkey/