Skip to content

Mhd-tz/archetype

Repository files navigation

Archetype: AI-Powered Concept World Builder

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.

Pipeline Overview

The system uses three agents in sequence, with the user selecting from 3 options at each stage:

  1. Lore Agent: Generates rich civilization narratives, cultural values, and material palettes from your creative brief (powered by Gemini Flash)
  2. Structure Agent: Translates selected lore into L-System fractal rules to create architectural geometries, rendered as SVG
  3. Visual Agent: Renders final concept art in multiple styles using Gemini Flash-Image generation

Structure Agent: L-System Pipeline

L-System Pipeline

Visual Agent: Image Generation Pipeline

Visual Pipeline

Sample Output

Sample Output

Tech Stack

  • 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)

Setup Instructions

Prerequisites

  • Node.js 18+ and npm/bun
  • Python 3.10+
  • A Google Gemini API key (get one at aistudio.google.com)

1. Clone the Repository

git clone <repo-url>
cd archetype

2. Frontend Setup

# Install dependencies
npm install
# or
bun install

# Start the development server
npm run dev
# or
bun dev

The frontend runs on http://localhost:3000.

3. Backend Setup

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 8000

The backend runs on http://localhost:8000.

4. Environment Variables

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

Features

  • 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

Project Structure

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

Deployment

Backend (Railway)

The backend includes a Dockerfile for Railway deployment:

cd backend
# Railway will auto-detect the Dockerfile
# Set GOOGLE_API_KEY in Railway environment variables

Frontend (Vercel)

# Set NEXT_PUBLIC_API_URL to your Railway backend URL
# Deploy via Vercel CLI or GitHub integration

API Endpoints

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

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors