Archetype is a multi-agent AI pipeline that transforms creative briefs into fully realized concept worlds. Three specialized agents collaborate with the user through a human-in-the-loop process to generate civilization lore, architectural structures, and final concept art.
Built for IAT 460, Simon Fraser University.
The system uses three agents in sequence, with the user selecting from 3 options at each stage:
- Lore Agent: Generates rich civilization narratives, cultural values, and material palettes from your creative brief (powered by Gemini Flash)
- Structure Agent: Translates selected lore into L-System fractal rules to create architectural geometries, rendered as SVG
- Visual Agent: Renders final concept art in multiple styles using Gemini Flash-Image generation
- Frontend: Next.js 16, React 19, Tailwind CSS 4, Motion (Framer Motion), shadcn/ui
- Backend: Python FastAPI, Uvicorn
- AI: Google Gemini 2.5 Flash (text), Gemini 2.5 Flash-Image (image generation)
- Deployment: Railway (backend), Vercel (frontend)
- Node.js 18+ and npm/bun
- Python 3.10+
- A Google Gemini API key (get one at aistudio.google.com)
git clone <repo-url>
cd archetype# Install dependencies
npm install
# or
bun install
# Start the development server
npm run dev
# or
bun devThe frontend runs on http://localhost:3000.
cd backend
# Create a virtual environment
python3 -m venv venv
source venv/bin/activate # macOS/Linux
# venv\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
# Create .env file with your API key
echo "GOOGLE_API_KEY=your_api_key_here" > .env
# Start the backend server
uvicorn main:app --reload --port 8000The backend runs on http://localhost:8000.
| Variable | Location | Description |
|---|---|---|
GOOGLE_API_KEY |
backend/.env |
Your Google Gemini API key |
NEXT_PUBLIC_API_URL |
Frontend .env.local (optional) |
Backend URL, defaults to http://localhost:8000 |
- 3 options at each stage: the user curates the direction at every step
- Human-in-the-loop design: AI proposes, you decide
- L-System architecture: procedurally generated fractal structures based on lore
- AI image generation: concept art rendered in multiple styles
- AI image editing: draw annotations on generated art and request targeted edits
- Random brief generator: AI-powered creative brief inspiration
- Advanced controls: geometric density, color temperature, symmetry, detail complexity, era, mood, and material palette
archetype/
├── app/ # Next.js app directory
│ ├── page.tsx # Home page: creative brief input
│ ├── pipeline/ # Pipeline page: agent stages
│ └── layout.tsx # Root layout
├── backend/
│ ├── main.py # FastAPI server & endpoints
│ ├── agents/
│ │ ├── lore_agent.py # Lore generation agent
│ │ ├── structure_agent.py # L-System structure agent
│ │ └── visual_agent.py # Concept art generation agent
│ ├── requirements.txt # Python dependencies
│ └── Dockerfile # Docker config for Railway deployment
├── components/ # Reusable UI components (shadcn/ui)
├── assets/ # Pipeline diagrams and sample outputs
└── public/ # Static assets
The backend includes a Dockerfile for Railway deployment:
cd backend
# Railway will auto-detect the Dockerfile
# Set GOOGLE_API_KEY in Railway environment variables# Set NEXT_PUBLIC_API_URL to your Railway backend URL
# Deploy via Vercel CLI or GitHub integration| Method | Endpoint | Description |
|---|---|---|
POST |
/api/generate/start |
Start a new generation session |
GET |
/api/generate/{session_id}/status |
Poll session status and options |
POST |
/api/generate/{session_id}/select |
Select an option at current stage |
POST |
/api/generate/{session_id}/retry |
Retry after an error |
POST |
/api/generate/random-brief |
Generate a random creative brief |
POST |
/api/generate/edit-image |
Edit generated concept art |
GET |
/api/health |
Health check |


