A modern Rails application for generating AI-powered images with custom styles and variations. This application provides an intuitive interface for creating, managing, and organizing AI-generated assets using OpenAI's image generation capabilities.
- Style Management: Create and manage custom AI prompts and styles
- Image Generation: Generate AI images using OpenAI's DALL-E
- Image Variations: Create variations of existing images
- Download Package: Download images with all variations in multiple sizes (ZIP format)
- Modern UI: Beautiful, responsive interface built with Tailwind CSS
- Dashboard: Real-time statistics and quick access to all features
- Gallery: Browse and organize all generated images
The Asset Generator includes a comprehensive download system that allows you to download images with all their variations in multiple sizes:
- Original: Full resolution as generated
- 1024px: Web-optimized large size
- 512px: Medium size for general use
- 64px: Thumbnail/icon size
image_name_assets.zip
โโโ original/
โ โโโ image_name.jpg
โ โโโ variation_1.jpg
โโโ 1024px/
โ โโโ image_name_1024px.jpg
โ โโโ variation_1_1024px.jpg
โโโ 512px/
โ โโโ image_name_512px.jpg
โ โโโ variation_1_512px.jpg
โโโ 64px/
โโโ image_name_64px.jpg
โโโ variation_1_64px.jpg
- Navigate to any image page
- Click "Download All Sizes (ZIP)" button
- The system will generate a ZIP file containing:
- The original image and all its variations
- Each image resized to 4 different sizes
- Organized in separate folders by size
- Maintains aspect ratio for all resized versions
- Backend: Ruby on Rails 8+
- Frontend: Tailwind CSS, Stimulus (Hotwire)
- Database: SQLite (development), PostgreSQL (production)
- AI Integration: OpenAI API (DALL-E)
- Testing: RSpec
- Deployment: Docker, Kamal
- Ruby 3.0+
- Rails 7.0+
- Node.js 16+
- SQLite3 (development)
- OpenAI API key
git clone <repository-url>
cd asset-generator
bin/setupCreate a .env file in the root directory:
OPENAI_API_KEY=your_openai_api_key_here
RAILS_MASTER_KEY=your_rails_master_keyrails db:create
rails db:migrate
rails db:seedbundle install
npm installbin/devThe application will be available at http://localhost:3000
The application is built around five core models:
- Purpose: Template for AI image generation
- Attributes:
title(string): Human-readable nameprompt(text): Base AI prompt for image generation
- Purpose: Specific request to generate an image
- Attributes:
prompt(text): Custom prompt for this request
- Relationships:
belongs_to :style
- Purpose: Generated AI image result
- Relationships:
belongs_to :image_request(optional)
- Purpose: Alternative version of an existing image
- Relationships:
belongs_to :image(parent image)
- Purpose: Request to create image variations
- Relationships:
belongs_to :variation
- Navigate to the Styles section
- Click "Create New Style"
- Enter a descriptive title and base prompt
- Save to use for image generation
- Go to the Dashboard or Images section
- Click "Generate Image"
- Select a style or enter a custom prompt
- Submit the request
- View the generated image in the gallery
- Find an existing image in the gallery
- Click "Create Variation"
- The system will generate alternative versions
- View all variations in the Variations section
- Statistics overview
- Quick action buttons
- Recent images gallery
- Navigation to all sections
- Clean, modern navigation bar
- Mobile-responsive design
- Visual indicators for active sections
- Consistent card-based layouts
- Form validation and error handling
- Loading states and feedback
- Mobile-first approach
- Tablet and desktop optimized
- Touch-friendly interface
# Run all tests
bundle exec rspec
# Run specific test files
bundle exec rspec spec/models/
bundle exec rspec spec/controllers/# Run RuboCop for Ruby code style
bundle exec rubocop
# Run Brakeman for security analysis
bundle exec brakeman# Start with hot reloading
bin/dev
# Or start individual services
rails server
./bin/rails tailwindcss:watch# Build the image
docker build -t asset-generator .
# Run the container
docker run -p 3000:3000 -e OPENAI_API_KEY=your_key asset-generator# Setup deployment
kamal setup
# Deploy updates
kamal deployConfigure OpenAI settings in config/initializers/openai.rb:
OpenAI.configure do |config|
config.access_token = Rails.application.credentials.openai_api_key
config.organization_id = Rails.application.credentials.openai_organization_id # Optional
endTailwind configuration is in tailwind.config.js. Custom styles are defined in app/assets/stylesheets/application.tailwind.css.
GET /- DashboardGET /styles- List all stylesPOST /styles- Create new styleGET /images- Image galleryPOST /image_requests- Generate new imageGET /variations- List variationsPOST /variation_requests- Create variation
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add 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.
For support and questions:
- Create an issue in the repository
- Check the documentation
- Review the code examples in the application
- User authentication and authorization
- Image editing and filters
- Batch image generation
- Integration with other AI providers
- Advanced style templates
- Image sharing and collaboration
- API for external integrations
- Image optimization and compression