A full-stack Next.js application that integrates Stability AI's Edit Image API to provide powerful image editing capabilities.
-
Image Editing
- Erase objects
- Search and replace objects
- Search and recolor objects
- Remove background
- Replace background and relight
-
User Management
- User authentication
- Save edited images
- View editing history
- Frontend: Next.js, TypeScript, Tailwind CSS, Shadcn UI
- Backend: Next.js API Routes
- Database: PostgreSQL with Prisma ORM
- Authentication: NextAuth.js
- Image Processing: Stability AI API
- Image Storage: Cloudinary
- State Management: Zustand
- Node.js 18+ and npm
- PostgreSQL database
- Stability AI API key
- Cloudinary account
Create a .env
file in the root directory with the following variables:
# Database
DATABASE_URL="postgresql://user:password@localhost:5432/edit_image"
# Next Auth
NEXTAUTH_SECRET="your-nextauth-secret"
NEXTAUTH_URL="http://localhost:3000"
# Stability AI
STABILITY_API_KEY="your-stability-api-key"
# Cloudinary
NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME="your-cloud-name"
CLOUDINARY_API_KEY="your-api-key"
CLOUDINARY_API_SECRET="your-api-secret"
- Clone the repository:
git clone https://github.com/yourusername/edit-image.git
cd edit-image
- Install dependencies:
npm install
- Set up the database:
npx prisma generate
npx prisma db push
- Run the development server:
npm run dev
- Open http://localhost:3000 in your browser.
The application uses the following Stability AI endpoints:
POST /api/v1/generation/image-to-image
: For image editingPOST /api/v1/generation/image-to-image/masking
: For object removalPOST /api/v1/generation/image-to-image/upscale
: For image enhancement
For more details, refer to the Stability AI API Documentation.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.