AI-First Backend Language
Built for LLM Code Generation

Minimal ceremony. Just routes and types. 23% fewer tokens than Python's FastAPI, 57% fewer than Java.

One .glyph file holds the routes, types, validation, and auth. A single static binary runs it.

23% fewer tokens than FastAPI
867 nanoseconds to parse a route
@ GET /api/users/:id -> User | Error {
  + auth(jwt)
  + ratelimit(100/min)
  % db: Database
  $ user = db.users.get(id)
  > user
}

What is GlyphLang?

GlyphLang™ is an AI-first backend programming language designed specifically for LLM code generation. Written in pure Go and compiled to a single binary, it bridges the gap between AI prompts and production-ready code. Write once in .glyph and generate server scaffolds in Python/FastAPI or TypeScript/Express (experimental).

Minimal Ceremony

No import flask. No app = Flask(__name__). No decorators, no wrappers, no ceremony. Routes are the entire program. This is where the token savings come from.

Clean, Consistent Syntax

Compact symbols (@ $ % > +) provide a consistent, predictable structure. Every route looks the same. Every type definition follows the same pattern. Less variation means fewer mistakes.

Production-Ready Features

Built-in HTTP routing, WebSocket support, database integration, JWT authentication, rate limiting, and SQL injection prevention. Everything you need, nothing you don't.

AI-Optimized Performance

Minimal syntax means faster compilation and lower token costs

23%
Fewer Tokens vs FastAPI
Measured with tiktoken
867ns
Compilation Time
Lex+parse of a single route definition
3.9μs
HTTP Handler Latency
Full request/response cycle
57%
Fewer Tokens vs Java
Measured with tiktoken
2.93ns
Per Op VM Execution
Zero-allocation hot path
3.1μs
Route Matching
100 routes, worst case
Built-in
Security Features
SQL injection, XSS, CORS
81%
Test Coverage
Comprehensive tests across 45 packages
100%
First-Try Validity from the Spec Alone
GlyphLang has no presence in LLM training data, and it doesn't need one: given only the ~350-line notation spec as context, claude-opus-5 generated valid GlyphLang on 15 of 15 eval tasks — parity with FastAPI on the same tasks. Reproduce it with benchmarks/bench_generation_accuracy.py in the repo, and give your own agent the spec via llms.txt.

Symbol Reference

A small set of symbols keeps the syntax consistent and scannable

@ Route HTTP endpoints
! Command CLI commands
* Cron Scheduled tasks
~ Event Event handlers
& Queue Background jobs
$ Variable Declare variables
% Inject Dependencies
> Return Return values
+ Middleware Add middleware
? Validate Input validation
: Type Type definitions

Scannable at a Glance

Each construct starts with a distinct symbol. Spot routes (@), types (:), and variables ($) instantly without reading the whole line.

Consistent Patterns

Every route follows the same structure. Every type definition looks identical. Consistency makes code easier to read, write, and review.

Quick to Type

Single-character prefixes mean less typing. No need to remember if it's "func", "function", "def", or "fn" - it's always the same symbol.

Human-Readable Mode

Prefer keywords? Convert between symbols and human-readable syntax instantly

Compact (.glyph) Default syntax
# Hello endpoint
@ GET /hello/:name {
  $ greeting = "Hello, " + name + "!"
  > {message: greeting}
}
Expanded (.glyphx) Human-readable
# Hello endpoint
route GET /hello/:name {
  let greeting = "Hello, " + name + "!"
  return {message: greeting}
}

Convert with a Single Command

# Symbols to keywords glyph expand main.glyph
# Keywords to symbols glyph compact main.glyphx
@ route
: type
$ let
? validate
% use
> return
+ middleware
~ handle
* cron
! command
& queue

Comments and formatting are preserved during conversion. The .glyph format remains canonical for AI and compilation.

Built for AI Code Generation

Every feature designed to maximize AI/LLM code generation success

AI-First Design

Skip the boilerplate. Routes and types are the program. The whole language fits in a ~350-line spec that travels in context, so LLMs generate valid GlyphLang on the first try.

Consistent Structure

Every route follows the same pattern. Every type definition looks the same. Consistency makes code easier to read, write, and generate.

867ns Compilation

Minimal syntax and a focused feature set enable sub-microsecond lexing and parsing, measured on a single route definition.

Built-in Security

SQL injection prevention, XSS detection, and CORS handling are built into the runtime. Security features you don't have to remember to add.

2.9ns Execution

Zero-allocation VM execution in 2.93 ns/op. AI-generated code runs as fast as hand-optimized solutions.

23% Fewer Tokens

