This is the reference app for the "Protecting a Multi-tenant Next.js client/server app with PropelAuth" tutorial. Follow along to create a complete Next.js app that creates digital coupons on demand using OpenAI's API and PropelAuth to ensure only authorized users can create coupons.
You'll create a multi-tenant (or B2B) Next.js app that creates digital coupons on demand using OpenAI's API. OpenAI will create a coupon image using a discount percentage entered by the user along with their assigned grocery store name. We'll use PropelAuth, a B2B/multi-tenant authentication provider, to ensure only authorized users can create coupons. Out-of-the-box, it provides account sign up, login, logout functionality and we’ll use their roles and permissions system to verify the user is in the correct role before allowing them to create a coupon.
- Web framework and API: Next.js
- Creating digital coupons: OpenAI API
- Securing the frontend and backend: PropelAuth
- Clone this repository.
- In a terminal, change directory into the repo:
cd demo-b2b-coupon-generator. - Install all packages:
npm install. - Follow the quickstart guide to sign up for PropelAuth for free, configure a project, then configure the
.envfile with your environment variables. - Build then run on localhost:
npm run build && npm run start.