Skip to content

About

Fantasize AI is a full-stack AI content generation platform that allows users to generate high-quality images and videos using advanced AI models. It integrates AI media generation, secure payments, authentication, email notifications, and scalable infrastructure into a production-ready system.

Resources

Stars

7 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

82 Commits

Folders and files

Repository files navigation

Fantasize AI

Landing

AI-powered image and video generation platform built with modern web technologies

πŸš€ Live Demo

Visit Fantasize AI

🎯 Overview

Fantasize AI is a comprehensive AI-powered content generation platform that enables users to create stunning images and videos using cutting-edge AI models. The platform provides an intuitive interface for generating content, managing face models, purchasing token packs, and organizing generated media.

Key Capabilities

  • AI Image Generation - Powered by Fal AI API
  • AI Video Generation - Powered by Veo 3
  • Face Model Training - Custom face model creation and management
  • Token-based System - Credit-based consumption model
  • Secure Payments - Razorpay integration for pack purchases
  • Email Notifications - Automated order confirmations

✨ Features

User Features

Image Section

  • Generate Tab

    • AI-powered image generation with customizable prompts
    • Multiple style and parameter controls
    • Real-time generation status Generate Tab
  • Face-Model Tab

    • Upload and train custom face models
    • Manage multiple face models
    • Use trained models in generations Face-Model
  • Packs Tab

    • Purchase token packs via Razorpay
    • Multiple pricing tiers
    • Instant credit top-up Landing
  • Images Tab

    • Gallery view of all generated images
    • Download and share functionality
    • Organized by creation date Landing

Video Section (Sidebar Navigation)

  • Generate Video
    • Text-to-video generation using Veo 3
    • Customizable video parameters
    • Progress tracking Venerate Video
  • Videos Gallery
    • View all generated videos
    • Download and playback controls
    • Cloud storage with presigned URLs

Platform Features

  • Token System

    • Real-time token balance tracking
    • Per-generation token consumption
    • Token purchase history
  • User Authentication

    • Secure authentication via Clerk
    • Social login support
    • User profile management
  • Email Notifications

    • Order confirmation emails via Nodemailer
    • Generation completion alerts
    • Account activity notifications

πŸ›  Tech Stack

Frontend

  • Framework: Next.js 15 (App Router)
  • Language: TypeScript
  • Styling: Tailwind CSS
  • UI Components: Shadcn/ui, ActernityUi, MagicUi

Backend

  • Runtime: Node.js
  • API Routes: Next.js API Routes
  • Database ORM: Prisma
  • Database: PostgreSQL
  • Authentication: Clerk
  • File Storage: AWS S3 (Presigned URLs)

AI Services

  • Image Generation: Fal AI API
  • Video Generation: Veo 3 API

Payment & Communication

  • Payment Gateway: Razorpay
  • Email Service: Nodemailer

DevOps

  • Monorepo: Turborepo
  • CI/CD: GitHub Actions
  • Deployment: AWS
  • File Storage: S3
  • Version Control: Git & GitHub

πŸ— Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      Frontend (Next.js App Router)                         β”‚
β”‚                                                                            β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚ Landing  β”‚    β”‚          Dashboard                  β”‚     β”‚ Pricing β”‚   β”‚
β”‚  β”‚   Page   │───▢│  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚ ◀───│  Page   β”‚   β”‚
β”‚  β”‚          β”‚    β”‚  β”‚  Images   β”‚    β”‚   Videos    β”‚   β”‚     β”‚         β”‚   β”‚
β”‚  β”‚ Features β”‚    β”‚  β”‚ (4 Tabs)  β”‚    β”‚  (Sidebar)  β”‚   β”‚     β”‚  Token  β”‚   β”‚
β”‚  β”‚ Pricing  β”‚    β”‚  β”‚           β”‚    β”‚             β”‚   β”‚     β”‚  Packs  β”‚   β”‚
β”‚  β”‚ Auth     β”‚    β”‚  β”‚ Generate  β”‚    β”‚  Generate   β”‚   β”‚     β”‚         β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚  β”‚ Models    β”‚    β”‚  Gallery    β”‚   β”‚     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                  β”‚  β”‚ Packs     β”‚    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚                   β”‚
β”‚                  β”‚  β”‚ Gallery   β”‚                      β”‚                   β”‚
β”‚                  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                      β”‚                   β”‚
β”‚                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                      β”‚
                                      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        API Layer (/api/v1)                            β”‚