Eliminating imports and framework boilerplate cuts token count by 23% vs FastAPI, 57% vs Java. More room in context windows for actual logic.

AI Agent Tooling

Built-in glyph context and glyph validate --ai commands generate structured output optimized for AI agents to understand and work with your codebase.

Structured Validation

JSON error output with types, locations, and fix hints. Machine-readable errors make it easier for AI tools to parse and suggest fixes.

Incremental Context

Hash-based change detection with --changed flag. Only send what changed to AI agents, minimizing token usage on updates.

Polyglot Code Generation (experimental)

Write once in .glyph, generate server scaffolds in Python/FastAPI or TypeScript/Express via Semantic IR — routes, types, and validation translated; you implement the persistence layer.

Custom Providers

Define provider contracts with typed method signatures. Inject email services, payment gateways, or any external dependency with % name: Provider.

Try GlyphLang

Write and run GlyphLang code directly in your browser

Output
Click "Run Code" to see the output...

Perfect for AI-Generated Apps

From REST APIs to real-time applications—all generated by AI

@ GET /api/posts {
  % db: Database
  $ posts = db.posts.all()
  > {posts: posts}
}

@ GET /api/posts/:id {
  % db: Database
  ? validate_range(id, 1, 1000000)
  $ post = db.posts.get(id)
  > {post: post}
}

REST APIs Made Simple

Build production-ready REST APIs with built-in validation, security, and database integration.

  • Automatic request/response handling
  • Built-in validation framework
  • Type-safe database queries
  • Security scanning included
@ ws /chat {
  on connect {
    ws.send({type: "welcome"})
  }
  on message {
    ws.broadcast_to_room(input.room, {
      text: input.text,
      user: input.user,
      timestamp: now()
    })
  }
  on disconnect {
    ws.broadcast({type: "user_left"})
  }
}

@ GET /api/stats {
  > {
    connections: ws.get_connection_count(),
    rooms: ws.get_room_count(),
    uptime: ws.get_uptime()
  }
}

Real-Time WebSocket Apps

Build chat apps, live notifications, and collaborative tools with first-class WebSocket support.

  • Room-based messaging with join/leave
  • Event handlers: connect, message, disconnect
  • Stats: connection count, room count, uptime
  • Broadcast to all or specific rooms
: User {
  id: int!
  name: str!
  email: str!
  created_at: timestamp
}

@ POST /users {
  % db: Database
  ? validate_email(input.email)
  $ user = db.users.create({
    name: input.name,
    email: input.email
  })
  > {user: user}
}

Database-Driven Applications

First-class database integration with PostgreSQL, MySQL, and MongoDB support.

  • Type-safe schema definitions
  • Connection pooling
  • ORM capabilities
  • Transaction support
@ GET /health {
  > {status: "ok", uptime: uptime()}
}

@ POST /api/process {
  + auth(jwt)
  + ratelimit(100/min)
  % queue: Queue
  $ job = queue.push({
    type: "process",
    data: input
  })
  > {job_id: job.id}
}

Cloud-Native Microservices

Build scalable microservices with Docker/Kubernetes deployment configs included.

  • Health check endpoints
  • Horizontal scaling ready
  • Service mesh compatible
  • Container-optimized
# Write once in .glyph:
: Todo { id: int!, title: str!, done: bool! }

@ GET /api/todos {
  % db: Database
  $ todos = db.todos.Find()
  > todos
}

# Generate Python:
# glyph codegen app.glyph --lang python

# Generate TypeScript:
# glyph codegen app.glyph --lang typescript

Polyglot Code Generation (experimental)

One .glyph source file generates server scaffolds in multiple languages via the Semantic IR pipeline — routes, types, and validation translated; persistence is left as swap-in provider stubs.

  • Python/FastAPI with Pydantic models
  • TypeScript/Express with typed interfaces
  • Provider stubs for you to implement
  • Same logic, different runtimes

Get Started in Seconds

Download pre-built binaries or build from source

Windows
Download Installer Adds to PATH automatically Code signing pending - click "More info" then "Run anyway" if SmartScreen appears
macOS
curl -fsSL https://glyphlang.github.io/install.sh | bash
Intel & Apple Silicon
Linux
curl -fsSL https://glyphlang.github.io/install.sh | bash
.deb · .rpm also available

Or Build from Source

1

Clone & Build

git clone https://github.com/GlyphLang/GlyphLang.git
cd glyph && make build
2

Create Your First App

@ GET /hello/:name {
  $ greeting = "Hello, " + name + "!"
  > {message: greeting}
}
3

Run Your App

./glyph dev hello.glyph

# Visit http://localhost:3000/hello/world