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.

23% fewer tokens than FastAPI
867 nanoseconds to compile
@ 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 working servers in Python/FastAPI, TypeScript/Express, and more.

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
Faster than a memory access
0.8μ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
220ns
Route Matching
100 routes, worst case
Built-in
Security Features
SQL injection, XSS, CORS
78%
Test Coverage
Comprehensive tests across 24 packages

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. Less ceremony means fewer tokens and faster generation.

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 compilation. From source to running code almost instantly.

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

Write once in .glyph, generate working servers in Python/FastAPI or TypeScript/Express. Same source, multiple targets via Semantic IR.

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

One .glyph source file generates complete, working servers in multiple languages via the Semantic IR pipeline.

  • Python/FastAPI with Pydantic models
  • TypeScript/Express with typed interfaces
  • Custom provider stubs included
  • 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