A modern, responsive web application that integrates with OpenAI GPT-4 and Stackblitz to provide intelligent code generation with document processing and real-time preview capabilities.
- Smart Document Processing: Upload PDFs, Word documents, or text files for GPT-4 powered summarization
- Prompt Enhancement: GPT-4 intelligently enhances prompts with technical specifications and best practices
- AI Code Generation: GPT-4 generates production-ready Next.js applications with proper folder structure
- Live Code Preview: Stackblitz integration for real-time code editing and testing
- Download & Copy: Easy code export with one-click download and clipboard copy
- Mobile-First Responsive Design: Optimized for all device sizes
- WCAG Accessibility Compliance: Proper contrast, semantic HTML, and keyboard navigation
- Dark Mode Support: System-aware theme switching
- Smooth Animations: Subtle micro-interactions and loading states
- Toast Notifications: Real-time feedback for user actions
- Next.js 13+: Modern React framework with App Router
- Tailwind CSS: Utility-first styling with design system
- TypeScript: Full type safety throughout the application
- API Integration: Secure backend endpoints for all external services
- Error Handling: Comprehensive error states and fallbacks
- Node.js 18+
- npm or yarn
- API key for OpenAI GPT-4 (see setup instructions below)
-
Clone or download this project
-
Install dependencies:
npm install
-
Set up environment variables (see API Setup section)
-
Run the development server:
npm run dev
-
Open http://localhost:3000 in your browser
Create a .env.local file in the root directory and add your API keys:
# OpenAI API Configuration
OPENAI_API_KEY=your_openai_api_key_here- Visit OpenAI Platform
- Sign up for an OpenAI account
- Navigate to your API keys section
- Generate a new API key
- Add it to your
.env.localfile asOPENAI_API_KEY
βββ app/
β βββ api/ # API routes
β β βββ openai/ # OpenAI GPT-4.1 integration
β β βββ upload/ # File upload handling
β βββ globals.css # Global styles
β βββ layout.tsx # Root layout
β βββ page.tsx # Main application page
βββ components/
β βββ ui/ # Reusable UI components
β βββ DocumentUpload.tsx # Document upload component
β βββ PromptEditor.tsx # Prompt editing interface
β βββ CodeGenerator.tsx # Code generation interface
β βββ ThemeProvider.tsx # Theme management
β βββ ThemeToggle.tsx # Dark mode toggle
βββ lib/
β βββ utils.ts # Utility functions
βββ hooks/
βββ use-toast.ts # Toast notification hook
- Drag & drop file upload
- File type validation (PDF, Word, Text)
- Progress indicators
- Document processing with OpenAI GPT-4 API
- Rich text editing for prompts
- AI-powered prompt enhancement
- Real-time character and word count
- Enhancement status indicators
- OpenAI GPT-4 API integration for code generation
- Tabbed code view (HTML, CSS, JavaScript)
- Copy to clipboard functionality
- Download all files feature
- Stackblitz integration for live preview
Processes text using OpenAI GPT-4 API
- Body:
{ text: string, action: 'summarize' | 'enhance' } - Response:
{ success: boolean, processedText: string }
Handles file uploads and text extraction
- Body: FormData with file
- Response:
{ success: boolean, extractedText: string, filename: string }
- Colors and themes can be customized in
tailwind.config.ts - Global styles are in
app/globals.css - Component-specific styles use Tailwind utility classes
- API endpoints are in the
app/api/directory - Each service has its own route handler
- Environment variables are used for API keys
- All components are in the
components/directory - UI components follow shadcn/ui conventions
- Custom components are modular and reusable
- Add new features by creating components and API routes
- Follow the existing patterns for consistency
- Update the UI to include new functionality
npm run buildMake sure to set the required environment variables in your production environment:
OPENAI_API_KEY
This application can be deployed to:
- Vercel (recommended for Next.js)
- Netlify
- Railway
- Any platform supporting Node.js
- API Rate Limits: OpenAI GPT-4 API has rate limits. Monitor usage in production.
- File Size Limits: Current limit is 10MB for uploaded files. Adjust in
/api/upload/route.tsif needed. - Security: API keys are server-side only and never exposed to the client.
- Cost: Monitor API usage as OpenAI GPT-4 has usage-based pricing.
- Chrome 90+
- Firefox 88+
- Safari 14+
- Edge 90+
- Semantic HTML structure
- ARIA labels and descriptions
- Keyboard navigation support
- High contrast mode support
- Screen reader compatibility
- Focus management
- Follow the existing code style and patterns
- Add TypeScript types for new functionality
- Include proper error handling
- Test across different devices and browsers
- Update documentation for new features
This project is provided as-is for educational and development purposes. Please check the terms of service for Groq API and Stackblitz for commercial usage.
For issues related to:
- OpenAI GPT-4 API: Check OpenAI's documentation
- Stackblitz: Check Stackblitz's documentation
- This Application: Review the code comments and component documentation
- Support for more file formats (PowerPoint, Excel)
- Code templates and presets
- User authentication and project saving
- Version control integration
- Advanced code analysis and suggestions
- Multi-language code generation
- Collaborative editing features