β‘ Zyra Framework
Unified Fullstack Web Framework Unifying Native Go Performance & React/TypeScript DX
π Table of Contents
- Overview & PRD
- System Architecture & Data Flow
- Core Features
- Framework Comparison
- Quick Start
- Go Action RPC Bridge
- Database Integrations
- Starter Templates
- Middleware & Security Hardening
- Single-Binary Production Deployment
- CLI Commands Reference
- Documentation & GitHub Pages
1. Overview & PRD
Zyra is a next-generation fullstack web framework engineered to bridge Go 1.22+ backend execution with React 18 & TypeScript client DX into a unified, single-binary application.
Instead of writing separate Go API controllers, managing OpenAPI specs, configuring CORS, and maintaining duplicate TypeScript interfaces, Zyra lets you write native Go functions annotated with // +zyraaction. Zyra automatically parses the Go AST and generates type-safe TypeScript client bindings.
PRD β Project Requirements Document & System Flow
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
1. Overview : Unified Go + React runtime with zero API boilerplate.
2. Architecture : Bun-powered SSR worker pool + Go net/http high-speed engine.
3. RPC Bridge : AST Go functions scanned -> type-safe TS client generated.
4. Deployment : Single compiled binary with embedded static & SSR assets.
2. System Architecture & Data Flow
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ZYRA UNIFIED ENGINE β
β β
β Browser Request βββββββββββββββββββββββββββββββββ β
β ββββββββββββββββΊ β Go HTTP Server β β
β β - net/http High-Speed Routerβ β
β SSR HTML Output β - Security Headers & CSRF β β
β ββββββββββββββββ β - In-Memory SSR Page Cache β β
β βββββββββββββββββ¬ββββββββββββββββ β
β β β
β Fast JSON IPC β Bun SSR Worker Thread Pool β
β ββββββββββββββββββββΌβββββββββββββββββββββββββ β
β βΌ βΌ β
β βββββββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββ β
β β Bun Worker Subprocess β β Go Action AST Generator β β
β β - React renderToString() β β - Scans // +zyraaction β β
β β - Dynamic HTML Shell Inject β β - Output: .generated/ β β
β βββββββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββ β
β β
β Type-Safe RPC Call β
β ββββββββββββββββββββΊ Go Backend Logic ββββΊ Database (Postgres / MySQL / SQLite / β
β (actions/*.go) MongoDB / Firebase / Supabase) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
3. Core Features
- β‘ Go Action RPC Bridge β Annotate Go functions with
// +zyraaction for instant, type-safe TypeScript client RPC calls.
- π Sub-Millisecond SSR Engine β Bun worker thread pool handles React
renderToString via JSON IPC.
- πΎ In-Memory Page Cache β Configurable SSR page cache skips worker rendering for static/cached routes.
- π‘οΈ Bank-Grade Security Hardening β Pre-configured security headers (
X-Frame-Options, X-Content-Type-Options, Referrer-Policy) & token bucket IP rate limiting.
- π¨ Tailwind CSS v4 Integration β Zero-config styling compiler with instant hot stylesheet reloads.
- π 6 Production Starter Templates β Interactive Demo, SaaS Admin Dashboard, SaaS Landing Page, E-Commerce Storefront, AI Chat Copilot, and Blank Minimal.
- ποΈ 6 Database Integrations β PostgreSQL, MySQL, SQLite, MongoDB, Firebase/Firestore, and Supabase.
- π¦ Single-Binary Deployment β Packaged into one standalone executable via
//go:embed. Zero Node.js runtime required in production.
4. Framework Comparison
| Feature |
Zyra |
Next.js |
Wails |
Templ + HTMX |
| Backend Runtime |
Go 1.22+ |
Node.js / Vercel |
Go 1.22+ |
Go 1.22+ |
| Frontend UI |
React 18 / TSX |
React 18 / TSX |
React / Svelte / Vue |
Server HTML (HTMX) |
| RPC Bridge |
Auto AST Generated |
Server Actions (JS) |
Auto Generated |
N/A |
| Production Binary |
Single Executable |
Node Server / Edge |
Desktop App (.exe/.dmg) |
Single Executable |
| RAM Footprint |
~15 MB |
~150 MB+ |
~80 MB |
~10 MB |
5. Quick Start
Installation
# Linux & macOS
curl -fsSL https://raw.githubusercontent.com/LythianOlyx/Zyra/main/install.sh | bash
# Windows (PowerShell)
irm https://raw.githubusercontent.com/LythianOlyx/Zyra/main/install.ps1 | iex
Create Project
zyra create my-app
Start Dev Server
cd my-app
zyra dev
Your app will be live at http://localhost:3000 with hot reload enabled.
6. Go Action RPC Bridge
Go Server Action (actions/user.go)
package actions
import "context"
type UserProfile struct {
ID string `json:"id"`
Username string `json:"username"`
IsAdmin bool `json:"isAdmin"`
}
// +zyraaction
func GetUserProfile(ctx context.Context, userID string) (*UserProfile, error) {
return &UserProfile{
ID: userID,
Username: "alex_dev",
IsAdmin: true,
}, nil
}
React Client Component (pages/profile.tsx)
import React, { useState, useEffect } from "react";
import { hydrate } from "../runtime/client";
import { GetUserProfile } from "../.generated/actions/actions";
export default function ProfilePage() {
const [user, setUser] = useState(null);
useEffect(() => {
GetUserProfile("usr_100").then(setUser);
}, []);
return (
<main className="min-h-screen bg-slate-950 text-white p-8">
<h1 className="text-2xl font-bold">Welcome, {user?.username}</h1>
</main>
);
}
if (typeof window !== "undefined") {
hydrate(ProfilePage);
}
7. Database Integrations
Zyra provides instant database configurations during zyra create:
- PostgreSQL β GORM / sqlx / lib/pq
- MySQL / MariaDB β GORM / sqlx / go-sql-driver
- SQLite β GORM / sqlx / go-sqlite3
- π MongoDB β
go.mongodb.org/mongo-driver
- π₯ Firebase / Cloud Firestore β
firebase.google.com/go/v4
- β‘ Supabase β PostgreSQL Cloud
8. Starter Templates
When running zyra create, select from 6 starter templates:
- β‘ Interactive Go RPC Playground β Latency monitor & RPC action tester
- π SaaS Admin Dashboard β Stats grid, sidebar, chart & action tester
- π SaaS Landing Page β Hero section, feature grid & waitlist form
- π E-Commerce Storefront β Product grid, filter pills & RPC checkout cart
- π€ AI Chat Copilot β ChatGPT-style interface with real-time stream simulation
- π Blank Minimal Project β Clean canvas for custom applications
9. Middleware & Security Hardening
Zyra includes built-in Go middleware for production security:
server.Use(server.SecurityHeadersMiddleware())
server.Use(server.RateLimitMiddleware(30, 100)) // 30 req/s, 100 burst
10. Single-Binary Production Deployment
Compile frontend assets, SSR bundles, and Go server into one binary:
zyra build
The output standalone binary is created at dist/zyra-server. Run it directly without Node.js:
PORT=8080 ./dist/zyra-server
11. CLI Commands Reference
| Command |
Description |
zyra create [name] |
Launches interactive prompt to scaffold a new Zyra project |
zyra dev |
Starts development server with watcher and WebSocket HMR |
zyra build |
Bundles static assets and compiles single production binary |
zyra generate |
Scans actions and pages to regenerate TypeScript definitions |
zyra upgrade |
Upgrades Zyra CLI binary and active project runtime |
12. Documentation & GitHub Pages
Visit the official interactive documentation site:
π https://lythianolyx.github.io/Zyra
Built with β‘ by LythianOlyx & Zyra Contributors