# 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.

Table of Contents

*   [Build an AI Text to image Web App – Requirements](https://harishgarg.com/#Build_an_AI_Text_to_image_Web_App_-_Requirements)
*   [Download the code](https://harishgarg.com/#Download_the_code)
*   [Get your Stable Diffusion API Key](https://harishgarg.com/#Get_your_Stable_Diffusion_API_Key)
*   [Setup Replicate Key](https://harishgarg.com/#Setup_Replicate_Key)
*   [Start your Application](https://harishgarg.com/#Start_your_Application)
*   [References](https://harishgarg.com/#References)

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](https://github.com/zeke/inpainter)
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](https://replicate.com/).

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

References
----------

*   [Replicate](https://replicate.com/)
