// ============================================================================ // Route Templates // ============================================================================ export const homeRouteTemplate = `import { useState, useEffect } from "react"; import { Link } from "react-router-dom"; import { Zap, Shield, Code, ArrowRight, Activity, Bot, Key } from "lucide-react"; import { VannaButton } from "../components/VannaButton"; import { VannaCard } from "../components/VannaCard"; interface HealthStatus { status: string; env: string; timestamp: string; } const features = [ { icon: Bot, title: "Built-in MCP Server", description: "AI-ready API with Model Context Protocol. Connect Claude or any MCP client instantly.", }, { icon: Key, title: "Bring Your Own Auth", description: "Plug in any auth system - JWTs, API keys, sessions. You control authentication.", }, { icon: Zap, title: "Lightning Fast", description: "Built on Bun for incredible performance and instant hot reloading.", }, { icon: Shield, title: "Type Safe", description: "Full TypeScript support with Zod schema validation.", }, { icon: Code, title: "Modern Stack", description: "React 19, React Router 7, and Tailwind CSS 4.", }, ]; export function Home() { const [health, setHealth] = useState(null); useEffect(() => { fetch("/health") .then(res => res.json()) .then(setHealth) .catch(console.error); }, []); return (
{/* Hero Section */}

Welcome to Ontology

Your full-stack Bun + React application is ready. Start building something amazing.

View Dashboard Explore API
{/* Features Grid */}
{features.map(({ icon: Icon, title, description }) => (

{title}

{description}

))}
{/* API Status */}

API Status

{health ? (
Status

{health.status}

Environment

{health.env}

Timestamp

{health.timestamp}

) : (

Loading...

)}
); } `; export const dashboardRouteTemplate = `import { useState, useEffect } from "react"; import { Activity, Users, Zap, Clock, BarChart3, Bot, Loader2 } from "lucide-react"; import { AreaChart, Area, BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, Legend } from "recharts"; import { StatsCard } from "../components/StatsCard"; import { VannaCard } from "../components/VannaCard"; import { VannaButton } from "../components/VannaButton"; interface SalesDataPoint { month: string; sales: number; orders: number; } export function Dashboard() { const [salesData, setSalesData] = useState([]); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); useEffect(() => { fetch("/api/getSalesData", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({}), }) .then((res) => res.json()) .then((data) => { setSalesData(data); setLoading(false); }) .catch((err) => { setError(err.message); setLoading(false); }); }, []); // Calculate stats from sales data const totalSales = salesData.reduce((sum, d) => sum + d.sales, 0); const totalOrders = salesData.reduce((sum, d) => sum + d.orders, 0); const avgSales = salesData.length > 0 ? Math.round(totalSales / salesData.length) : 0; return (

Dashboard

Sales data fetched from your Ontology API.

{/* Stats Grid */}
} /> } /> } /> } />
{/* Sales Trend Chart */}

Sales Trend

{loading ? (
Loading data...
) : error ? (
Error: {error}
) : ( )}
{/* Multi-Series Bar Chart */}

Sales vs Orders

{loading ? (
Loading data...
) : ( )}
{/* MCP Apps Feature Card */}

MCP Apps Visualization

The getSalesData function has ui enabled. When called via MCP, results are automatically displayed in an interactive chart.

# In ontology.config.ts:

getSalesData: {"{"}

// ... other config

ui: {"{"} type: 'chart', chartType: 'bar', xAxis: 'month' {"}"}

{"}"}

Try it in Claude Desktop or any MCP client by calling getSalesData.

{/* Button Gallery */}

Component Gallery

Button Variants

Primary Secondary Outline Ghost

Button Sizes

Small Medium Large
); } `; export const aboutRouteTemplate = `import { VannaCard } from "../components/VannaCard"; import { Bot, Key, ExternalLink } from "lucide-react"; const stack = [ { name: "Runtime", value: "Bun" }, { name: "Frontend", value: "React 19 + React Router 7" }, { name: "Styling", value: "Tailwind CSS 4" }, { name: "API", value: "Ontology (ont-run)" }, { name: "Icons", value: "Lucide React" }, { name: "Charts", value: "Recharts" }, ]; const designTokens = [ { name: "Navy", value: "#023d60", className: "bg-navy" }, { name: "Cream", value: "#e7e1cf", className: "bg-cream border border-navy/20" }, { name: "Teal", value: "#15a8a8", className: "bg-teal" }, { name: "Orange", value: "#fe5d26", className: "bg-orange" }, { name: "Magenta", value: "#bf1363", className: "bg-magenta" }, ]; export function About() { return (

About

Learn about the stack and design system powering this application.

{/* Stack */}

Tech Stack

{stack.map(({ name, value }) => (
{name} {value}
))}
{/* MCP Server */}

Built-in MCP Server

Your API is automatically exposed as a Model Context Protocol (MCP) server. Connect AI assistants like Claude Desktop directly to your API functions.

# Add to Claude Desktop config:

"my-api": {"{"}

"command": "bunx",

"args": ["ont-run", "mcp"]

{"}"}

Learn more about MCP
{/* Authentication */}

Bring Your Own Auth

Ontology doesn't impose an auth system. Customize the auth function in ontology.config.ts to integrate any authentication method.

JWTs

Verify tokens from Auth0, Clerk, etc.

API Keys

Simple key-based access control

Sessions

Cookie-based session auth

{/* Design Tokens */}

Vanna Design System

A cohesive color palette designed for clarity and visual harmony.

{designTokens.map(({ name, value, className }) => (

{name}

{value}

))}
{/* Typography */}

Typography

Serif (Headlines)

Roboto Slab - The quick brown fox

Sans (Body)

Space Grotesk - The quick brown fox

Mono (Code)

Space Mono - The quick brown fox

); } `;