mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-16 09:19:39 +02:00
Replace Coolify with Docker Compose throughout documentation. The project never used Coolify - a removal script was created but never executed, leaving incorrect documentation. Changes: - Delete 13 heavily Coolify-focused docs files - Update ~30 files replacing Coolify → Docker Compose - Remove obsolete removal script - Fix deployment references in active and archived projects 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
3.7 KiB
3.7 KiB
Memoro Admin API
Backend API service for Memoro Admin with AI image generation via Replicate.
🚀 Quick Start
Prerequisites
- Node.js 20+
- Replicate API Token (get it from https://replicate.com/account/api-tokens)
Installation
- Install dependencies:
cd services/admin-api
npm install
- Configure environment:
cp .env.example .env
# Edit .env and add your REPLICATE_API_TOKEN
- Run in development:
npm run dev
The API will be available at http://localhost:3001
📝 API Endpoints
Health Check
GET /health
# No auth required
Test Replicate Configuration
GET /api/personas/test?apiKey=your-api-key
Generate Persona Images
POST /api/personas/generate-images
Headers:
X-API-Key: your-api-key
Body:
{
"personaData": {
"name": "Thomas Bauer",
"appearance": {
"prompt": "45 year old German craftsman...",
"description": "..."
}
},
"style": "portrait", // portrait | professional | casual | lifestyle
"count": 4 // 1-4 images
}
Get Available Styles
GET /api/personas/styles?apiKey=your-api-key
🐳 Docker Deployment
Using Docker Compose:
# Build and run
docker-compose up -d
# View logs
docker-compose logs -f admin-api
Using Docker directly:
# Build image
docker build -t memoro-admin-api .
# Run container
docker run -d \
-p 3001:3001 \
-e REPLICATE_API_TOKEN=your_token \
-e API_KEY=your_api_key \
-v $(pwd)/storage:/app/storage \
memoro-admin-api
🔧 Configuration
Environment Variables
| Variable | Description | Default |
|---|---|---|
PORT |
API server port | 3001 |
REPLICATE_API_TOKEN |
Your Replicate API token | Required |
API_KEY |
API authentication key | memoro-admin-api-key-2025 |
CORS_ORIGIN |
Allowed CORS origin | http://localhost:4321 |
STORAGE_PATH |
Local image storage path | ./storage/images |
LOG_LEVEL |
Logging level | debug |
💰 Cost Estimation
- SDXL Model: ~$0.0023 per image
- 4 images per persona: ~$0.01
- 100 personas: ~$1.00
📁 Project Structure
admin-api/
├── src/
│ ├── index.ts # Main server file
│ ├── routes/
│ │ └── personas.route.ts # Personas endpoints
│ ├── services/
│ │ └── replicate.service.ts # Replicate integration
│ └── types/
│ └── persona.types.ts # TypeScript types
├── storage/ # Generated images storage
├── docker-compose.yml # Docker orchestration
├── Dockerfile # Container definition
└── package.json # Dependencies
🧪 Testing
Test API locally:
# 1. Check health
curl http://localhost:3001/health
# 2. Test Replicate configuration
curl "http://localhost:3001/api/personas/test?apiKey=memoro-admin-api-key-2025"
# 3. Generate test image
curl -X POST http://localhost:3001/api/personas/generate-images \
-H "X-API-Key: memoro-admin-api-key-2025" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Professional portrait of a 45 year old German craftsman",
"style": "portrait",
"count": 1
}'
🚢 Production Deployment (Hetzner VPS)
- Push to GitHub
- SSH to server and pull repository
- Set environment variables
- Deploy with Docker Compose
- Configure custom domain & SSL via Nginx/Certbot
📄 License
Private - Memoro Internal Use Only