
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/
This example application uses telemetry. By gathering telemetry data, we gain a more comprehensive understanding of how our SDKs, components, and example applications are utilized across various scenarios. This information is crucial in helping us prioritize features that are beneficial and impactful for the majority of our users. Read our official documentation for more details.
To disable telemetry, add the following line to your frontend/.env
file:
VITE_CORBADO_TELEMETRY_DISABLED=true