Skip to content

Latest commit

 

History

120 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Method Endpoint Description Protected
POST /api/auth/register Create a new account βœ…
POST /api/auth/login Login and get JWT βœ…
POST /api/upload Upload an image file βœ…
POST /api/generate Generate 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.

About

Production-ready AI Image Generator featuring smart model routing (Flash/Pro), secure JWT authentication, rate limiting, and cost optimization. Powered by Supabase & Google Gemini.

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Contributors

Languages