Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

🚀 Anti-Gravity — AI-First Monorepo Template

The L10 Professional Standard for building AI-powered web applications with multi-agent orchestration and human-in-the-loop workflows.

License Next.js PocketBase Turborepo


🎯 What is Anti-Gravity?

Anti-Gravity is a production-ready monorepo template designed for developers building AI-first applications — apps where AI isn't just a feature, it's the core architecture.

If you're building:

  • 🤖 Multi-agent AI systems (orchestrators, analyzers, generators)
  • 👤 Human-in-the-loop workflows (approval queues, confidence-based routing)
  • ⚡ Streaming AI interfaces (real-time responses, progressive UI)
  • 🔄 Stateful AI pipelines (session tracking, agent handoffs)

...this template gives you a battle-tested foundation instead of starting from scratch.


✨ Key Features

🧠 Multi-Agent Orchestration

  • Agent type system with Zod schemas for type-safe communication
  • Confidence-based routing (auto-approve, use Pro model, or pause for human)
  • PocketBase hooks for server-side agent lifecycle management

👤 Human-in-the-Loop (HITL)

  • Built-in approval_queue collection in PocketBase
  • Agents pause automatically when confidence drops below threshold
  • Human feedback captured and fed back into the pipeline

🎨 GenUI Design System

  • Vapor State — Streaming/loading with shimmer, blur, reduced opacity
  • Solid State — Final data snaps into place with micro-animations
  • Design tokens for consistent styling across all components

🏗️ Monorepo Architecture

  • 6 shared packages (tokens, ui, api, hooks, utils, types)
  • Turborepo for incremental builds and caching
  • Clear separation: UI is visual-only, logic lives in packages

📥 Prototype Ingestion

  • Drop legacy code in prototype_dump/
  • AI-guided migration to the monorepo structure
  • Automated token extraction and component refactoring

🛠️ Tech Stack

Layer Technology
Monorepo Turborepo
Frontend Next.js 16 (App Router, Server Actions)
Backend PocketBase v0.34.2 (JSVM hooks)
AI Google Gemini (streaming)
Styling Tailwind v4 with shared design tokens
Validation Zod (runtime + compile-time)

📦 Quick Start

# 1. Create from template
gh repo create my-ai-app --template dimasyankauskas/gravity_project_template

# 2. Install dependencies
pnpm install

# 3. Start development
pnpm dev

🗄️ PocketBase First Run

PocketBase is the backend brain. Start it locally before running the web app:

# Option A: Docker (recommended)
docker run -p 8090:8090 -v $(pwd)/pocketbase/pb_data:/pb_data ghcr.io/pocketbase/pocketbase:0.34.2

# Option B: Direct binary (if Docker unavailable)
# Download from https://pocketbase.io/docs/ → run ./pocketbase serve

First-time setup:

  1. Open http://localhost:8090/_/ (Admin UI)
  2. Create an admin account
  3. Import schema: Settings → Import Collections → paste contents of pocketbase/pb_schema.json

📂 Project Structure

├── apps/
│   └── web/                     # Next.js 16 application
│   └── mobile/                  # [Future] Expo / React Native
├── packages/
│   ├── tokens/                  # 🎨 Design tokens (colors, spacing)
│   ├── ui/                      # 🎨 Shared components + Tailwind
│   ├── api/                     # 🧠 AI logic + routing
│   ├── hooks/                   # 🎣 React hooks
│   ├── utils/                   # 🛠️ Pure utilities
│   └── types/                   # 💎 Zod schemas
├── pocketbase/
│   ├── pb_hooks/                # Agent orchestration hooks
│   └── pb_schema.json           # Collections (users, projects, ai_sessions, approval_queue, design_critiques)
├── architecture/                # Design docs & ADRs
├── prototype_dump/              # Legacy code migration
└── .agent/workflows/            # AI agent workflow triggers

🤖 AI Agent Integration

This template is AI-agent ready. Whether you use Cursor, Windsurf, or any LLM-powered IDE, the agent can execute structured workflows.

📋 Workflow Quick Reference

Command Purpose
/design-verify Build Flight Deck, verify design tokens and components
/sync-routine Quick manifest update after small changes
/sync-sentinel Deep scan for major milestones
/blueprint Convert request to implementation plan
/refactoraistudio Analyze AI Studio prototype for migration

Agent Activation Examples

1️⃣ Prototype Ingestion (porting legacy code):

Drop your code into prototype_dump/, then:
> "Agent, execute Phase 1 of INGESTION_GUIDE.md. Generate packages/ui first."

2️⃣ Design Verification (visual QA):

> "Agent, initialize Design Verification" (or /design-verify)
Then visit: http://localhost:3000/design-system

3️⃣ Sync Sentinel (documentation sync):

> "Run Sync Sentinel"
The agent scans diffs, updates MANIFEST.md, logs architectural changes.

Key Files for Agents

File Purpose
.cursorrules Behavior rules and constraints
llms.txt Context map with directory shortcuts
AGENTS.md Protocols (Sync Sentinel, Ingestion)
MANIFEST.md Live project status
.agent/workflows/ Workflow definitions

🛡️ The 3 Laws of L10

1. The Logic Divorce:

  • ❌ Illegal: useEffect(() => fetch('/api')) inside a UI component
  • ✅ Legal: const { data } = useTripData() (imported from @repo/hooks)

2. GenUI Mandate:

  • All AI components must handle Vapor State (Streaming/Low Confidence) and Solid State (Final/High Confidence)
  • See AGENTS.md for visual specs

3. Schema First:

  • Never "guess" a database field. If it's not in packages/types, it doesn't exist
  • Update the Zod schema first, then implement

🎯 Who Is This For?

You should use this if... This might not be for you if...
Building AI-native apps Just adding ChatGPT to an existing app
Need multi-agent orchestration Single-agent chatbot
Want human approval workflows Fully autonomous AI
Prefer monorepo architecture Single-package projects
Use PocketBase Already committed to Supabase/Firebase

🛠️ Development Commands

Command Action
pnpm dev Starts Web (3000) and all packages
pnpm build Builds all apps and packages
pnpm lint Runs ESLint across the monorepo
pnpm typecheck TypeScript validation

📚 Documentation

Document Purpose
AGENTS.md Agent protocols and quality gates
MANIFEST.md Current project status & roadmap
SYSTEM_DESIGN.md Architecture diagrams
INGESTION_GUIDE.md Prototype migration steps
DESIGN_VERIFICATION.md Design system QA process
COMPONENTS.md GenUI design system specs

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Run /sync-routine before committing
  4. Submit a pull request

📄 License

Apache 2.0 — Use freely, patent protection included.


Created by Dimas Yankauskas

If this template saves you time, consider giving it a ⭐ on GitHub!

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages