This repository contains the sample code for the blog post RBAC in Practice. It demonstrates how to implement Role-Based Access Control (RBAC) using Logto in a full-stack application.
The project consists of two main parts:
backend/
: A Node.js API server with RBAC implementationfrontend/
: A React application demonstrating role-based UI and access control
-
Navigate to the backend directory:
cd backend
-
Install dependencies:
npm install
-
Set up environment variables:
cp .env.example .env
Update the .env
file with your Logto configuration values (issuer URL, JWKS URL, and API resource identifier from your Logto console).
- Start the development server:
npm run dev
-
Navigate to the frontend directory:
cd frontend
-
Install dependencies:
npm install
-
Set up environment variables:
cp .env.example .env
Update the .env
file with your configuration values.
- Start the development server:
npm run dev
The application will be available at http://localhost:5173
(frontend) and the API at http://localhost:3000
(backend).