AI-Powered Script Writing and Content Creation Platform
Yoink AI is a Full-Stack web application that combines the power of OpenAI's GPT-4 with advanced content generation capabilities. Create scripts, generate images, and produce videos through an intuitive chat-based interface.
- π€ AI-Powered Chat Interface - Conversation-driven content creation with OpenAI GPT-4
- π Script Writing - Generate professional scripts with AI assistance
- π¨ Image Generation - Create stunning visuals with DALL-E 3
- π¬ Video Generation - Transform images into videos (placeholder mode)
- βοΈ Cloud Storage - Automatic asset management with Cloudinary
- πΎ Data Persistence - PostgreSQL database with full conversation history
- β‘ Real-time Updates - WebSocket-powered live collaboration
- π± Responsive Design - Modern UI built with Next.js and Tailwind CSS
Screen.Recording.2025-08-07.at.3.53.06.PM.mp4
graph TD
%% Frontend Layer
A[Web UI] -->|renders| B[Editor Component]
A -->|renders| C[Renderer Component]
%% Communication Layer
B -->|uses| D[WebSocket Client]
A -->|uses| E[HTTP Client]
%% Backend Gateway
F[Server] -->|has| G[WebSocket Gateway]
F -->|has| H[REST API]
%% Service Layer
G -->|communicates| I[AI Service]
H -->|manages| J[User Service]
H -->|manages| K[Project Service]
%% External Connections
I -->|requests| L[OpenAI API]
K -->|uploads| M[Cloudinary API]
%% Database Layer
J -->|queries| N[(PostgreSQL)]
K -->|queries| N
%% Infrastructure
F -->|runs in| O[Docker Container]
N -->|hosted in| O
%% Real-time Flow
D -->|connects to| G
E -->|requests to| H
- Framework: Next.js 15 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS
- UI Components: Custom components with Shadcn/ui patterns
- HTTP Client: Axios
- Real-time: Socket.io Client
- Framework: NestJS
- Language: TypeScript
- Database: PostgreSQL with Prisma ORM
- Real-time: Socket.io
- Validation: class-validator
- Architecture: Modular design with dependency injection
- AI: OpenAI API (GPT-4, DALL-E 3)
- Storage: Cloudinary
- Infrastructure: Docker
User Input β Frontend β WebSocket β NestJS Gateway β OpenAI Service β AI Response β Real-time Updates
Chat Message β AI Analysis β Function Calling β Tool Execution β Asset Creation β Database Storage β UI Update
Frontend (Axios) β NestJS Controllers β Services β Prisma β PostgreSQL
- Node.js 18+
- Docker
- OpenAI API Key
- Cloudinary Account
git clone <repository-url>
cd YoinkAI
# Install dependencies
cd server && npm install
cd ../client && npm installCreate server/.env:
DATABASE_URL="postgresql://user:password@localhost:5432/yoink_ai"
OPENAI_API_KEY="your_openai_api_key_here"
# Cloudinary Configuration
CLOUDINARY_CLOUD_NAME="your_cloud_name"
CLOUDINARY_API_KEY="your_api_key"
CLOUDINARY_API_SECRET="your_api_secret"
# Server
PORT=3001# Start PostgreSQL with Docker
docker-compose up -d
# Run database migrations
cd server
npx prisma migrate devTerminal 1 - Backend:
cd server
npm run start:devTerminal 2 - Frontend:
cd client
npm run dev- Frontend: http://localhost:3000
- Backend: http://localhost:3001
src/
βββ app.module.ts # Root module - orchestrates all modules
βββ main.ts # Application entry point
βββ users/ # User management module
β βββ users.module.ts # Module definition
β βββ users.controller.ts # HTTP route handlers
β βββ users.service.ts # Business logic
β βββ dto/ # Data transfer objects
βββ projects/ # Project management module
βββ openai/ # AI service integration
βββ gateway/ # WebSocket real-time communication
βββ cloudinary/ # Asset storage service
βββ video/ # Video generation (placeholder)
βββ tools/ # Utility services
βββ prisma/ # Database service
- Purpose: Core AI functionality
- Features:
- Chat completions with GPT-4
- Function calling for tool execution
- Image generation with DALL-E 3
- Retry logic for rate limiting
- Dependencies: ProjectsService, CloudinaryService, VideoService
- Purpose: Project and conversation management
- Features:
- CRUD operations for projects
- Conversation history management
- Element (content) storage
- Dependencies: PrismaService
- Purpose: Real-time communication
- Features:
- Live chat updates
- Generation status notifications
- Room-based project isolation
- Dependencies: OpenAIService
src/
βββ app/ # Next.js App Router
β βββ page.tsx # Home page - project listing
β βββ projects/[id]/ # Dynamic project pages
βββ components/
β βββ editor/ # Main editor components
β β βββ editor.tsx # Chat interface
β β βββ element-renderer.tsx # Content display
β βββ ui/ # Reusable UI components
βββ lib/
β βββ socket.ts # WebSocket client singleton
βββ types/
βββ index.ts # TypeScript interfaces
- Real-time chat interface
- Dynamic content rendering
- WebSocket event handling
- State management for conversations
- Displays different content types (text, images, videos)
- Handles loading states
- Responsive design
- Users: User authentication and profiles
- Projects: Individual user projects
- ConversationTurns: Chat history with role-based messages
- Elements: Generated content (scripts, images, videos)
User β Projects (1:N)
Project β ConversationTurns (1:N)
Project β Elements (1:N)
GET /projects/:id # Get project details
POST /projects # Create new project
GET /projects/user/:userId # Get user's projects
POST /users/find-or-create # User management
prompt # Send chat message
textChunk # Receive AI response
elementAdded # New content generated
info # Status updates
Yoink AI uses OpenAI's function calling to enable the AI to execute specific tools:
- generate_image: Creates images using DALL-E 3
- generate_video: Placeholder video generation
- add_script_element: Adds formatted script content
User Request β AI Analysis β Function Selection β Tool Execution β Result Integration β Response
- WebSocket-based live updates
- Instant message delivery
- Generation status notifications
- Room-based project isolation
- Scripts: AI-powered screenplay writing
- Images: DALL-E 3 integration with Cloudinary storage
- Videos: Placeholder system (cost-controlled)
- Complete conversation history
- Generated asset storage
- Project organization
- User session management
- Environment Variables: Secure API key management
- Validation: DTO-based request validation
- Error Handling: Comprehensive error logging
- Rate Limiting: Built-in retry mechanisms
- CORS: Properly configured cross-origin requests
# Backend tests
cd server && npm run test
# Frontend tests
cd client && npm run test# Backend build
cd server && npm run build
# Frontend build
cd client && npm run build- Set
NODE_ENV=production - Configure proper database URL
- Set client URL for CORS
- Add production API keys
# Build and run with Docker Compose
docker-compose -f docker-compose.prod.yml up -d- Database: Indexed queries for conversation history
- Assets: CDN delivery via Cloudinary
- Caching: Client-side caching for static content
- Optimization: Code splitting and lazy loading
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
This project is licensed under the MIT License.
Built with β€οΈ using NestJS, Next.js, and OpenAI