Background

AI SaaS Image Generator

A full-stack AI platform that transforms ordinary product photos into professional marketing assets using a Smart Hybrid AI Engine.

Project Status Tech Stack License

Features

  • 🔐 Secure Authentication: JWT-based auth with Supabase (Users, Roles).
  • ☁️ Cloud Storage: High-performance image uploads via Cloudinary.
  • 🧠 Smart Hybrid AI Engine:
    • Attempts native Gemini 3.0 Pro image generation first.
    • Automatically falls back to a High-Speed Flash pipeline" or just "Gemini Flash".
    • Generates photorealistic product shots (8K, Cinematic Lighting).
  • ⚡ High Performance: Built on Bun runtime for blazing fast execution.

🗺️ Project Roadmap

Curious about what's coming next? Click here to view our detailed Roadmap & Master Plan

Tech Stack

  • Runtime: Bun
  • Backend: Express, TypeScript
  • Database: Supabase
  • Storage: Cloudinary
  • AI Models: Google Gemini 2.5/3.0 Pro
  • Frontend: React.js (In Progress)

Getting Started

Prerequisites

Installation

  1. Clone the repository

    git clone https://github.com/Glory42/ai-saas-generator.git
    cd ai-saas-generator
    
  2. Install Dependencies

    cd server
    bun install
  1. Environment Setup Create a .env file in the server directory:
    PORT=5000

    # Database
    SUPABASE_URL=your_supabase_url
    SUPABASE_KEY=your_supabase_anon_key

    # Auth
    JWT_TOKEN=your_super_secret_jwt_key

    # Storage
    CLOUDINARY_CLOUD_NAME=your_cloud_name
    CLOUDINARY_API_KEY=your_api_key
    CLOUDINARY_API_SECRET=your_api_secret

    # AI
    GEMINI_API_KEY=your_google_gemini_key
  1. Database Schema Run these SQL queries in your Supabase SQL Editor to set up the tables:
-- Users Table
create table users (
  id uuid default gen_random_uuid() primary key,
  email text unique not null,
  password text not null,
  username text not null,
  role text default 'user',
  created_at timestamp with time zone default now()
);

-- Images Table (Updated with cost & caching fields)
create table images (
  id uuid default gen_random_uuid() primary key,
  user_id uuid references users(id),
  original_url text not null,
  generated_url text,
  prompt text,
  template text,
  status text default 'pending',            -- ✅ Added
  model_tier text default 'flash',          -- ✅ Added
  cost_usd decimal(10, 4) default 0,        -- ✅ Added
  content_hash text,                        -- ✅ Added
  generated_at timestamp with time zone,    -- ✅ Added
  created_at timestamp with time zone default now()
);

-- Indexes for performance (Recommended)
create index idx_images_user_id on images(user_id);
create index idx_images_content_hash on images(content_hash);
  1. Run the Server
    bun run dev

API Endpoints

MethodEndpointDescriptionProtected
POST/api/auth/registerCreate a new account
POST/api/auth/loginLogin and get JWT
POST/api/uploadUpload an image file
POST/api/generateGenerate AI transformation

License

This project is licensed under the GNU General Public License v3.0.
See the LICENSE file for more information.

Contact

If you have any questions, feel free to reach out to me at me@gorkemkaryol.dev.