This is the reference app for the "Securing a GenAI Service with API Key Validation and Trial Management" tutorial. Follow along to create a system where users can sign up for a free 7-day trial, upgrade to a paid plan, and use their API key to generate images.
We'll build an image generation API similar to Midjourney. To complete this tutorial, we’ll leverage PropelAuth’s API Key Authentication, custom user properties, and account management features. We’ll also create an Express API with endpoints to simulate Stripe payment processing and image creation.
- Web framework and API: Express.js
- API Key authentication and login/account management: PropelAuth
- Clone this repository.
- In a terminal, change directory into the repo:
cd demo-genai-api-keys
. - Install all packages:
npm install
. - Build then run on localhost:
npm run dev
.