**Parameter Renames (Section 1.1):** - Rename `assignAlias` → `alias` in CreateGenerationRequest - Rename `assignFlowAlias` → `flowAlias` (changed from Record<string, string> to string) - Rename `flowAliases` → `flowAlias` in UploadImageRequest - Update all route handlers and service methods to use new names - Simplify flowAlias logic to assign single alias string to output image **Reference Image Auto-Detection (Section 1.2):** - Add `extractAliasesFromPrompt()` function with regex pattern: /(?:^|\s)(@[\w-]+)/g - Make `referenceImages` parameter optional - Auto-detect aliases from prompt text and merge with manual references - Manual references have priority (listed first), then auto-detected - Remove duplicates while preserving order - Invalid aliases are silently skipped (validated with isValidAliasFormat) **FlowId Response Logic (Section 10.1):** - If `flowId: undefined` (not provided) → generate new UUID, return in response - If `flowId: null` (explicitly null) → keep null, don't generate - If `flowId: "uuid"` (specific value) → use provided value - Eager flow creation when `flowAlias` is provided (create flow immediately in DB) **Generation Modification Endpoint (Section 9):** - Add `PUT /api/v1/generations/:id` endpoint - Modifiable fields: prompt, aspectRatio, flowId, meta - Non-generative params (flowId, meta) → update DB only - Generative params (prompt, aspectRatio) → update DB + trigger regeneration - FlowId management: null to detach, UUID to attach/change (with eager creation) - Regeneration updates existing image (same ID, same MinIO path) **Type Definitions:** - Update CreateGenerationParams interface with new parameter names - Add UpdateGenerationRequest interface - Add extractAliasesFromPrompt export to validators index **Documentation:** - Update REST API examples with new parameter names **Technical Notes:** - All Phase 1 changes are backward compatible at the data layer - TypeScript strict mode passes (no new errors introduced) - Pre-existing TypeScript errors in middleware and other routes remain unchanged 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> |
||
|---|---|---|
| .claude | ||
| apps | ||
| docs | ||
| packages/database | ||
| prod-env | ||
| scripts | ||
| tests | ||
| .dockerignore | ||
| .env.example | ||
| .gitignore | ||
| .mcp.json | ||
| .prettierignore | ||
| .prettierrc.json | ||
| CLAUDE.md | ||
| README.md | ||
| UPLOAD_COMPONENTS_DELIVERY.md | ||
| UPLOAD_PAGE_IMPLEMENTATION.md | ||
| api-refactoring-final.md | ||
| banatie-api-requirements.md | ||
| banatie-database-design.md | ||
| banatie.code-workspace | ||
| demo.test.ts | ||
| infrastructure.md | ||
| minio-setup.md | ||
| package.json | ||
| pnpm-lock.yaml | ||
| pnpm-workspace.yaml | ||
| test-api.sh | ||
| test-filename-sanitization.js | ||
| vitest.config.ts | ||
README.md
Banatie - AI Image Generation Service
A comprehensive monorepo for the Banatie AI image generation platform, featuring multiple applications for different use cases.
Architecture Overview
banatie-service/
├── apps/
│ ├── api-service/ # REST API for image generation (Express.js + TypeScript)
│ ├── landing/ # Landing page with demo (Next.js)
│ ├── studio/ # SaaS platform with billing (Next.js + Supabase + Stripe)
│ └── admin/ # Administration dashboard (Next.js)
├── data/ # Docker volumes (postgres, minio)
├── docker-compose.yml # Infrastructure services
└── package.json # Workspace scripts
Applications
🚀 API Service (apps/api-service)
- Port: 3000
- Tech: Express.js, TypeScript, Gemini AI
- Purpose: Core REST API for AI image generation
- Features: Image generation, file upload, rate limiting, logging
🌐 Landing Page (apps/landing)
- Port: 3001
- Tech: Next.js 14, Tailwind CSS
- Purpose: Public landing page with demo
- Features: Service overview, image generation demo
🏢 Studio (apps/studio)
- Port: 3002
- Tech: Next.js 14, Supabase, Stripe
- Purpose: SaaS platform for paid users
- Features: Authentication, billing, subscriptions, usage tracking
🔧 Admin (apps/admin)
- Port: 3003
- Tech: Next.js 14, Dashboard components
- Purpose: Service administration and monitoring
- Features: System monitoring, user management, analytics
Quick Start
Prerequisites
- Node.js >= 18.0.0
- pnpm >= 8.0.0
- Docker & Docker Compose
Development Setup
# Clone and install dependencies
git clone <repository-url>
cd banatie-service
pnpm install
# Start infrastructure (PostgreSQL + MinIO)
docker compose up -d postgres minio storage-init
# Start all applications in development mode
pnpm dev
# Or start individual apps
pnpm dev:api # API Service on :3000
pnpm dev:landing # Landing Page on :3001
pnpm dev:studio # Studio Platform on :3002
pnpm dev:admin # Admin Dashboard on :3003
Production Deployment
# Build all applications
pnpm build
# Start infrastructure
docker compose up -d
# Start production servers
pnpm start:api
pnpm start:landing
pnpm start:studio
pnpm start:admin
Development Commands
# Install dependencies for all apps
pnpm install
# Development (all apps in parallel)
pnpm dev
# Build all apps
pnpm build
# Type checking
pnpm typecheck
# Linting
pnpm lint
# Testing (API service only)
pnpm test
# Clean all build outputs
pnpm clean
Environment Configuration
Each application has its own environment configuration:
- Root:
.env.docker(for Docker services) - API Service:
apps/api-service/.env - Studio:
apps/studio/.env.local - Admin:
apps/admin/.env.local
See individual app README files for specific environment variables.
Services & Ports
| Service | Port | Description |
|---|---|---|
| API Service | 3000 | Core REST API |
| Landing Page | 3001 | Public website |
| Studio Platform | 3002 | SaaS application |
| Admin Dashboard | 3003 | Administration |
| PostgreSQL | 5460 | Database |
| MinIO API | 9000 | Object storage |
| MinIO Console | 9001 | Storage admin |
API Usage
Generate Image
# Text-to-image
curl -X POST http://localhost:3000/api/text-to-image \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"prompt": "A magical forest with glowing mushrooms",
"filename": "magical_forest"
}'
See apps/api-service/README.md for detailed API documentation.
Contributing
- Each app has its own package.json and dependencies
- Use the root workspace commands for multi-app operations
- Follow the existing code style and patterns
- Run
pnpm typecheckandpnpm lintbefore committing
License
MIT License - see individual app directories for more details.