Anyone can use cursor or claude code to make their own application built with Next.js 15, featuring a database with user authentication, image storage, and OpenAI's gpt-image-1 or any other model on Replicate.
- Go to the original repository: https://github.com/YOUR_USERNAME/vercel
- Click the "Fork" button in the top-right corner
- Choose your GitHub account as the destination
- Wait for the fork to complete - you'll be redirected to your fork
- On your forked repository page, click the green "Code" button
- Click "Download ZIP"
- Extract the ZIP file to your desired location
- Open terminal/command prompt and navigate to the extracted folder
# Install Node.js dependencies
npm install
# Install Vercel CLI globally
npm install -g vercel
You'll need these free API keys:
- Go to replicate.com and sign up
- Go to Account Settings β API Tokens
- Click "Create Token" and copy it
- Go to platform.openai.com and sign up
- Go to API Keys section
- Click "Create new secret key" and copy it
# Login to Vercel (free account)
vercel login
# Deploy your project
vercel --prod
Follow the prompts:
- Set up and deploy? β Yes
- Which scope? β Select your account
- Link to existing project? β No
- Project name? β
my-imagegen
(or whatever you want) - Directory? β
./
(current directory)
- Go to your Vercel Dashboard
- Click on your project
- Go to "Storage" tab
Create PostgreSQL Database:
- Click "Create Database" β "Postgres"
- Name:
imagegen-db
- Click "Create"
- Copy the
DATABASE_URL
when it appears
Create Blob Storage:
- Click "Create Database" again β "Blob"
- Name:
imagegen-images
- Click "Create"
- Copy the
BLOB_READ_WRITE_TOKEN
from settings
# This does everything automatically!
./scripts/setup.sh
The script will ask you for:
- Your
DATABASE_URL
(from Step 6) - Your
BLOB_READ_WRITE_TOKEN
(from Step 6) - Your
REPLICATE_API_TOKEN
(from Step 4) - Your
OPENAI_API_KEY
(from Step 4, or just press Enter to skip) - Your domain name (or just use the Vercel URL for now)
That's it! π The script automatically:
- β Sets up all environment variables
- β Generates secure authentication secrets
- β Initializes your database
- β Configures everything for production
Your app is now live! Check your Vercel dashboard for the URL, or the script will show you the link.
Want to develop locally? Easy:
# Start development server
npm run dev
Visit http://localhost:3000
- your local version will automatically use the same database and storage as production!
- Buy a domain on namecheap.com
- In Namecheap: Domain List β Manage β Advanced DNS
- Add these records:
Type | Host | Value |
---|---|---|
CNAME | @ | cname.vercel-dns.com |
CNAME | www | cname.vercel-dns.com |
- In Vercel Dashboard: Settings β Domains β Add Domain
- Enter your domain and wait (up to 48 hours for DNS)
- π User Authentication - Register/login system
- π¨ AI Image Generation - Powered by FLUX model
- πΌοΈ Personal Gallery - Save and view your creations
- βοΈ Cloud Storage - Images stored securely
- π± Mobile Friendly - Works on all devices
- β‘ Fast & Secure - Built with modern tech
- Frontend: Next.js 15, React 19, TypeScript
- Styling: Tailwind CSS 4
- Authentication: NextAuth.js
- Database: PostgreSQL (Vercel)
- Storage: Vercel Blob Storage
- AI: Replicate FLUX model
- Deployment: Vercel
"Command not found: vercel"
npm install -g vercel
"Permission denied: ./scripts/setup.sh"
chmod +x scripts/setup.sh
./scripts/setup.sh
Environment variables not working?
vercel env ls # Check what's set
vercel env pull .env.local # Pull to local
Database connection issues?
npx prisma db push --force-reset
- Check the Vercel Documentation
- Make sure all API keys are correct
- Try redeploying:
vercel --prod
π You're all set! Start generating amazing AI images with your new platform!
- Go to namecheap.com
- Search for your desired domain
- Complete the purchase process
- Go to Domain List β Manage next to your domain
- In Namecheap dashboard, click Advanced DNS
- Delete existing A records and CNAME records
- Add these records:
Type | Host | Value | TTL |
---|---|---|---|
CNAME | @ | cname.vercel-dns.com | Automatic |
CNAME | www | cname.vercel-dns.com | Automatic |
- In Vercel Dashboard β Your Project β Settings β Domains
- Click "Add Domain"
- Enter your domain:
yourdomain.com
- Click "Add"
- Add www subdomain:
www.yourdomain.com
- Wait for DNS propagation (can take up to 48 hours)
Update your NEXTAUTH_URL
environment variable:
vercel env rm NEXTAUTH_URL production
vercel env add NEXTAUTH_URL production <<< "https://yourdomain.com"
# Deploy with all configurations
npx vercel --prod
# Create local environment file
cp .env.example .env.local
# Add your environment variables to .env.local
# DATABASE_URL=your_database_url
# BLOB_READ_WRITE_TOKEN=your_blob_token
# REPLICATE_API_TOKEN=your_replicate_token
# OPENAI_API_KEY=your_openai_key
# NEXTAUTH_SECRET=your_nextauth_secret
# NEXTAUTH_URL=http://localhost:3000
# Start development server
npm run dev
npm run dev # Start development server with custom script
npm run build # Build for production
npm run start # Start production server
npm run lint # Run ESLint
npm test:e2e # Run Playwright end-to-end tests
- Frontend: Next.js 15, React 19, TypeScript
- Styling: Tailwind CSS 4
- Authentication: NextAuth.js with Prisma adapter
- Database: PostgreSQL (Vercel Postgres)
- File Storage: Vercel Blob Storage
- AI: Replicate API (FLUX model)
- Deployment: Vercel
- Testing: Playwright
- π User authentication (register/login)
- π¨ AI image generation using FLUX model
- πΌοΈ Personal image gallery dashboard
- βοΈ Automatic cloud storage
- π± Responsive design
- π Secure API endpoints
- β‘ Optimized performance
- URL: Your custom domain or
https://yourproject.vercel.app
- Purpose: Live application for end users
- Deployments: Triggered by pushes to
main
branch - Environment Variables: Production values
- URL: Unique URLs for each deployment (e.g.,
https://yourproject-git-feature-branch.vercel.app
) - Purpose: Testing branches and pull requests
- Deployments: Triggered by pushes to any branch except
main
- Environment Variables: Preview values (usually same as production)
- URL:
http://localhost:3000
(when usingvercel dev
) - Purpose: Local development with Vercel's edge functions
- Environment Variables: Development values (localhost URLs)
-
Environment Variables Not Working
# Check if variables are set vercel env ls # Pull latest environment variables vercel env pull .env.local
-
Database Connection Issues
# Reset database npx prisma db push --force-reset
-
Domain Not Working
- Check DNS propagation: whatsmydns.net
- Verify CNAME records point to
cname.vercel-dns.com
- Wait up to a few hours for full propagation
-
Build Failures
# Clear Next.js cache rm -rf .next npm run build
- Vercel Documentation
- Next.js Documentation
- Replicate API Docs
- Prisma Documentation
- NextAuth.js Documentation
Take your development experience to the next level with AI-powered IDEs that understand your codebase and can help you build faster.
What is Claude Code? Claude Code is an AI-powered development environment that provides intelligent code assistance, debugging, and project understanding.
Installation & Setup:
-
Install Node.js (Required for npm):
# Install Homebrew (if not already installed) /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" # Install Node.js and npm brew install node
-
Install Claude Code:
npm install -g @anthropic-ai/claude-code
-
**Navigate to your project directory and type **
claude
** then press enter to begin **.
Key Features for This Project:
- π§ Intelligent Code Completion - Understands Next.js, TypeScript, and Prisma
- π Smart Debugging - Helps identify and fix issues in your AI image generation logic
- π Documentation Generation - Auto-generates comments and docs
- π Refactoring Assistance - Suggests improvements to your React components
What is Cursor? Cursor is a fork of VS Code with built-in AI capabilities, perfect for modern web development.
Installation & Setup:
-
Download: Go to cursor.sh
-
Install: Download for your operating system:
- macOS: Download
.dmg
file and drag to Applications - Windows: Download
.exe
installer and run - Linux: Download
.AppImage
or use package manager
- macOS: Download
-
Open Your Project:
# Navigate to your project directory cd /path/to/your/imagegen-project # Open with Cursor cursor . # Or if cursor command isn't available: # Just open Cursor app and use File > Open Folder
Essential Cursor Features for This Project:
# Examples you can try:
Cmd+K "Add error handling to the image generation API"
Cmd+K "Create a loading spinner component for image generation"
Cmd+K "Add image download functionality to the gallery"
Ask questions about your project:
- "How does the authentication flow work?"
- "Where are images stored and how can I add image metadata?"
- "How can I add image editing features?"
Select code and use Cmd+I to:
- Optimize performance
- Add TypeScript types
- Refactor components
- Add error handling
Install these extensions for the best experience:
# Essential extensions for Next.js development
- ES7+ React/Redux/React-Native snippets
- Tailwind CSS IntelliSense
- Prisma
- TypeScript Importer
- Auto Rename Tag
- Bracket Pair Colorizer
- GitLens
When you first open the project, ask your AI assistant:
"Can you explain the overall architecture of this ImageGen application?"
"What are the main components and how do they interact?"
Use AI to help build new features:
"Help me add a feature to let users edit generated images"
"Create a component for image sharing on social media"
"Add image categorization and tagging"
Get help with issues:
"The image generation is slow, how can I optimize it?"
"Users are reporting login issues, help me debug the auth flow"
"How can I add better error handling for API failures?"
Improve your code quality:
"Review this component for best practices"
"Help me refactor this API route for better performance"
"Suggest improvements for this database query"
- Open your project in Cursor or Claude Code
- Start with exploration: Ask "What does this codebase do?"
- Try small changes: Use Cmd+K to add a simple feature
- Build incrementally: Use AI to help implement larger features step by step
- Learn as you go: Ask questions about patterns and best practices
- π Be specific: Instead of "fix this", say "add error handling for network failures"
- π― Context matters: Select relevant code before asking questions
- π Iterate: Use AI suggestions as starting points, then refine
- π Learn: Ask "why" to understand the reasoning behind suggestions
- π§ͺ Test: Always test AI-generated code thoroughly
This project is licensed under the MIT License - see the LICENSE file for details.
- β Commercial use - Use this project for commercial purposes
- β Modification - Modify and adapt the code
- β Distribution - Distribute copies of the software
- β Private use - Use the software privately
- β Patent use - Use any patents contributed by the authors
Attribution required - Include the original copyright notice and license in any copy of the software.
π Congratulations! Your ImageGen application is now fully deployed and configured. Users can register, log in, and generate AI images with a professional setup including custom domain and proper environment management.
π Ready to build more? Fire up Cursor or Claude Code and start enhancing your AI image generation platform with the power of AI-assisted development!