Skip to content

Latest commit

Β 

History

121 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CoreClip.ai - Generate Short Video Ads via AI

Create professional marketing videos and product imagery in seconds using AI. Simply upload sample and product images, and CoreClip.ai generates high-quality ad content optimized for social media, commercials, and personal branding.

✨ Features

  • AI Image Generation: Combine product and model images to create professional product shots
  • AI Video Generation: Transform static images into engaging short-form videos
  • Credit-Based System: Flexible pricing with credit consumption (5 credits for images, 10 for videos)
  • Community Gallery: Share and discover AI-generated content
  • User Dashboard: Manage your generations with download and publish options
  • Instant Generation: Results ready in seconds to minutes

πŸ›  Tech Stack

Frontend

  • React 19 with TypeScript
  • Vite for fast development
  • Tailwind CSS for styling
  • Clerk for authentication
  • Framer Motion for animations
  • React Router for navigation

Backend

  • Express.js server
  • MongoDB with Mongoose (migrated from Postgres/Prisma)
  • Google GenAI for image/video generation
  • Cloudinary for asset storage
  • Clerk webhook integration

Database

  • MongoDB Atlas (recommended for production)
  • MongoDB local (for development)

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • MongoDB (local or Atlas)
  • Clerk account
  • Cloudinary account
  • Google Cloud GenAI API key

Installation

  1. Clone the repository

    git clone <repository-url>
    cd core-clip
  2. Backend Setup

    cd server
    npm install
    cp .env.example .env
    # Edit .env with your credentials
    npm run server

    Server runs at http://localhost:5000

  3. Frontend Setup

    cd ../client
    npm install
    cp .env.example .env
    # Edit .env with your credentials
    npm run client

    Frontend runs at http://localhost:5173

πŸ“ Project Structure

core-clip/
β”œβ”€β”€ client/                 # React frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ pages/         # Route views (Home, Generator, Result, etc.)
β”‚   β”‚   β”œβ”€β”€ components/    # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ configs/       # Axios API configuration
β”‚   β”‚   β”œβ”€β”€ types/         # TypeScript interfaces
β”‚   β”‚   └── assets/        # Images and static assets
β”‚   β”œβ”€β”€ vite.config.ts
β”‚   └── package.json
β”‚
β”œβ”€β”€ server/                 # Express backend
β”‚   β”œβ”€β”€ controllers/       # API route handlers
β”‚   β”œβ”€β”€ models/            # Mongoose schemas (User, Project)
β”‚   β”œβ”€β”€ routes/            # Express routes
β”‚   β”œβ”€β”€ configs/           # Configuration (MongoDB, AI, multer)
β”‚   β”œβ”€β”€ middlewares/       # Auth middleware
β”‚   β”œβ”€β”€ types/             # TypeScript definitions
β”‚   β”œβ”€β”€ server.ts          # Server entry point
β”‚   └── package.json
β”‚
β”œβ”€β”€ DEPLOYMENT.md          # Deployment guide
β”œβ”€β”€ MIGRATION.md           # Prisma to MongoDB migration guide
└── PROJECT_CONTEXT.md     # Comprehensive project documentation

πŸ“š Documentation

πŸ”§ Environment Variables

Client

VITE_CLERK_PUBLISHABLE_KEY=your_clerk_key
VITE_BASEURL=http://localhost:5000

Server

MONGODB_URI=mongodb+srv://username:password@cluster/coreclip
CLERK_PUBLISHABLE_KEY=your_clerk_key
CLERK_SECRET_KEY=your_clerk_secret
CLERK_WEBHOOK_SIGNING_SECRET=your_webhook_secret
CLOUDINARY_URL=cloudinary://key:secret@cloud
GOOGLE_CLOUD_API_KEY=your_genai_api_key

See .env.example in each directory for complete details.

πŸ› Recent Fixes

  • Fixed aspectRatio field name typo in Generator form submission
  • Fixed /api/projects/video endpoint path (was /api/project/video)
  • Fixed req.body() invocation error in video controller
  • Fixed /api/project/published route authentication (now public)
  • Complete migration from PostgreSQL + Prisma to MongoDB + Mongoose

πŸ“Š Database Schema

User Model

  • id: Clerk user ID (unique index)
  • email: User email (indexed)
  • name: User full name
  • image: Profile image URL
  • credits: User balance (min: 0, default: 20)
  • createdAt, updatedAt: Timestamps

Project Model

  • userId: Owner ID (indexed)
  • name, productName, productDescription
  • userPrompt: Custom generation prompt
  • aspectRatio: "9:16" or "16:9" (enum)
  • uploadedImages: Source image URLs
  • generatedImage: Generated image URL
  • generatedVideo: Generated video URL
  • isGenerating: Processing state (indexed)
  • isPublished: Community visibility (indexed)
  • error: Generation error message
  • createdAt, updatedAt: Timestamps

πŸ”Œ API Endpoints

All endpoints require Clerk authentication (except public endpoints).

User Routes

  • GET /api/user/credits - Get user credit balance
  • GET /api/user/projects - Get all user projects
  • GET /api/user/projects/:projectId - Get single project
  • GET /api/user/publish/:projectId - Toggle project visibility

Project Routes

  • POST /api/project/create - Create and generate image (5 credits)
  • POST /api/project/video - Generate video (10 credits)
  • GET /api/project/published - Get published projects (public)
  • DELETE /api/project/:projectId - Delete project

See PROJECT_CONTEXT.md for full details.

🎬 Generation Flow

  1. User uploads images β†’ Product and model images
  2. Backend validates β†’ Checks credits and files
  3. Google GenAI generates β†’ Creates composite product image
  4. Cloudinary stores β†’ Image uploaded and URL saved
  5. Database updates β†’ Project marked complete
  6. User optionally generates video β†’ Same flow for video

πŸ’³ Pricing Model

  • Image Generation: 5 credits
  • Video Generation: 10 credits
  • Starting Credits: 20 free credits per user
  • Upgrade Plans:
    • Pro: +80 credits
    • Premium: +240 credits

🚒 Deployment

See DEPLOYMENT.md for:

  • MongoDB setup instructions
  • Clerk webhook configuration
  • Vercel + Railway deployment
  • Docker containerization

πŸ” Security

  • Clerk handles user authentication
  • Protected API routes via auth middleware
  • MongoDB connection with SSL/TLS
  • Environment variables for sensitive data
  • CORS configured for authorized origins

🀝 Contributing

  1. Create a feature branch
  2. Make your changes
  3. Test locally
  4. Submit a pull request

πŸ“ License

ISC

πŸ†˜ Troubleshooting

MongoDB Connection Issues

  • Verify connection string in .env
  • Check IP whitelist in MongoDB Atlas
  • Test with: mongodb://localhost:27017/coreclip (local dev)

Clerk Webhook Issues

  • Verify webhook secret in .env
  • Check Clerk dashboard for webhook logs
  • Ensure webhook endpoint is accessible

AI Generation Timeouts

  • Video generation takes 2-5 minutes
  • Verify Google Cloud API quota
  • Check network connectivity

Port Already in Use

  • Backend: lsof -i :5000 then kill <PID>
  • Frontend: lsof -i :5173 then kill <PID>

πŸ“ž Support

For issues or questions:

  1. Check PROJECT_CONTEXT.md for detailed docs
  2. Review error messages in server/browser console
  3. Check MongoDB/Clerk/Cloudinary dashboards
  4. Open an issue on GitHub

CoreClip.ai - Transform product images into viral video content with AI.

About

An AI oriented videos & shorts generator platform

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages