nexus

module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: Apache-2.0

README ΒΆ

⚑ NEXUS CLI

A powerful, professional-grade, dynamic CLI devtool for scaffolding, managing, and stress testing Go backend systems.

Go Report Card

Nexus CLI transforms the way you build Go backends. Instead of starting from scratch or fighting rigid boilerplates, Nexus provides an interactive TUI to scaffold a production-grade "Protocol Mesh" architecture tailored exactly to your needs. It supports REST, gRPC, GraphQL, WebSocket, and SSEβ€”all routed through a unified middleware pipeline and served from a single handler function.


πŸš€ Installation

If you have Go installed, you can easily install the latest stable version of the CLI directly. The version and build information will be embedded automatically:

go install github.com/Gamingstein/nexus/cmd/nexus@latest

Ensure that your $(go env GOPATH)/bin directory is in your system's $PATH.

Option 2: Pre-built Binaries

You can download the pre-compiled executable for macOS, Linux, or Windows directly from the GitHub Releases page. Simply download the executable for your platform, make it executable (chmod +x), and move it anywhere in your $PATH.


⏱️ Quick Start

Get a fully functioning, multi-protocol backend up and running in under a minute:

# 1. Initialize a new project using the interactive TUI
nexus init my-backend
cd my-backend

# 2. Add a new domain entity across all layers and protocols
nexus add entity User

# 3. Serve the generated project in development mode
nexus serve

πŸŽ₯ Demo

asciicast

(Replace YOUR_ASCIINEMA_ID with a real recording of the TUI in action)


πŸ› οΈ Command Reference

Nexus provides a comprehensive suite of commands to manage the entire lifecycle of your backend.

Command Description
nexus init [name] Interactively scaffold a new Nexus backend project.
nexus add entity [name] Generate a full domain entity (structs, repo, service, handlers, proto).
nexus add protocol Add a new protocol adapter (e.g., gRPC, GraphQL) to an existing project.
nexus add middleware Scaffold a new mesh middleware component.
nexus add k8s Generate Kubernetes deployment manifests (Deployment, Service, etc.).
nexus add transport [name] Add an async message queue connector (e.g., kafka, rabbitmq).
nexus add auth [provider] Add an out-of-the-box auth template (e.g., oidc, oauth2).
nexus db generate-migration Generate a new pair of UP/DOWN SQL migration files.
nexus db migrate Run pending database migrations.
nexus serve Run the generated project with live-reload (dev mode).
nexus build Create an optimized production build of the backend.
nexus stress [scenario.yml] Run the built-in multi-protocol load testing engine.
nexus doctor Run project health analysis and diagnostics.

Run nexus help [command] for detailed usage instructions.


πŸ—οΈ Architecture Overview

Projects generated by Nexus CLI utilize a Protocol Mesh architecture. This design cleanly separates the transport layer (REST, gRPC, etc.) from the business logic, routing everything through a centralized, protocol-agnostic dispatcher.

graph TD
    subgraph "Protocol Adapters (Thin Translation Layer)"
        REST["REST (Fiber v3)"]
        GRPC["gRPC (HTTP/2)"]
        GQL["GraphQL"]
        WS["WebSocket"]
        SSE["SSE"]
    end

    subgraph "Mesh Engine (Protocol-Agnostic Core)"
        MW["Middleware Pipeline<br/>RequestID β†’ Logger β†’ Recover<br/>β†’ RateLimit β†’ CORS β†’ Cache β†’ Timeout"]
        REG["Operation Registry"]
        DISP["Dispatcher"]
        EB["EventBus (Pub/Sub)"]
    end

    subgraph "Domain Layer (Clean Architecture)"
        SVC["Service Layer<br/>(Business Logic + DTOs)"]
        REPO_IF["Repository Interface"]
        ENT["Entity Layer<br/>(Structs + Validation)"]
    end

    subgraph "Infrastructure"
        MEM["InMemory Repo"]
        SQL["SQLite Repo"]
        LRU["LRU Cache"]
    end

    REST -->|"HTTP β†’ MeshRequest"| DISP
    GRPC -->|"Protobuf β†’ MeshRequest"| DISP
    GQL -->|"Query β†’ MeshRequest"| DISP
    WS -->|"JSON msg β†’ MeshRequest"| DISP
    SSE -->|"Subscribe"| EB

    DISP --> MW
    MW --> REG
    REG -->|"route to handler"| SVC
    SVC --> REPO_IF
    SVC -->|"domain events"| EB
    REPO_IF --> MEM
    REPO_IF --> SQL
    MW -.->|"cache reads"| LRU

    EB -->|"fan-out"| WS
    EB -->|"fan-out"| SSE
Key Concepts:
  1. Protocol Adapters: Translate inbound requests (HTTP, Protobuf, JSON) into a unified MeshRequest.
  2. Mesh Engine: Handles unified middleware (auth, logging, rate limiting) and dispatches requests based on an Operation Registry.
  3. Domain & Infrastructure: Clean architecture with strict dependency inversion. Repositories are interfaces, implementations live in infrastructure.

πŸ“š Documentation

For deep dives into the generated architecture, custom template authoring, and stress testing, check out the documentation:


πŸ“œ License

Licensed under the Apache-2.0 License. See the LICENSE file for details.

Directories ΒΆ

Path Synopsis
cmd
nexus command
Package main is the entry point for the Nexus CLI devtool.
Package main is the entry point for the Nexus CLI devtool.
internal
cli
Package cli implements the Nexus CLI command tree.
Package cli implements the Nexus CLI command tree.
generator
Package generator provides the code generation engine for the Nexus CLI.
Package generator provides the code generation engine for the Nexus CLI.
manifest
Package manifest handles the nexus.yml project manifest β€” the persistent record of a Nexus project's configuration and entities.
Package manifest handles the nexus.yml project manifest β€” the persistent record of a Nexus project's configuration and entities.
scaffold
Package scaffold implements entity scaffolding for the `nexus add entity` command.
Package scaffold implements entity scaffolding for the `nexus add entity` command.
stress
Package stress provides a multi-protocol load testing engine for the Nexus CLI.
Package stress provides a multi-protocol load testing engine for the Nexus CLI.
tui
Package tui provides the visual foundation for the Nexus CLI's interactive terminal user interface.
Package tui provides the visual foundation for the Nexus CLI's interactive terminal user interface.
tui/components
Package components provides reusable bubbletea TUI components for the Nexus CLI's interactive wizards.
Package components provides reusable bubbletea TUI components for the Nexus CLI's interactive wizards.
tui/screens
Package screens provides the individual TUI screens used in the Nexus CLI's interactive wizards.
Package screens provides the individual TUI screens used in the Nexus CLI's interactive wizards.
tui/theme
Package theme provides the centralized color palette, reusable lipgloss styles, and the ASCII art logo used throughout every TUI screen and component.
Package theme provides the centralized color palette, reusable lipgloss styles, and the ASCII art logo used throughout every TUI screen and component.
version
Package version provides build-time version information for the Nexus CLI.
Package version provides build-time version information for the Nexus CLI.

Jump to

Keyboard shortcuts

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