A quick start React template demonstrating secure user authentication and authorization using Neon RLS Authorize with Descope integration. This guide showcases how to implement client-side row-level security by executing SQL directly from the frontend.
- React application with Vite
- User authentication powered by Descope
- Row-level security using Neon RLS Authorize
- Ready-to-deploy configuration for Vercel, Netlify and Render
Deploy directly to your preferred hosting platform:
- Open your Neon Console and click "RLS Authorize".
- Add a new authentication provider.
- Set the JWKS URL to:
https://api.descope.com/{YOUR_DESCOPE_PROJECT_ID}/.well-known/jwks.json
Replace
{YOUR_DESCOPE_PROJECT_ID}
with your Descope Project ID.
- Clone the repository:
git clone https://github.com/dhanushreddy291/descope-react-frontend-neon-rls-authorize
cd descope-react-frontend-neon-rls-authorize
- Install dependencies:
npm install
-
Create a .env.local file with the following variables:
cp .env.template .env.local
VITE_DESCOPE_PROJECT_ID=YOUR_DESCOPE_PROJECT_ID VITE_DATABASE_AUTHENTICATED_URL="YOUR_NEON_DATABASE_AUTHENTICATED_URL"
-
Get your Neon connection string from the Neon Console. Ensure you are using the authenticated role connection string.
-
Run the database schema:
Open your Neon Console, go to the SQL Editor, and run the queries in schema.sql
psql "<YOUR_NEON_DATABASE_URL>" -f schema.sql
-
Start the development server:
npm run dev
-
Visit http://localhost:5173 to see the application running.
Ensure your Descope project is configured for production and the JWKS URL in Neon RLS Authorize is accurate. You can select the production environment in Descope by clicking on the "Production" toggle in the "Environment Settings" tab under "Project Settings".
Contributions are welcome! Please feel free to submit a Pull Request.