Railway

Deploy Web UI - kie.ai

Deploy and Host KIE AI Image Generator with Railway

Deploy Web UI - kie.ai

Deploy and Host KIE AI Image Generator on Railway

Deploy on Railway

A self-hosted AI image generation web app powered by the 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 account and API key
  • A Cloudflare R2 bucket (S3-compatible object storage) for generated images

Required Environment Variables

VariableDescription
KIE_API_KEYYour KIE.ai API key
NEXT_PUBLIC_APP_URLPublic URL of this deployment (used for KIE.ai callbacks) — set this to your Railway-generated domain
R2_ACCOUNT_IDCloudflare account ID
R2_ACCESS_KEY_IDR2 access key
R2_SECRET_ACCESS_KEYR2 secret key
R2_BUCKET_NAMER2 bucket name
R2_PUBLIC_URLPublic URL of your R2 bucket (custom domain or r2.dev subdomain)
ADMIN_PASSWORDOptional password gate for the app
AUTH_SECRETRequired 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


Template Content

More templates in this category

View Template
Chat Chat
Chat Chat, your own unified chat and search to AI platform.

okisdev
112
View Template
Hermes Agent | OpenClaw Alternative with Dashboard
[Jun'26] Self-improving AI agent with memory, skills, and web dashboard 🤖

codestorm
42
View Template
EchoDeck
Generate a mp4 from powerpoint with TTS

Fixed Scope
7