β”‚                                                                       β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚    Auth     β”‚  β”‚     AI      β”‚  β”‚   Payment   β”‚  β”‚   Storage   β”‚   β”‚
β”‚  β”‚             β”‚  β”‚             β”‚  β”‚             β”‚  β”‚             β”‚   β”‚
β”‚  β”‚ Middleware  β”‚  β”‚ Generate    β”‚  β”‚ Razorpay    β”‚  β”‚ Presigned   β”‚   β”‚
β”‚  β”‚ Webhooks    β”‚  β”‚ Training    β”‚  β”‚ Orders      β”‚  β”‚ URLs        β”‚   β”‚
β”‚  β”‚             β”‚  β”‚ Video Gen   β”‚  β”‚ Verify      β”‚  β”‚ Uploads     β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                                                                       β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                     β”‚
β”‚  β”‚    Bulk     β”‚  β”‚    Pack     β”‚                                     β”‚
β”‚  β”‚             β”‚  β”‚             β”‚                                     β”‚
β”‚  β”‚ Images      β”‚  β”‚ Management  β”‚                                     β”‚
β”‚  β”‚ Videos      β”‚  β”‚ Bulk Ops    β”‚                                     β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                      β”‚
                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                  β–Ό                   β–Ό                   β–Ό
      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
      β”‚      Clerk        β”‚ β”‚   Prisma + DB     β”‚ β”‚ External Services β”‚
      β”‚   Authentication  β”‚ β”‚   (PostgreSQL)    β”‚ β”‚                   β”‚
      β”‚                   β”‚ β”‚                   β”‚ β”‚                   β”‚
      β”‚ β€’ User Management β”‚ β”‚ β€’ Users           β”‚ β”‚ β€’ Fal AI          β”‚
      β”‚ β€’ Sessions        β”‚ β”‚ β€’ Tokens          β”‚ β”‚   (Images)        β”‚
      β”‚ β€’ Webhooks        β”‚ β”‚ β€’ Orders          β”‚ β”‚                   β”‚
      β”‚ β€’ Social Auth     β”‚ β”‚ β€’ Images          β”‚ β”‚ β€’ Google Veo 3    β”‚
      β”‚                   β”‚ β”‚ β€’ Videos          β”‚ β”‚   (Videos)        β”‚
      β”‚                   β”‚ β”‚ β€’ FaceModels      β”‚ β”‚                   β”‚
      β”‚                   β”‚ β”‚ β€’ Packs           β”‚ β”‚ β€’ Razorpay        β”‚
      β”‚                   β”‚ β”‚                   β”‚ β”‚   (Payments)      β”‚
      β”‚                   β”‚ β”‚                   β”‚ β”‚                   β”‚
      β”‚                   β”‚ β”‚                   β”‚ β”‚ β€’ AWS S3          β”‚
      β”‚                   β”‚ β”‚                   β”‚ β”‚   (File Storage)  β”‚
      β”‚                   β”‚ β”‚                   β”‚ β”‚                   β”‚
      β”‚                   β”‚ β”‚                   β”‚ β”‚ β€’ Nodemailer      β”‚
      β”‚                   β”‚ β”‚                   β”‚ β”‚   (Emails)        β”‚
      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Data Flow

  1. User Authentication: Clerk handles sign-up/sign-in β†’ Creates user in PostgreSQL
  2. Token Purchase: User buys tokens β†’ Razorpay processes payment β†’ Webhook updates database
  3. Image Generation: User submits prompt β†’ API calls Fal AI β†’ Stores in S3 β†’ Returns presigned URL
  4. Face Model Training: User uploads images β†’ Training API β†’ Fal AI creates LoRA model β†’ Stores model ID
  5. Video Generation: User submits prompt β†’ API calls Veo 3 β†’ Processes video β†’ Stores in S3
  6. Email Notifications: Order completed β†’ Nodemailer sends receipt β†’ User receives confirmation

πŸš€ Getting Started

Prerequisites

  • Node.js 18.x or higher
  • npm
  • PostgreSQL database
  • Accounts for:
    • Clerk (Authentication)
    • Fal AI (Image Generation)
    • Veo 3 (Video Generation)
    • Razorpay (Payments)
    • AWS S3 (Storage)

Installation

  1. Clone the repository
git clone https://github.com/yourusername/fantasize-ai.git
cd fantasize-ai
  1. Install dependencies
npm install
  1. Set up environment variables
cp .env.example .env
# Edit .env with your credentials
  1. Set up the database
cd packages/db

# Generate Prisma client
npx prisma generate

# Run migrations
npx prisma migrate dev

# Seed the database (optional)
npx prisma db seed
  1. Run the development server
cd apps/web

npm run dev
  1. Open the application
http://localhost:3000

πŸ” Environment Variables

Create a .env file in the root directory with the following variables:

# Database
DATABASE_URL=""

# Clerk Authentication
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=
CLERK_SECRET_KEY=
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
NEXT_PUBLIC_CLERK_SIGN_IN_FALLBACK_REDIRECT_URL=/dashboard
NEXT_PUBLIC_CLERK_SIGN_UP_FALLBACK_REDIRECT_URL=/dashboard

# AI Services
FAL_KEY=

