/imaginer

An image generator based on given prompt.

Primary LanguageJavaScript

IMAGINER

🎉 Live Imaginer 🎉

🎯 This project takes a prompt from you and transforms that word or sentence into an image using artificial intelligence.

Technical Details


âš“ This project was developed with the latest version of Next.js. (Nextjs 13)

âš“ The input field takes a prompt from you and sends a request to the replicate API. It then displays the image returned from that API on the screen.

âš“ The suggestion sentences and images under the input come from a file within the project.

âš“ When you click the "copy" button under suggestion sentences or images, the input area gets filled. Upon clicking the "generate" button, a request is sent to the replicate API.

âš“ The project utilizes the Context API for state management.

âš“ Webpack uses SVGR for the icons in the footer. SVGR (SVG React) is a library used to transform SVG files into React components. This enables easier integration of SVG files into React applications.

âš“ To generate an image, we make a request to the replicate API. However, this API has a daily limit, and to prevent excessive requests, rate limiting is implemented using the `express-slow-down` and `express-rate-limit` packages. I've set specific periods and limit values for those periods. Additionally, I've created a value to track whether the request is made from the same API. If a user exceeds the rate limit, an error will be encountered.

âš“ As long as the user doesn't exceed the rate limit, they will see a loading indicator from the moment they generate the image until the API responds. Once the API returns the image URL, the image is displayed under the input field.

Technologies

🚀 NextJS 13

🚀 React

🚀 Context API

🚀 Replicate API

🚀 Express Rate Limit

🚀 Express Slow Down

🚀 Sass

🚀 Next Font

🚀 SVGR Webpack

This is a Next.js project bootstrapped with create-next-app.

Getting Started

First, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying app/page.js. The page auto-updates as you edit the file.

This project uses next/font to automatically optimize and load Inter, a custom Google Font.

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.