---
title: "Deploy Web UI - kie.ai"
description: "Deploy and Host KIE AI Image Generator with Railway"
category: "AI/ML"
url: https://railway.com/deploy/web-ui-kie-ai
---

# Deploy Web UI - kie.ai

Deploy and Host KIE AI Image Generator with Railway

**[Deploy Web UI - kie.ai on Railway](https://railway.com/template/web-ui-kie-ai)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/web-ui-kie-ai/manifest.json

- **Creator:** Hasuka's Projects
- **Category:** AI/ML

## Template content

### Web https://kie.ai/logo.png

- **Source:** https://github.com/zahidakhyar/web-ui-kie-ai
- **Health check:** /
- **Public domain:** Yes

## Documentation

# Deploy and Host KIE AI Image Generator on Railway

[![Deploy on Railway](https://railway.com/button.svg)](https://railway.com/deploy/_38Wb7)

A self-hosted AI image generation web app powered by the [KIE.ai](https://kie.ai) API, with Cloudflare R2 storage and a responsive gallery. Generate images from text prompts, track progress in real time, and browse everything you've created in one place.

## About Hosting KIE AI Image Generator on Railway

The app runs as a single Dockerized Next.js service. SQLite (via Drizzle ORM) handles task/image metadata inside the container, while generated images are uploaded to a Cloudflare R2 bucket you provide. Railway builds the Docker image, provisions the public HTTPS domain, and keeps the service running — you just supply your KIE.ai and R2 credentials.

## Tech Stack

- Next.js (App Router, TypeScript)
- shadcn/ui + Tailwind CSS
- Drizzle ORM + SQLite (`better-sqlite3`)
- Cloudflare R2 (S3-compatible storage)
- SWR for real-time task polling

## Why Deploy

- **Text-to-image generation** via the KIE.ai API (SeeDream 4.5, extensible to other models)
- **Real-time progress** — polls task status and auto-updates when the KIE.ai callback fires
- **Gallery** — paginated grid of every generated image with full-size view, download, and delete
- **Optional password gate** — lock the app down with `ADMIN_PASSWORD` if you're hosting it for yourself
- **Flexible model registry** — add new KIE.ai models by editing one file, no UI changes needed

## Dependencies for KIE AI Image Generator

### Deployment Dependencies

- A [KIE.ai](https://kie.ai) account and API key
- A [Cloudflare R2](https://developers.cloudflare.com/r2/) bucket (S3-compatible object storage) for generated images

### Required Environment Variables

| Variable | Description |
|---|---|
| `KIE_API_KEY` | Your KIE.ai API key |
| `NEXT_PUBLIC_APP_URL` | Public URL of this deployment (used for KIE.ai callbacks) — set this to your Railway-generated domain |
| `R2_ACCOUNT_ID` | Cloudflare account ID |
| `R2_ACCESS_KEY_ID` | R2 access key |
| `R2_SECRET_ACCESS_KEY` | R2 secret key |
| `R2_BUCKET_NAME` | R2 bucket name |
| `R2_PUBLIC_URL` | Public URL of your R2 bucket (custom domain or `r2.dev` subdomain) |
| `ADMIN_PASSWORD` | Optional password gate for the app |
| `AUTH_SECRET` | Required if `ADMIN_PASSWORD` is set — secret used to sign the session cookie |

## Getting Started

1. Deploy the template and fill in the required variables above.
2. Once the service shows a green "Success" status, copy its public domain and set it as `NEXT_PUBLIC_APP_URL` (redeploy after changing it, since KIE.ai callbacks depend on it).
3. Open the deployed URL, enter a prompt, and generate your first image.
4. Visit `/gallery` to browse everything you've generated.

## Common Use Cases

- Personal AI image generation tool without per-seat SaaS pricing
- Prototyping prompts against KIE.ai models with a proper UI instead of raw API calls
- Small team/internal tool for generating marketing or creative assets

## Source

- Repository: [github.com/zahidakhyar/web-ui-kie-ai](https://github.com/zahidakhyar/web-ui-kie-ai)
- License: MIT


## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [stella](https://railway.com/deploy/stella) — Self-host stella with web, API, Postgres, Redis, and object storage.
- [Hermes Agent | OpenClaw Alternative with Dashboard](https://railway.com/deploy/hermes-agent-or-openclaw-alternative-wit) — Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

Open this page in a browser: https://railway.com/deploy/web-ui-kie-ai