# AWS S3
accessKeyId=
secretAccessKey=
bucket=
AWS_REGION=us-east-1
endpoint=https://s3.us-east-1.amazonaws.com

# Razorpay
NEXT_PUBLIC_RAZORPAY_KEY_ID=
RazorpaySecret=
razorpayWebhookSecret=

# Email (Nodemailer)
EMAIL_USER=
EMAIL_PASS=

πŸ“ Project Structure

fantasize-ai/
β”œβ”€β”€ apps/
β”‚   └── web/                          # Next.js application with App Router
β”‚       β”œβ”€β”€ app/                      # Next.js App Router
β”‚       β”‚   β”œβ”€β”€ page.tsx              # Landing page
β”‚       β”‚   β”œβ”€β”€ layout.tsx            # Root layout
β”‚       β”‚   β”œβ”€β”€ config.ts             # App configuration
β”‚       β”‚   β”œβ”€β”€ sign-in/              # Clerk authentication (sign-in)
β”‚       β”‚   β”œβ”€β”€ sign-up/              # Clerk authentication (sign-up)
β”‚       β”‚   β”œβ”€β”€ pricing/              # Pricing & token packages page
β”‚       β”‚   β”œβ”€β”€ dashboard/            # Protected dashboard with image/video sections
β”‚       β”‚   └── api/v1/               # API routes (AI generation, payments, S3, bulk operations)
β”‚       β”œβ”€β”€ components/               # React components
β”‚       β”‚   β”œβ”€β”€ ui/                   # Shadcn UI components (button, card, dialog, etc.)
β”‚       β”‚   β”œβ”€β”€ manualComponents/     # Custom feature components (GenerateImage, Videos, Packs)
β”‚       β”‚   └── magicui/              # Magic UI effects (animations, gradients, hover effects)
β”‚       β”œβ”€β”€ lib/                      # Utility functions
β”‚       β”œβ”€β”€ models/                   # TypeScript type definitions
β”‚       β”œβ”€β”€ hooks/                    # Custom React hooks
β”‚       β”œβ”€β”€ public/                   # Static assets (logos, images, videos)
β”‚       β”œβ”€β”€ middleware.ts             # Clerk authentication middleware
β”‚       β”œβ”€β”€ next.config.js            # Next.js configuration
β”‚       β”œβ”€β”€ tailwind.config.ts        # Tailwind CSS configuration
β”‚       β”œβ”€β”€ Dockerfile                # Docker container setup
β”‚       └── package.json
β”‚
β”œβ”€β”€ packages/                         # Turborepo shared packages
β”‚   β”œβ”€β”€ db/                           # Prisma database package (schema, migrations, client)
β”‚   β”œβ”€β”€ ui/                           # Shared UI components library
β”‚   β”œβ”€β”€ typescript-config/            # Shared TypeScript configurations
β”‚   β”œβ”€β”€ eslint-config/                # Shared ESLint rules
β”‚   └── common/                       # Common utilities and types
β”‚
β”œβ”€β”€ .github/workflows/                # CI/CD pipelines (build, test, deploy)
β”œβ”€β”€ turbo.json                        # Turborepo configuration
β”œβ”€β”€ package.json                      # Root workspace dependencies
└── README.md                         # Project documentation

πŸ’° Pricing

Token Usage

Feature Cost Details
πŸ–ΌοΈ Image Generation 1 Token 720p/1080p quality
πŸ€– Face Model Training 20 Tokens Custom LoRA model
🎞️ Video (No Audio) 8 Tokens 720p/1080p quality
🎬 Video (With Audio) 10 Tokens 720p/1080p quality

Pricing Plans

Plan Price Tokens Discount Best For
Starter 🟒 β‚Ή100 5 - First-time users
Value πŸ”΅ β‚Ή300 β‚Ή250 14 17% Casual creators
Pro 🟣 β‚Ή650 β‚Ή500 30 23% Regular users + model training
Ultimate 🟑 β‚Ή1400 β‚Ή1000 62 29% Professionals & heavy users

πŸ”’ Security

  • Authentication: Clerk handles all user authentication and session management
  • API Security: All API routes are protected with Clerk middleware
  • Payment Security: Razorpay handles all payment processing
  • Data Encryption: All sensitive data is encrypted at rest
  • Webhook Verification: All webhooks are verified using signatures

🀝 Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Code Style

  • Follow the existing code style
  • Run npm run lint before committing
  • Write meaningful commit messages
  • Add tests for new features

πŸ“ž Support

For support, email support@fantasize-ai.com.


Made with ❀️ by VatsalCodes44

About

Fantasize AI is a full-stack AI content generation platform that allows users to generate high-quality images and videos using advanced AI models. It integrates AI media generation, secure payments, authentication, email notifications, and scalable infrastructure into a production-ready system.

Resources

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages