A modern, AI-powered web application for generating videos from text prompts or images. Built with Next.js 16 and powered by multiple AI services including KIE AI, Google Gemini, and GROQ.
- Text-to-Video Generation: Convert text prompts into engaging videos using AI
- Image-to-Video Generation: Transform static images into dynamic video content
- AI-Powered Image Description: Automatic image captioning using Google Gemini
- Chatbot Interface: Interactive chat-based UI for seamless video generation
- Real-time Status Tracking: Monitor your video generation progress in real-time
- Credit System: Built-in credit management for video generation
- Secure Authentication: Cookie-based authentication system
- API Documentation: Comprehensive API documentation with Swagger UI (development mode)
- Dark Mode Support: Beautiful UI with dark/light theme switching
- Framework: Next.js 16 (App Router)
- Language: TypeScript
- UI Library: React 19
- Styling: Tailwind CSS 4
- Component Library: shadcn/ui (Radix UI)
- Icons: Lucide React
- Form Handling: React Hook Form + Zod validation
- Notifications: Sonner
-
Video Generation: KIE AI
-
AI Image Description: Google Gemini / OpenRouter
-
Language Processing: GROQ
-
Image Storage: Cloudinary
-
API Documentation: Swagger UI + OpenAPI 3.0
Note: Image description uses Google Gemini as the primary service.
OpenRouteris available as a fallback for image description when Gemini fails or is unavailable.
Before you begin, ensure you have the following installed:
- Node.js 18.x or higher
- pnpm (recommended) or npm/yarn
- Git
You'll also need API keys from:
- KIE AI - for video generation
- Google Cloud - for Gemini API
- Cloudinary - for image uploads
- OpenRouter - optional fallback for image description
- GROQ - for language processing (optional)
-
Clone the repository
git clone <repository-url> cd Generate_video_web_app
-
Install dependencies
pnpm install # or npm install # or yarn install
-
Set up environment variables
Copy the example environment file:
cp .env.example .env
Then edit
.envwith your actual API keys:# KIE API Key for video generation KIE_API_KEY=your_kie_api_key_here # Cloudinary credentials for image upload CLOUDINARY_CLOUD_NAME=your_cloud_name CLOUDINARY_API_KEY=your_api_key CLOUDINARY_API_SECRET=your_api_secret # Google API Key for Gemini GEMINI_API_KEY=your_google_api_key_here # GROQ API Key (optional) GROQ_API_KEY=your_groq_api_key_here # Login credentials LOGIN_USER=your_username LOGIN_PASS=your_secure_password
Start the development server:
pnpm dev
# or
npm run devThe application will be available at http://localhost:3000
Note: In development mode, you can access:
- API Documentation: http://localhost:3000/api/docs
- OpenAPI JSON: http://localhost:3000/api/docs/openapi.json
-
Build the application
pnpm build
-
Start the production server
pnpm start
Note: API documentation is automatically disabled in production for security.
The application provides the following REST API endpoints:
POST /api/login- User loginPOST /api/logout- User logoutGET /api/auth- Check authentication status
POST /api/generate- Generate video from text or imageGET /api/generate/status- Check video generation statusGET /api/credits- Get remaining credits
POST /api/describe- Generate description for an image
For detailed API documentation with request/response examples, see:
Or visit /api/docs in development mode for interactive Swagger UI.
pnpm dev- Start development serverpnpm build- Build for productionpnpm start- Start production serverpnpm lint- Run ESLint
This project uses:
- TypeScript for type safety
- ESLint for code linting
- Tailwind CSS for consistent styling
- Zod for runtime validation
| Variable | Description | Required |
|---|---|---|
KIE_API_KEY |
KIE AI API key for video generation | Yes |
GEMINI_API_KEY |
Google Gemini API key for image description | Yes |
CLOUDINARY_CLOUD_NAME |
Cloudinary cloud name | Yes (for image-to-video) |
CLOUDINARY_API_KEY |
Cloudinary API key | Yes (for image-to-video) |
CLOUDINARY_API_SECRET |
Cloudinary API secret | Yes (for image-to-video) |
GROQ_API_KEY |
GROQ API key for language processing | Optional |
LOGIN_USER |
Username for authentication | Yes |
LOGIN_PASS |
Password for authentication | Yes |
OPENROUTER_API_KEY |
OpenRouter API key for image description fallback | Optional |
- Supports both text-to-video and image-to-video generation
- Real-time progress tracking
- Automatic retry mechanism
- Credit-based usage system
-
AI-powered image captioning using Google Gemini
-
Support for public image URLs and base64 data URLs
-
Automatic image upload to Cloudinary
-
Optional GROQ integration for enhanced descriptions
-
Uses Google Gemini for primary image captioning; falls back to OpenRouter when Gemini errors or is unavailable.
- Cookie-based session management
- HTTP-only cookies for security
- Protected API routes
- Automatic session expiration
- CSRF protection
- Rate limiting ready
- Environment-based API documentation access
- Secure credential storage
- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your 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
This project is private and proprietary.
Video generation fails:
- Check your KIE_API_KEY is valid
- Ensure you have sufficient credits
- Verify your internet connection
Image upload fails:
- Verify Cloudinary credentials are correct
- Check image size (max 10MB recommended)
- Ensure image format is supported (JPEG, PNG, WebP)
Authentication issues:
- Clear browser cookies and try again
- Verify LOGIN_USER and LOGIN_PASS in .env
- Check if session has expired
For issues and questions:
- Review troubleshooting section above
- Open an issue in the repository
Built with Next.js, React, and AI