AI-powered image and video generation platform built with modern web technologies
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.
- 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
-
Generate Tab
-
Face-Model Tab
-
Packs Tab
-
Images Tab
- Generate Video
- Videos Gallery
- View all generated videos
- Download and playback controls
- Cloud storage with presigned URLs
-
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
- Framework: Next.js 15 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS
- UI Components: Shadcn/ui, ActernityUi, MagicUi
- Runtime: Node.js
- API Routes: Next.js API Routes
- Database ORM: Prisma
- Database: PostgreSQL
- Authentication: Clerk
- File Storage: AWS S3 (Presigned URLs)
- Image Generation: Fal AI API
- Video Generation: Veo 3 API
- Payment Gateway: Razorpay
- Email Service: Nodemailer
- Monorepo: Turborepo
- CI/CD: GitHub Actions
- Deployment: AWS
- File Storage: S3
- Version Control: Git & GitHub
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 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) β
βββββββββββββββββββββ βββββββββββββββββββββ βββββββββββββββββββββ
- User Authentication: Clerk handles sign-up/sign-in β Creates user in PostgreSQL
- Token Purchase: User buys tokens β Razorpay processes payment β Webhook updates database
- Image Generation: User submits prompt β API calls Fal AI β Stores in S3 β Returns presigned URL
- Face Model Training: User uploads images β Training API β Fal AI creates LoRA model β Stores model ID
- Video Generation: User submits prompt β API calls Veo 3 β Processes video β Stores in S3
- Email Notifications: Order completed β Nodemailer sends receipt β User receives confirmation
- 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)
- Clone the repository
git clone https://github.com/yourusername/fantasize-ai.git
cd fantasize-ai- Install dependencies
npm install- Set up environment variables
cp .env.example .env
# Edit .env with your credentials- 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- Run the development server
cd apps/web
npm run dev- Open the application
http://localhost:3000
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=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
| 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 |
| Plan | Price | Tokens | Discount | Best For |
|---|---|---|---|---|
| Starter π’ | βΉ100 | 5 | - | First-time users |
| Value π΅ | 14 | 17% | Casual creators | |
| Pro π£ | 30 | 23% | Regular users + model training | |
| Ultimate π‘ | 62 | 29% | Professionals & heavy users |
- 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
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Follow the existing code style
- Run
npm run lintbefore committing - Write meaningful commit messages
- Add tests for new features
For support, email support@fantasize-ai.com.
Made with β€οΈ by VatsalCodes44





