Imagify

ReactNode.jsExpressMongoDBRazorpayGoogle GeminiTailwind CSS
Imagify preview

overview.

An AI-powered SaaS platform where users generate stunning images from text prompts, with a credit-based monetisation system and Razorpay payment integration.

technical implementation.

Atomic Credit Deduction System

Engineered strict database transactions in MongoDB to ensure credits are only deducted from the user's account upon successful verification of the Gemini API image response.

Indian Payment Gateway Webhooks

Implemented secure Razorpay webhook signature verification to handle asynchronous payment success responses and update user credits reliably.

Token-Based Session Management

Built custom Express middleware for stateless JWT verification to protect sensitive image generation and transaction history routes.

Optimized Asset Delivery

Configured direct database image caching and retrieval to speed up gallery load times for user histories.

key features.

  • Text-to-Image Generation: High-fidelity image output powered by Google Gemini API integration
  • Credit-Based SaaS Model: Complete system with a free registration tier and paid credit top-ups
  • Razorpay Gateway: Secure Indian payment gateway integration for seamless transaction processing
  • JWT-Based Security: Secure user sessions and role-protected backend endpoints using Bcrypt hashing
  • Creation History Gallery: Persistent database storage for browsing, sharing, and re-downloading past creations
  • UX Loading Skeleton: Smooth, layout-stable loading states during AI image rendering and delivery

screenshots.

AI Image Generator

Intuitive prompting interface with dynamic loading skeletons during image generation

Creation Workspace

Clean workspace workspace highlighting successful credit-based generations

How It Works

Step-by-step guidance on prompt generation, credit usage, and downloading assets

challenges & solutions.

Challenge: Preventing credit loss on failed API generations

Solution: Wrapped the AI image generation call and the database credit deduction in an idempotent transaction block, restoring credits if an API timeout occurs.

Challenge: Verifying asynchronous payment webhook authenticity

Solution: Developed a robust verification layer utilizing node crypto to validate the Razorpay signature against the raw payload before updating user balances.

Challenge: Maintaining UI layout stability during slow AI processing

Solution: Designed visual skeleton loaders that preserve container dimensions, eliminating cumulative layout shifts while waiting for the image stream.

Challenge: Handling high concurrency during peak image generation

Solution: Established rate-limiting middleware and request throttling on Express servers to distribute traffic and prevent API threshold failures.

project impact.

2k+
images Generated
150+
active Subscribers
99.4%
payment Success Rate
Avg 4s
generation Speed