AIForge
The #1 AI-native monorepo template β Next.js + Expo + FastAPI + LangGraph + Supabase with 90% code sharing
Ask AI about AIForge
Powered by Claude Β· Grounded in docs
I know everything about AIForge. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
AIForge Starter Pack
The #1 AI-native monorepo template for 2026+
Ship web, mobile, and AI products at maximum velocity with 90%+ code sharing.
Getting Started Β· AI Quick-Start Β· Why AIForge Β· Deploy Β· Contributing Β· Psypher AI
Love this project? Give it a :star: to help others discover it!
What is AIForge?
AIForge is the canonical monorepo blueprint for every AI product you build in 2026 and beyond. One pnpm dev command spins up a Next.js web app, an Expo mobile app, and a FastAPI + LangGraph backend β all sharing 90%+ of their code.
# Scaffold β Install β Run (under 2 minutes)
npx degit psypherai/AIForge my-app && cd my-app
pnpm install && cp .env.example .env
pnpm dev
Web on
localhost:3000Β· Mobile onlocalhost:8081Β· API onlocalhost:8000Β· Docs onlocalhost:8000/docs
Why AIForge?
| Feature | AIForge | create-t3-app | create-expo-app | Typical Template |
|---|---|---|---|---|
| Code Sharing | 90%+ (screens, UI, AI, types) | Web only | Mobile only | 30-50% |
| Platforms | Web + Mobile + Backend | Web | Mobile | Usually 1 |
| Styling DX | Pure Tailwind everywhere (NativeWind) | Tailwind (web only) | StyleSheet | Mixed systems |
| AI Layer | Full stack (Vercel AI SDK + LangGraph + RAG) | None | None | Basic chat only |
| Backend | FastAPI + LangGraph + pgvector in monorepo | tRPC (TS only) | None | Separate repo |
| Observability | Langfuse + LangSmith out of the box | None | None | None |
| Agent Evals | Built-in evaluation suite | None | None | None |
| MCP | Server + Client (Model Context Protocol) | None | None | None |
| Multi-Agent | 4 patterns (Supervisor, Pipeline, Parallel, Debate) | None | None | None |
| Realtime AI | Collaborative AI with live presence | None | None | None |
| PWA | Installable + offline support | Manual | N/A | None |
| Edge Functions | Supabase Edge (Deno) | None | None | None |
| Type Safety | End-to-end (Zod + OpenAPI + Pydantic) | tRPC | Partial | Partial |
Tech Stack (February 2026 β Best-of-the-Best)
| Layer | Technology | Why |
|---|---|---|
| Monorepo | Turborepo v2.8 (Rust core) | Remote cache, sub-second builds |
| Package Manager | pnpm v10 workspaces | Fast, strict, disk-efficient |
| Web | Next.js 16 + React 19.2 + Turbopack | RSC, streaming, React Compiler |
| Mobile | Expo SDK 54 + React Native + Solito | Universal navigation, OTA updates |
| Styling | NativeWind + Tailwind CSS + shadcn/ui | One styling system everywhere |
| AI (TypeScript) | Vercel AI SDK + LangGraph.js + Zod | Streaming, tools, structured outputs |
| AI (Python) | FastAPI + LangGraph + LangChain | Production agentic loops |
| Multi-Agent | Supervisor, Pipeline, Parallel, Debate | 4 orchestration patterns out of the box |
| MCP | @modelcontextprotocol/sdk | Expose app capabilities to any AI model |
| RAG | Supabase pgvector + OpenAI embeddings | Vector search in your database |
| Realtime AI | Supabase Realtime + AI streaming | Collaborative AI with live presence |
| Edge Functions | Supabase Edge (Deno) | Serverless AI at the edge |
| API Client | @hey-api/openapi-ts + TanStack Query v5 | Auto-generated, type-safe |
| Auth/DB | Supabase (auth + Postgres + realtime) | All-in-one BaaS |
| Observability | Langfuse + LangSmith | Trace every AI call, open-source |
| PWA | Service Worker + Web Manifest | Installable web app with offline support |
| CLI | create-aiforge | npx create-aiforge my-app scaffolding |
| Tooling | Biome + Vitest + Playwright | 100x faster linting, full testing |
Architecture
.
βββ apps/
β βββ web/ # Next.js 16 + Turbopack + shadcn/ui + PWA
β βββ mobile/ # Expo SDK 54 + Solito + NativeWind
β βββ backend/ # Python FastAPI + LangGraph + uv
β
βββ packages/
β βββ ui/ # Shared UI (shadcn + Tailwind RN primitives)
β βββ core/ # Types, Zod schemas, utils, constants
β βββ ai/ # Prompt factory, tools, RAG, multi-agent, realtime
β βββ mcp/ # MCP server + client (Model Context Protocol)
β βββ api-client/ # Generated OpenAPI client + React Query hooks
β βββ config/ # Shared Tailwind, TypeScript configs
β βββ observability/ # Langfuse + LangSmith wrappers
β βββ db/ # Supabase types + pgvector helpers
β βββ evals/ # Agent evaluation suite
β βββ create-aiforge/ # CLI scaffolding tool (npx create-aiforge)
β βββ eslint-config/ # ESLint flat config (fallback)
β
βββ supabase/
β βββ functions/ # Edge Functions (ai-chat, embed, webhook)
β
βββ docs/ # Upgrade guides and documentation
βββ turbo.json # Turborepo config (incl. Python tasks)
βββ docker-compose.yml # Local Supabase + Langfuse + Backend
βββ .github/workflows/ # CI: TS + Python + E2E + Docker
Getting Started
Prerequisites
| Tool | Version | Install |
|---|---|---|
| Node.js | >= 22 | nodejs.org |
| pnpm | >= 10 | npm install -g pnpm |
| Python | >= 3.12 | python.org |
| uv | Latest | curl -LsSf https://astral.sh/uv/install.sh | sh |
| Docker | Latest | docker.com |
Quick Start
# 1. Scaffold and install
npx degit psypherai/AIForge my-app
cd my-app
pnpm install
# 2. Set up Python backend
cd apps/backend && uv sync && cd ../..
# 3. Configure environment
cp .env.example .env
# Edit .env with your API keys (OPENAI_API_KEY, SUPABASE_URL, etc.)
# 4. Start local services (optional β for Supabase + Langfuse)
docker compose up -d
# 5. Run everything concurrently
pnpm dev
That's it. Three apps running simultaneously:
| Service | URL | Stack |
|---|---|---|
| Web | localhost:3000 | Next.js + Turbopack |
| Mobile Web | localhost:8081 | Expo + NativeWind |
| Backend API | localhost:8000 | FastAPI + Uvicorn |
| API Docs | localhost:8000/docs | Scalar API Reference |
| Supabase Studio | localhost:54323 | Postgres + pgvector |
| Langfuse | localhost:3100 | AI Observability |
Commands
pnpm dev # Start all (web + mobile + backend)
pnpm dev:web # Next.js only
pnpm dev:mobile # Expo only
pnpm dev:backend # FastAPI only
pnpm build # Build all packages
pnpm test # Run all tests (Vitest)
pnpm typecheck # TypeScript check
pnpm check # Biome lint + format
pnpm api:generate # Regenerate API client from OpenAPI spec
AI Quick-Start Guide
1. Streaming Chat (Web)
The /chat page is pre-built with Vercel AI SDK:
// apps/web/app/api/chat/route.ts β already set up!
import { openai } from '@ai-sdk/openai';
import { streamText } from 'ai';
import { SYSTEM_PROMPTS } from '@aiforge/ai/prompts';
export async function POST(req: Request) {
const { messages } = await req.json();
const result = streamText({
model: openai('gpt-4o'),
system: SYSTEM_PROMPTS.assistant,
messages,
});
return result.toDataStreamResponse();
}
2. Universal AI Hook (Web + Mobile)
import { useAI } from '@aiforge/ai/use-ai';
function ChatScreen() {
const { messages, send, isLoading } = useAI({
model: 'gpt-4o',
systemPrompt: 'You are a helpful assistant.',
});
return (
<View className="flex-1 p-4">
{messages.map(m => <Text key={m.id}>{m.content}</Text>)}
<Button onPress={() => send('Hello!')} disabled={isLoading}>Send</Button>
</View>
);
}
3. Structured Outputs
import { openai } from '@ai-sdk/openai';
import { generateObject } from 'ai';
import { extractionSchema } from '@aiforge/ai/schemas';
const { object } = await generateObject({
model: openai('gpt-4o'),
schema: extractionSchema,
prompt: 'Extract entities: "Tim Cook announced iPhone 17 in Cupertino"',
});
// object.entities β [{ text: 'Tim Cook', type: 'person' }, ...]
4. Tool Calling
import { createToolSet } from '@aiforge/ai/tools';
import { generateText } from 'ai';
const { text } = await generateText({
model: openai('gpt-4o'),
tools: createToolSet(['search', 'calculator', 'datetime']),
prompt: 'What time is it in Tokyo?',
maxSteps: 5,
});
5. RAG with pgvector
import { searchSimilar, upsertDocuments } from '@aiforge/ai/rag-helpers';
// Index documents
await upsertDocuments(supabase, [
{ content: 'AIForge is the best monorepo.', metadata: { source: 'docs' } },
]);
// Semantic search
const results = await searchSimilar(supabase, 'best monorepo', { topK: 5 });
6. LangGraph Agent (Python)
curl -X POST http://localhost:8000/api/v1/chat \
-H "Content-Type: application/json" \
-d '{"messages": [{"role": "user", "content": "Hello!"}]}'
7. Agent Evaluations
import { runEval, scorers, EXAMPLE_DATASET } from '@aiforge/evals';
const results = await runEval({
dataset: EXAMPLE_DATASET,
agent: myAgent,
scorers: [scorers.relevance, scorers.coherence, scorers.safety],
});
console.log(`Average score: ${results.summary.averageScore}`);
Deployment
Web (Vercel)
vercel --cwd apps/web
Mobile (Expo EAS)
cd apps/mobile && eas build --platform all && eas submit --platform all
Backend (Fly.io / Render / Railway)
cd apps/backend && fly launch && fly deploy
Full Stack (Docker Compose)
docker compose up -d
Roadmap
- Monorepo with Turborepo + pnpm
- Next.js 16 web app with shadcn/ui
- Expo mobile app with NativeWind
- FastAPI + LangGraph backend
- Supabase pgvector RAG
- Langfuse observability
- Agent evaluation suite
- Docker Compose for local dev
- GitHub Actions CI
- MCP (Model Context Protocol) server + client
- Multi-agent orchestration (Supervisor, Pipeline, Parallel, Debate)
- Supabase Edge Functions (ai-chat, embed, webhook)
- Real-time collaborative AI (Supabase Realtime)
- PWA support (installable web app + offline)
- Quick scaffold via
npx degit psypherai/AIForge - Expo SDK 55 + NativeWind v5 upgrade guide
- Scalar API Reference (replaced Swagger UI)
Coming Next
High Priority β Differentiators
- A2A Protocol (Google Agent-to-Agent) β agent-to-agent communication alongside MCP
- Voice AI β
useVoiceChathook with OpenAI Realtime API / Deepgram STT+TTS - AI Guardrails β content filtering, PII detection, prompt injection protection
- Human-in-the-Loop β AI actions requiring user approval before execution
- AI Payments (x402) β agents that can pay for tools and services
Medium Priority β Production Essentials
- AI Background Agents β long-running async tasks with notifications
- CLI scaffolding tool (
npx create-aiforge) β interactive project setup - Multi-provider LLM Router β auto-route between OpenAI / Anthropic / Gemini / local models
- Fine-tuning Pipeline β scripts to fine-tune on your app's data
- Prompt Playground β built-in UI to test and iterate prompts
- E2E AI Testing β automated LLM output validation beyond unit tests
Ecosystem Integrations
- Cloudflare Workers AI β alternative edge deployment
- Expo Push Notifications + AI β push triggered by AI agents
- Stripe Integration β SaaS billing with AI usage metering
- Admin Dashboard β analytics for AI usage, costs, latency
Contributing
We love contributions! Check out our Contributing Guide for details on how to get started.
Whether it's a bug fix, new feature, documentation improvement, or even a typo fix β every contribution is valued.
Community
- GitHub Discussions β Ask questions, share ideas
- GitHub Issues β Report bugs, request features
- Star the repo to stay updated with releases
Star History
License
MIT β Psypher AI 2026
Built with purpose by Psypher AI
If AIForge helped you ship faster, consider giving it a :star:
