This is a sample implementation of the Corbado React.js package and Corbado Node.js SDK being integrated into a web application built with Hono on the backend and React.js on the frontend.
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