A professional, modern web application built with Next.js that allows users to transform their hairstyle using AI image generation technology.
- Image Upload: Drag-and-drop or browse to upload your photo
- 16+ Hair Styles: Choose from a variety of professional hairstyles across different categories:
- Short (Pixie, Undercut)
- Medium (Bob, Lob, Shaggy Layers)
- Long (Beach Waves, Sleek Straight, Blunt Cut)
- Curly (Voluminous Curls, Loose Curls, Natural Afro)
- Modern & Classic styles
- Customizable Prompts: Edit and refine AI prompts with quick modifiers
- Side-by-Side Comparison: View original and transformed images together
- Responsive Design: Works seamlessly on all devices
- Modern UI: Clean, professional interface with dark mode support
- Framework: Next.js 16 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS
- UI Components: Custom-built with modern design principles
- Image Processing: Next.js Image Optimization
- Node.js 18+ installed
- npm or yarn package manager
- Clone the repository:
git clone <your-repo-url>
cd img_generationweb- Install dependencies:
npm install- Set up environment variables:
cp .env.example .env- Add your AI service API key to
.env:
REPLICATE_API_TOKEN=your_token_here
# OR
OPENAI_API_KEY=your_key_here
# OR
STABILITY_API_KEY=your_key_here- Run the development server:
npm run dev- Open http://localhost:3000 in your browser
The application is designed to work with multiple AI image generation services. By default, it includes a placeholder that returns the original image.
- Best for Stable Diffusion models
- Sign up at replicate.com
- Add API token to
.env
- Sign up at platform.openai.com
- Add API key to
.env
- Sign up at stability.ai
- Add API key to
.env
- Choose your AI service
- Sign up and get API credentials
- Add credentials to
.env - Update
/app/api/generate/route.tswith service-specific code - Uncomment and modify the example code provided in the route
img_generationweb/
├── app/
│ ├── api/
│ │ └── generate/
│ │ └── route.ts # API endpoint for image generation
│ ├── globals.css # Global styles
│ ├── layout.tsx # Root layout
│ └── page.tsx # Main page
├── components/
│ ├── ImageUpload.tsx # Image upload component
│ ├── StyleSelector.tsx # Hair style selector
│ ├── PromptEditor.tsx # Prompt customization
│ └── ResultsDisplay.tsx # Results comparison view
├── lib/
│ ├── types.ts # TypeScript types
│ └── hairStyles.ts # Hair style definitions
├── public/ # Static assets
├── .env.example # Environment variables template
├── next.config.js # Next.js configuration
├── tailwind.config.js # Tailwind CSS configuration
└── tsconfig.json # TypeScript configuration
- Upload Photo: Click or drag-and-drop your photo
- Select Style: Browse and select from 16+ hair styles
- Customize: Edit the AI prompt or add quick modifiers
- Generate: Click "Generate New Look" button
- Compare: View side-by-side comparison of original and transformed images
- Download: Save your transformed image
# Run development server
npm run dev
# Build for production
npm run build
# Start production server
npm start
# Run linter
npm run lintThe application uses a modern, professional color scheme:
- Primary: Indigo shades (for accents and CTAs)
- Neutral: Gray scale (for text and backgrounds)
- Dark Mode: Full support with adjusted colors
- Mobile: < 640px
- Tablet: 640px - 1024px
- Desktop: > 1024px
- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
- Optimized images with Next.js Image component
- Lazy loading for better initial load
- Minimized CSS with Tailwind
- Efficient component rendering
- Push code to GitHub
- Import project in Vercel
- Add environment variables
- Deploy
The application can be deployed to any platform that supports Next.js:
- Netlify
- AWS Amplify
- Digital Ocean
- Railway
Contributions are welcome! Please feel free to submit a Pull Request.
ISC
For issues and questions, please open an issue in the repository.
- Add more hair styles
- Implement hair color changes
- Add multiple image uploads
- Save and compare multiple transformations
- User accounts and history
- Social sharing features
- Advanced editing tools
Built with Next.js, TypeScript, and Tailwind CSS AI integration ready for Replicate, OpenAI, or Stability AI