Skip to content

sunbeamdotpt/g2v

Repository files navigation

Sunbeam Service Framework (g2v)

Crates.io JSR docs.rs License: MIT

A full-stack, ConnectRPC-based microservices framework. The name is the Sun's spectral classification (G2V — main-sequence yellow dwarf), not a backronym.

  • Server: Rust crate (sunbeam-g2v) built on connectrpc, axum, and tokio.
  • Client: TypeScript library (@sunbeam/g2v) for React 19 apps, powered by TanStack Query, legend-state, and OpenTelemetry.
graph TB
    subgraph Client
        A["React App"] --> B["@sunbeam/g2v"]
        B --> C["ConnectRPC Transport"]
    end
    subgraph Server
        C --> D["axum::serve"]
        D --> E["Middleware Stack"]
        E --> F["ServiceRouter"]
        F --> G["SunbeamService"]
        G --> H[(Postgres)]
        G --> I[NATS]
    end
Loading

Features

Feature Server Client
ConnectRPC connectrpc @connectrpc/connect-web
Middleware / Interceptors ✅ JWT, Keto, metrics, tracing ✅ auth, retry, circuit, logging
Database ✅ SQLx Postgres
Messaging ✅ NATS / JetStream
Leader Election ✅ Vault / NATS
State Management legend-state
Routing ServiceRouter @tanstack/react-router
Observability ✅ Prometheus + OTel ✅ Browser OTel SDK
Health Checks /health/live, /health/ready useHealth

Quick Start

Server (Rust)

cargo add sunbeam-g2v
use sunbeam_g2v::prelude::*;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
    let router = ServiceRouter::new();
    ServerBuilder::new()
        .with_router(router)
        .serve()
        .await
}

See server/README.md for the full server guide.

Client (TypeScript)

deno add @sunbeam/g2v
import { FrameworkProvider } from "@sunbeam/g2v/providers";
import { createTransport } from "@sunbeam/g2v/core";

const transport = createTransport({ baseUrl: "/api" });

export function App() {
  return (
    <FrameworkProvider transport={transport}>
      <YourApp />
    </FrameworkProvider>
  );
}

See client/README.md for the full client guide.

Examples

Run the full-stack Eliza demo:

# Terminal 1 — Rust server
cargo run -p sunbeam-g2v --example simple

# Terminal 2 — frontend demo
cd client/examples/simple
npm install
npm run dev
# open http://localhost:5173

Repository Layout

.
├── server/     # Rust crate — sunbeam-g2v
├── client/     # TypeScript library — @sunbeam/g2v
└── docs/       # Guides and architecture docs

Documentation

License

MIT — see LICENSE.md.

About

A ConnectRPC-based framework for Rust & TypeScript

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages