Zyra

module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: MIT

README ΒΆ

Zyra Framework Logo

⚑ Zyra Framework

Unified Fullstack Web Framework Unifying Native Go Performance & React/TypeScript DX

License Go Version Latest Release Documentation


πŸ“‘ Table of Contents

  1. Overview & PRD
  2. System Architecture & Data Flow
  3. Core Features
  4. Framework Comparison
  5. Quick Start
  6. Go Action RPC Bridge
  7. Database Integrations
  8. Starter Templates
  9. Middleware & Security Hardening
  10. Single-Binary Production Deployment
  11. CLI Commands Reference
  12. 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:

  1. ⚑ Interactive Go RPC Playground β€” Latency monitor & RPC action tester
  2. πŸ“Š SaaS Admin Dashboard β€” Stats grid, sidebar, chart & action tester
  3. πŸš€ SaaS Landing Page β€” Hero section, feature grid & waitlist form
  4. πŸ›’ E-Commerce Storefront β€” Product grid, filter pills & RPC checkout cart
  5. πŸ€– AI Chat Copilot β€” ChatGPT-style interface with real-time stream simulation
  6. πŸ“„ 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

Directories ΒΆ

Path Synopsis
cmd
cli command
internal
cli
Package cli provides Zyra's colored terminal output: leveled log lines, the startup banner, timed build steps, and the route table printer used by the CLI and dev server.
Package cli provides Zyra's colored terminal output: leveled log lines, the startup banner, timed build steps, and the route table printer used by the CLI and dev server.
runtime
server command
Command zyra-server is Zyra's production server: a single, self-contained binary with the built client assets, the SSR worker bundle, and the page route manifest embedded via go:embed.
Command zyra-server is Zyra's production server: a single, self-contained binary with the built client assets, the SSR worker bundle, and the page route manifest embedded via go:embed.
runtime/server command
Command zyra-server is Zyra's production server: a single, self-contained binary with the built client assets, the SSR worker bundle, and the page route manifest embedded via go:embed.
Command zyra-server is Zyra's production server: a single, self-contained binary with the built client assets, the SSR worker bundle, and the page route manifest embedded via go:embed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL