Transform your beloved pets into stunning artistic creations with advanced AI technology. Create professional-quality photos with holiday themes, fantasy adventures, and more.
AI-Petography is a modern, production-ready platform built with Next.js, Supabase, and Creem.io. It leverages the power of Seedream 4 AI to transform ordinary pet photos into extraordinary artistic masterpieces.
-
🎨 AI-Powered Pet Photo Generation
- Advanced Seedream 4 AI integration
- Multiple quality levels (Normal, 2K, 4K)
- 5 core themes: Holiday, Professional, Fantasy, Fashion, Art
- Professional-grade image generation in ~10 seconds
-
🖼️ Beautiful User Interface
- Modern, responsive design optimized for all devices
- Smooth animations and transitions with Framer Motion
- Waterfall layout for browsing reference images
- Intuitive drag-and-drop upload interface
-
🚀 Next.js App Router
- Latest Next.js features and optimizations
- Server and client components for optimal performance
- Built-in route protection and middleware
- Fast page loading and navigation
-
🔐 Complete Authentication System
- Powered by Supabase Auth
- Email/password authentication
- OAuth provider support (Google, GitHub, etc.)
- Secure session management
- Row-level security (RLS) for data protection
-
💳 Flexible Payment & Credit System
- Seamless Creem.io integration for global payments
- Credit-based pricing model (100/300/500 credits)
- Detailed usage tracking and history
- Automatic customer record management
-
🛠️ Developer Experience
- Full TypeScript type safety
- Clean, modular project structure
- Comprehensive documentation
- Modern development tools and practices
- Upload Pet Photos: Users upload up to 3 photos of their pets
- Choose Theme & Style: Select from 5 curated themes with reference images
- AI Generation: Seedream 4 AI creates stunning transformations in ~10 seconds
- Quality Selection: Choose from Normal (100 credits), 2K (300 credits), or 4K (500 credits)
- Download & Share: Save results and share on social media platforms
- Node.js 18+ and npm
- Supabase account
- Creem.io account
- Seedream 4 API access
git clone https://github.com/yourusername/ai-petography.git
cd ai-petographynpm install-
Create a new project on Supabase
- Click "New Project"
- Fill in project details (name, password, etc.)
-
Go to Project Settings > API to get your credentials
- Copy the project URL and anon key
- Paste them into your .env.local file
-
Run the database migrations
npx supabase db push
-
Sign up for Creem.io
-
Initial setup
- Enable test mode for development
- Navigate to "Developer" section in the top navigation
- Copy your API Key and paste it into your .env.local file
-
Create Webhooks
- Go to Developer > Webhooks
- Create a new webhook
- Set URL:
https://yourdomain.com/api/webhooks/creem - Copy the webhook secret and add it to your .env.local file
-
Update environment variables
cp .env.example .env.local
Add to your
.env.local:CREEM_API_KEY=your_api_key CREEM_WEBHOOK_SECRET=your_webhook_secret CREEM_API_URL=https://test-api.creem.io/v1
- Get access to Seedream 4 API
- Add your API credentials to
.env.local:SEEDREAM_API_KEY=your_seedream_api_key SEEDREAM_API_URL=https://api.seedream.ai/v1 SEEDREAM_MODEL=seedream-4
-
In your Supabase project, create a storage bucket:
- Go to Storage in the Supabase dashboard
- Create a new bucket named "pet-images"
- Set appropriate permissions for authenticated users
-
Add the bucket name to your
.env.local:NEXT_PUBLIC_SUPABASE_STORAGE_BUCKET=pet-images
npm run devVisit http://localhost:3000 to see your application.
- Push your code to GitHub
- Import your repository to Vercel
- Add all environment variables
- Deploy your application
- In Creem.io dashboard, switch to production mode
- Update webhook configuration:
- Go to Developer > Webhooks
- Edit your webhook
- Update URL to:
https://yourdomain.com/api/webhooks/creem
ai-petography/
├── app/ # Next.js App Router
│ ├── (auth-pages)/ # Authentication pages
│ ├── api/ # API routes
│ ├── dashboard/ # User dashboard
│ └── profile/ # User profile
├── components/ # Reusable UI components
│ ├── ui/ # shadcn/ui components
│ └── dashboard/ # Dashboard-specific components
├── hooks/ # Custom React hooks
├── lib/ # Utility libraries
├── supabase/ # Database migrations
└── utils/ # Helper functions
Test the system functionality:
- User Authentication: Sign up and sign in flows
- Credit System: Purchase credits using test card (4242 4242 4242 4242)
- Image Upload: Upload pet photos and test validation
- AI Generation: Test the complete generation workflow
POST /api/credits- Manage user creditsPOST /api/webhooks/creem- Handle payment webhooksPOST /api/pet-generation- Generate AI pet photos (coming soon)
- Row Level Security (RLS) for data protection
- File upload validation and sanitization
- Rate limiting for API endpoints
- Content moderation for generated images
- Secure payment processing with Creem.io
// Example API call for generating pet photos
const generatePetPhoto = async (petImage: File, theme: string, quality: string) => {
const formData = new FormData();
formData.append('petImage', petImage);
formData.append('theme', theme);
formData.append('quality', quality);
const response = await fetch('/api/pet-generation', {
method: 'POST',
body: formData,
});
return response.json();
};// Check user credits
const { credits, loading } = useCredits();
// Spend credits for generation
const success = await spendCredits(300, 'pet_photo_generation');- Holiday - Festive seasonal transformations
- Professional - Business and career-themed photos
- Fantasy - Magical and mythical adventures
- Fashion - Stylish and trendy looks
- Art - Artistic and creative interpretations
All required environment variables are documented in .env.example. Key configurations include:
- Supabase: Database and authentication
- Creem.io: Payment processing
- Seedream 4: AI image generation
- Storage: Image upload and management
The application uses the following main tables:
customers- User and payment informationcredits_history- Credit transaction trackingip_usage_logs- Rate limiting for free userspet_generations- Generated image records (coming soon)
- Update Creem.io to production mode
- Update environment variables:
CREEM_API_URL=https://api.creem.io NEXT_PUBLIC_SITE_URL=https://yourdomain.com - Update webhook URLs in Creem.io dashboard
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
For questions and support, please open an issue on GitHub or contact the development team.