Image AI, Stable Diffusion

Build an AI Text to image Web App using Stable Diffusion, NextJS, ReactJS

In this article, we will see how to Build an AI Text to image Web App using Stable Diffusion API.

Stable Diffusion is an Open Source Text Image AI model. People have been creating all kinds of applications with it since its launch.

Let’s see how to create a Stable Diffusion application using NextJS and Replicate API.

Build an AI Text to image Web App – Requirements

  1. Open the command line program on your computer.
  2. Check if you have the latest version of the node installed by running this command: node -v
  3. If not, install the latest version of node or upgrade it.

Download the code

  1. Get the sample code from here
  2. From your command line program, change the directory to the downloaded code’s directory
  3. Run these commands to install the necessary modules: npm install

Get your Stable Diffusion API Key

We will be using the Stable Diffusion API available from Replicate.

Go ahead and create an account and get your API key.

Setup Replicate Key

Add an environment variable REPLICATE_API_TOKEN} and set it to your Replicate API key.

Start your Application

From the code folder, run this command to start the application on your local machine

npm run dev


AI Chat