This repository is dedicated to the development of a Next.js SaaS AI Platform for generating advertising images using AI. The model utilizes stable-diffusion-2-inpainting and ControlNet algorithms to repaint the product backgrounds based on an input image and a text description of the desired output image. It is advisable to use images with transparent or simple backgrounds.
git clone https://github.com/Elsaam2y/ProdGPT.git
cd ProdGPT
npm install
- Visit Replicate and create an account.
- Generate a token under
API Tokens
or use the default token. - Copy your API token and add it to your
.env
file. - If you plan to run more predictions, you might need to set a monthly limit under your
Billing
and provide your payment method.
- Go to Clerk and create an account.
- Once you're logged into your account, create a new application by submitting the application name, selecting how users will sign in, and then clicking on
CREATE APPLICATION
. - After creating the application, copy
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
andCLERK_SECRET_KEY
, and add them to your.env
file.
- Navigate to Planetscale to create a SQL database.
- After creating an account, select "Create a New Database."
- Specify the Database name, select the Hobby (free tier) plan, and then click "Create." You might be asked to provide a payment method, but you won't be charged since you're selecting the free tier.
- Once the database is initialized, select "Connect." Create a password and connect using
**prisma**
.
- Copy the
DATABASE_URL
and place it in your.env
file. Your.env
file should follow this structure:
NEXT_PUBLIC_APP_URL="http://localhost:3000"
REPLICATE_API_TOKEN=
# Authentication
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=
CLERK_SECRET_KEY=
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/Images
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/Images
# Database
DATABASE_URL=
-
Generate Prisma client by running the following command:
npx prisma db push
- Run the following command to start the application. You can access the application at
http://localhost:3000
.
npm run dev
-
If you wish to test without limitations, you can adjust the MAX_FREE_COUNTS value to a higher number. This will increase the generation limit.
-
For testing the Stripe payment system, there are a few intricacies. To better understand this step, refer to this tutorial that helped me comprehend this specific aspect.
You can deploy the application using Vercel.
I would like to express my sincere gratitude to the following repositories, which have been instrumental in shaping and influencing many parts of this application.