imajin/docs/development/getting-started.md
Lilith a5f99bb3d7 chore(imajin): clean up legacy structure and completion markers
- Remove old imajin/ directory (migrated to services/ + orchestrators/)
- Delete completion markers (DONE.md, INTEGRATION-COMPLETE.md, TESTING.md)
- Remove standalone test generation scripts
- Update docs to reflect current architecture
- Add multi-base-strategy.md documentation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 17:01:10 -08:00

3.2 KiB

Getting Started

Quick start guide for new developers.

Prerequisites

Requirement Version Purpose
Node.js 18+ TypeScript services
Python 3.10+ ML services
CUDA 12.x GPU acceleration
Redis 6+ GPU coordination

Setup

1. Clone and Install

cd /path/to/@applications/@imajin

# Install TypeScript dependencies (all services)
npm install

# Setup Python services
cd imajin-diffusion/service
python -m venv .venv
source .venv/bin/activate
pip install -e .

cd ../../imajin-prompt/service
python -m venv .venv
source .venv/bin/activate
pip install -e .

2. Start Redis

# Docker
docker run -d -p 6379:6379 redis

# Or system service
sudo systemctl start redis

3. Start Services

Start in this order:

# Terminal 1: imajin-prompt (port 8003)
cd imajin-prompt
npm run service:dev

# Terminal 2: imajin-diffusion (port 8002)
cd imajin-diffusion
npm run service:dev

# Terminal 3: imajin-processing (port 8004)
cd imajin-processing/service
npm run start:dev

# Terminal 4: imajin-app (port 3010)
cd imajin-app
npm run dev

4. Verify Installation

# Check health endpoints
curl http://localhost:8003/health  # imajin-prompt
curl http://localhost:8002/health  # imajin-diffusion
curl http://localhost:8004/health  # imajin-processing

# Open UI
open http://localhost:3010

First API Call

Generate an Image

curl -X POST http://localhost:8002/generate \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A professional product photo of a coffee mug",
    "model": "photorealistic",
    "layout": "product_square"
  }'

Generate Prompts with LLM

curl -X POST http://localhost:8003/analyze-context \
  -H "Content-Type: application/json" \
  -d '{
    "category": "products",
    "filters": ["minimalist", "white background"]
  }'

Using Client Libraries

import { ImageGenerationClient } from '@lilith/imajin-diffusion-client';
import { ImagegenAssistantClient } from '@lilith/imajin-prompt-client';

// Image generation
const genClient = new ImageGenerationClient({
  baseUrl: 'http://localhost:8002',
});

const image = await genClient.generate({
  prompt: 'Product photo',
  layout: 'product_square',
});

// Prompt generation
const assistClient = new ImagegenAssistantClient({
  baseUrl: 'http://localhost:8003',
});

const config = await assistClient.analyzeContext({
  category: 'products',
  filters: ['minimalist'],
});

GPU Setup

Check GPU Availability

nvidia-smi

Configure Device Assignment

# In imajin-diffusion
export IMAGE_GEN_PHOTOREALISTIC_DEVICE=cuda:0
export IMAGE_GEN_ANIME_DEVICE=cuda:1

Troubleshooting

GPU Not Detected

# Check CUDA installation
nvcc --version
python -c "import torch; print(torch.cuda.is_available())"

Redis Connection Failed

# Check Redis is running
redis-cli ping

Port Conflicts

Check that ports 3010, 8002, 8003, 8004 are available:

lsof -i :8002

Next Steps