A modern Next.js application for generating AI-powered images using OpenAI's DALL·E 3, with secure user authentication and cloud storage.
Inspired by the previous DALLE 2 website design and Claude Code.
- 🎨 AI Image Generation: Create stunning images using DALL·E 3
- 🎭 Advanced Options: Quality settings (Standard/HD) and Style controls (Vivid/Natural)
- 📐 Multiple Formats: Square (1024×1024), Portrait (1024×1792), and Landscape (1792×1024)
- 🔐 Secure Authentication: Powered by Clerk
- 💾 Cloud Storage: AWS S3 integration for image storage
- 🗄️ Database: Supabase PostgreSQL with Drizzle ORM
- 📱 Responsive Design: Mobile-first Tailwind CSS design
- 🎯 User Gallery: Save and manage your generated images
- ⚡ Modern Stack: Next.js 15, TypeScript, React 19
- Frontend: Next.js 15, React 19, TypeScript, Tailwind CSS
- Authentication: Clerk
- Database: Supabase (PostgreSQL) with Drizzle ORM
- AI: OpenAI DALL·E 3 API
- Storage: AWS S3
- Icons: Lucide React
- Node.js 18+
- Supabase account and database
- AWS S3 bucket
- Clerk account
- OpenAI API key (with DALL·E 3 access)
Windows:
.\setup.ps1
# Edit .env.local with your API keys
.\dev.ps1Mac/Linux:
./setup.sh
# Edit .env.local with your API keys
./dev.shcd next-dalle-image-generator-kit
npm installCopy .env.example to .env.local and fill in your credentials:
cp .env.example .env.localRequired environment variables:
DATABASE_URL: PostgreSQL connection stringNEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: Clerk publishable keyCLERK_SECRET_KEY: Clerk secret keyOPENAI_API_KEY: OpenAI API keyAWS_ACCESS_KEY_ID: AWS access keyAWS_SECRET_ACCESS_KEY: AWS secret keyAWS_S3_REGION: AWS regionAWS_S3_BUCKET_NAME: S3 bucket name
Generate and push database schema to Supabase:
npm run db:generate
npm run db:push- Create an S3 bucket in AWS
- Set up proper CORS configuration for your bucket
- Create an IAM user with S3 read/write permissions
- Add the credentials to your environment variables
- Create a new application in Clerk
- Configure your sign-in/sign-up pages
- Set up webhooks if needed
- Add the keys to your environment variables
- Get an API key from OpenAI
- Add it to your environment variables
- Ensure you have sufficient credits for image generation
npm run devVisit http://localhost:3000 to see your application.
src/
├── app/ # Next.js app router
│ ├── (auth)/ # Authentication pages
│ ├── (dashboard)/ # Protected dashboard pages
│ ├── api/ # API routes
│ └── about/ # Public pages
├── components/ # Reusable React components
├── lib/ # Utility functions and configurations
│ ├── db/ # Database schema and connection
│ ├── aws.ts # AWS S3 integration
│ └── openai.ts # OpenAI integration
└── middleware.ts # Clerk middleware for route protection
POST /api/generate- Generate images with DALL·EGET /api/pictures- Fetch user's saved picturesPOST /api/pictures/save- Save generated image to galleryDELETE /api/pictures/delete- Delete image from gallery
- Navbar: Responsive navigation with authentication state
- Generate Page: AI image generation interface
- My Pictures: Personal image gallery management
- Authentication Pages: Sign-in/sign-up with Clerk
The application uses a simplified schema with Clerk handling user management:
user_pictures: Saved generated images with Clerk user ID reference
- Route protection with Clerk middleware
- Secure file uploads to S3
- User-specific image access
- API rate limiting (recommended to add)
- Environment variable validation
-
Vercel (recommended):
npm run build
Deploy through Vercel dashboard or CLI
-
Other platforms:
- Ensure all environment variables are set
- Database migrations are run
- S3 bucket is properly configured
This project is licensed under the MIT License.