AI Image Generator - Deployed at ImgReal
A modern web application that transforms text prompts into AI-generated images using the Pollinations GPT‑Image 1.5 model (gen.pollinations.ai).
- 🎨 AI Image Generation - Powered by Pollinations GPT‑Image 1.5
- ✨ Modern UI - Glassmorphism design with smooth animations
- ⌨️ Keyboard Shortcuts - Press
Ctrl+Enterto generate - 📱 Responsive - Works on desktop and mobile
- 💾 Download - Save generated images instantly
- 🛡️ Rate Limiting - Protects the API from abuse (10 req/15 min)
Frontend: React 19, Vite, Tailwind CSS v4
Backend: Node.js, Express, Axios, express-rate-limit, CORS, morgan
AI Model: Pollinations GPT‑Image 1.5
- Node.js (v18 or higher)
- npm
- Pollinations API key (POLLEN_API_KEY)
-
Clone the repository
git clone https://github.com/divyanshu12-fullstack/Img-Real.git cd Img-Real -
Setup Backend
cd backend npm install -
Create backend
.envfile# Create a file named .env in the backend folder with: PORT=3000 POLLEN_API_KEY=your_pollen_api_key_here POLLEN_TIMEOUT=90000 # Comma-separated allowed origins for CORS CLIENT_URL=http://localhost:5173,https://imgreal.netlify.app
-
Setup Frontend
cd ../frontend npm install -
Create frontend
.envfile# Create a file named .env in the frontend folder with: VITE_API_BASE_URL=http://localhost:3000/api/generate-image
cd backend
npm run devThe backend will start at http://localhost:3000
Open a new terminal:
cd frontend
npm run devThe frontend will start at http://localhost:5173
| Variable | Description | Example |
|---|---|---|
PORT |
Server port | 3000 |
POLLEN_API_KEY |
Pollinations API token (required) | pollen_xxxxx |
POLLEN_TIMEOUT |
API timeout in ms | 90000 |
CLIENT_URL |
Allowed origins for CORS (comma-separated) | http://localhost:5173,https://imgreal.netlify.app |
| Variable | Description | Example |
|---|---|---|
VITE_API_BASE_URL |
Backend API endpoint | http://localhost:3000/api/generate-image |
- Method:
POST - Endpoint:
/api/generate-image - Body:
{ "prompt": "A sunset over mountains" } - Success Response:
{ "success": true, "image": "data:image/png;base64,...", "meta": { "mime": "image/png", "size": 123456 } } - Error Response:
{ "success": false, "error": "<message>", "details": "<optional>" }
Rate limit: 10 requests per 15 minutes per IP.
- Open
http://localhost:5173in your browser - Enter a descriptive prompt (e.g., "A sunset over mountains")
- Click Generate Image or press
Ctrl+Enter - Wait for the image to be generated (may take up to 60 seconds)
- Download or view the generated image
Text-to-Image/
├── backend/
│ ├── routes/
│ │ └── generateImage.js
│ ├── index.js
│ ├── package.json
│ └── .env
├── frontend/
│ ├── src/
│ │ ├── api/
│ │ ├── components/
│ │ ├── pages/
│ │ ├── App.jsx
│ │ └── index.css
│ ├── package.json
│ └── .env
└── README.md
MIT License
Made with ❤️ by Divyanshu