gostack

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

README ΒΆ

GoStack Logo

Go Reference

GoStack β€” A modern fullstack web framework for scalable web development in Go.

πŸ“ The Philosophy & Vision of GoStack

The Problem GoStack Solves

Modern Web development in Go is fragmented by design. A typical Go Web project looks like:

1.) Router from a third-party library (gorilla/mux)

2.) ORM from a third-party library (gorm)

3.) Migration tool from a third-party library (golang-migrate)

4.) Authentication system from a third-party library (goth)

5.) Caching layer from a third-party library (go-redis)

6.) Queue/background worker from a third-party library (machinery)

7.) WebSocket library from a third-party library (gorilla/websocket)

8.) Cron scheduler from a third-party library (robfig/cron)

9.) File storage abstraction from a third-party library (aws-sdk-go)

10.) Frontend built entirely separately (React) in a different language, introducing context-switching, with its own third-party ecosystem (Vite)

The result: Ten third-party ecosystems, Ten mental models, Ten failure points β€” just to build one application.

The GoStack Answer: One Language. One Binary. One Mental Model.

The Disruptive Paradigm Shift: GOSTACK

GoStack is the first complete end-to-end framework solution for building FullStack Web applications in Go. It handles the:

1.) βœ… Server (Citadel) β€” IoC service container and unified bootstrapping kernel.

2.) βœ… Middleware (Navigator) β€” pipeline-aware routing engine with onion-style middleware.

3.) βœ… ORM (Crafter) β€” compile-time safe Active Record ORM with model hooks and hydration.

4.) βœ… Schema Builder (Grapher) β€” declarative fluent schema builder for database definitions.

5.) βœ… Migrations (Traveller) β€” auto-schema diffing migration runner with transaction support.

6.) βœ… Authentication (Guard) β€” session/token auth with CSRF and policy-based RBAC.

7.) βœ… Caching (Mory) β€” strongly-typed generic caching adapter.

8.) βœ… Queue (Sequence) β€” background worker with retries, delays, job chains, and batches.

9.) βœ… Events (Spark) β€” sync and async Pub/Sub event dispatcher.

10.) βœ… Mail (GoMail) β€” rich SMTP HTML mailer built on the standard library.

11.) βœ… Storage (Vault) β€” traversal-secure local and S3 storage sandbox.

12.) βœ… Scheduler (Planner) β€” native cron-style task scheduler running in background.

13.) βœ… Admin Dashboard (GoDash) β€” auto-generated admin panel with live queue monitoring.

14.) βœ… Frontend Compiler (Tempose) β€” AOT compiler turning HTML/CSS/JS into Go code.

15.) βœ… Client Reactivity (Glide) β€” zero-dependency reactive directive engine.

16.) βœ… CLI (Gost) β€” interactive scaffolding for migrations, models, and controllers.

17.) βœ… Config (GoCon) β€” environment-based configuration management.

18.) βœ… Everything else in-between, and the glue that connects them β€” all within the Go ecosystem.

Everything in One binary, One mental model, One language.

It's the equivalent of what Laravel gave PHP, what Django gave Python, and what Rails gave Ruby β€” instead of assembling an app from 10 independent packages, you get one coherent framework where every layer knows about every other layer by design.

Go developers have never had this β€” until now (June 2026).

The Five (5) Core Pillars

1.) πŸ”‹ Batteries Included:

GoStack ships with everything β€” routing, ORM, migrations, auth, caching, queues, WebSockets, scheduling, storage, events, admin dashboard, and a frontend compiler β€” all in one module, which means no abandonware risk, no integration hell, no context switching between Go and Node.js, no tracking ten different package versions, and no JavaScript frontend forced upon you, because everything is natively integrated, maintained as one coherent ecosystem, and compiled into a single binary, so you don't assemble a stack β€” you just build.

2.) πŸ”„ No Context Switching (Go-Native Fullstack)

The most radical part of GoStack: the frontend is Go. Components are .html, .css, and .js files that Tempose compiles into Go string literals at build time β€” no separate dev server, no proxy configuration, no CORS headaches.

Client-side reactivity is provided by Glide, a micro frontend engine inspired by Alpine.js, embedded directly in your binary. With Glide's gs-* directive system, you add interactivity using declarative attributes right in your HTML β€” gs-click, gs-model, gs-show, gs-for, and more. No useState, no useEffect, no virtual DOM, no build step. Just HTML with superpowers.

The result is a fullstack application with no Node.js, no npm, no package.json, no node_modules, no Webpack, no Vite, no Babel β€” just go build.

One language. One binary. No separate frontend toolchain.

3.) πŸ“˜ Easy to Learn and Use (One Mental Model)

When you learn a new framework, you're not just learning syntax β€” you're learning a way of thinking. Most frameworks teach you ten different ways of thinking: one for data, one for background tasks, one for real-time updates, one for configuration. Every new feature demands a new mental context switch.

GoStack doesn't do this β€” everything in GoStack works the way you'd naturally expect it to work. The pattern you learn on day one is the same pattern you use every time forward. There are no hidden layers where the framework suddenly behaves differently because you've crossed some invisible complexity threshold.

With GoStack, there's just one simple pattern that never changes, no matter how big your idea gets.

4.) πŸ”’ Secure by Default

Most frameworks assume you'll remember to lock the door after you build the house. GoStack assumes you won't β€” so it locks every door for you, before you even lay the first brick.

With GoStack, security isn't an afterthought you scramble to add at the end of a project. It's baked into the foundation from the very first line. Every request is questioned. Every file access is contained. Every database query is protected unless you explicitly say otherwise. Every user action needs permission. Nothing is trusted by accident.

This means you can build with speed and sleep with peace of mind. Beginners don't have to become security experts just to launch their first app. Investors don't have to worry about the hidden cost of a breach. And developers don't have to spend their nights wondering if they forgot to sanitize that one input.

GoStack doesn't wait for you to make a mistake β€” it prevents the mistake from ever happening. Security isn't a feature you add later. It's how the framework works, baked in and always on.

5. ⚑ Developer Experience as a First-Class Feature

For years, developers in other ecosystems have enjoyed something Go never had: a complete, integrated framework where every piece works with every other piece out of the box. Rails has it. Django has it. Laravel has it.

Go developers have built amazing things too β€” but not because of the tooling. Despite it. Go developers have built amazing things too β€” but not because of the tooling. Despite it. Go developers have always had to build integration themselves, piece by piece, and then maintain it forever. A router here. An ORM there. A queue library over here. A WebSocket package somewhere else. Ten different ecosystems. Ten different futures. Ten chances for any one of them to fall out of sync with your needs.

GoStack delivers what Go has always deserved: a complete, integrated framework designed from the ground up to be Future-Proof by Default. No hunting for which router works with which ORM. No wondering if your WebSocket library will still be maintained next year. No constant context switching between packages with different philosophies.

The result is simple: one stack, one way of working, one future. No assembly required. No fragmentation. No guesswork.

Other ecosystems have enjoyed this foundation for years. GoStack brings it to the Go ecosystem, to finally remove those headaches and uncertainties.

GoStack handles the heavy lifting and the behind-the-scenes complexity. While you handle your ambition and concentrate on your core business objectives.

The Core Rationale in One Sentence

GoStack exists because Go is an exceptional language held back by ecosystem fragmentation β€” and the cure is a single, opinionated, compile-safe framework that lets you build the server, the database layer, and the UI without ever leaving Go.

It's positioned as the answer to: "Why would I use Laravel/Rails/Django if I want Go's performance?" The answer GoStack gives is: "You wouldn't have to choose anymore."


πŸ—ΊοΈ The GoStack Subsystem Registry

Every major capability in GoStack has a branded name:

Branded Name What It Is Package
Citadel Application Container & DI Bootstrap framework/foundation
Navigator HTTP Router framework/http
Bridge Middleware Pipeline (Onion Architecture) framework/http
Crafter Query Builder & Reflective Hydrator framework/query
Traveller Database Migration Engine framework/migrate
Grapher Schema Builder (fluent column definitions) framework/schema
Guard Authentication (session-based) framework/auth
Mory Generic-typed In-Memory Cache framework/cache
Sequence Background Job Queue framework/queue
Spark Pub/Sub Event Dispatcher framework/events
GoMail SMTP Mailer framework/mail
Vault File Storage (Local + S3) framework/storage
Planner Cron Task Scheduler framework/schedule
SocialHub OAuth Social Login framework/socialhub
GoDash Admin Panel & Sequence Monitor framework/admin
Tempose AOT UI Component Compiler framework/ui
Glide Client-Side Reactive Runtime (gs-* directives) framework/http/runtime.go
Gost CLI Command Runner framework/console
Contract Interface Definitions (driver contracts) framework/contract
GoCon Environment Config Manager (.env parser) framework/config
GoMon MongoDB Integration (NoSQL Document Store) framework/database/mongodb
Nexus Neo4j Graph Database Integration framework/database/neo4j
Aether Cassandra Wide-Column Database Integration framework/database/cassandra

πŸ› οΈ Architecture Invariants & Developer Guidelines

1. The Zero-Dependency Principle
  • Invariant: Keep third-party dependencies to an absolute minimum.
  • Rationale: GoStack prioritizes high compilation speeds and tiny binary footprints. Rather than importing heavy CLI or routing libraries, GoStack relies on native standard library wrappers (net/http, database/sql).
  • Guideline: Avoid running go get for minor utilities. Write clean, native Go helpers first.
2. Ahead-of-Time (AOT) Frontend Compilation (Tempose)
  • Invariant: Component templates (HTML, CSS, JS) are compiled directly into Go source code by Tempose.
  • Rationale: GoStack does not parse template files at runtime or rely on Node.js. Scoped component styles are isolated using custom attribute selectors at build-time.
  • Guideline: Run gostack compile to update gostack_components_gen.go. Do not manually edit generated files.
3. Modular Self-Containment via Contract
  • Invariant: Application code binds to Contract interfaces (framework/contract), not concrete drivers.
  • Rationale: Decoupling adapters from core packages ensures drivers (MySQL, PostgreSQL) can be swapped by modifying the environment DSN without altering application logic.
4. Pluggable Self-Registration
  • Invariant: Components, drivers, and migrations register dynamically via init() blocks.
  • Rationale: Centralized configuration lists are avoided. Packages self-register at runtime upon import.
5. Local Command Execution via Gost
  • Invariant: Execute CLI commands locally using go run cmd/gostack/main.go <command> or the global gost binary.
  • Rationale: Running Gost locally ensures compilers, code generators, and Traveller migrations are compiled with the active project's exact dependency tree.
6. The Context Wrapper Pattern (Bridge)
  • Invariant: Interceptors and handlers use *http.Context rather than raw http.ResponseWriter/*http.Request.
  • Rationale: Wrapping the HTTP primitives simplifies payload decoding, routing arguments, and state-sharing across the Bridge middleware pipeline.
7. The gs-css Opt-In Styling Rule (Tempose)
  • Invariant: Tempose's Core Base CSS only applies to elements that carry the gs-css HTML attribute.
  • Rationale: Opt-in styling gives developers 100% control. The framework never overrides custom designs without explicit permission.

Documentation ΒΆ

Index ΒΆ

Constants ΒΆ

This section is empty.

Variables ΒΆ

Auth coordinates authentication strategies globally.

View Source
var Cassandra *gocql.Session

Cassandra is the global Aether facade exposing the official Cassandra session. This is populated when the application is initialized with a Cassandra connection.

DB holds the initialized global state application database driver adapter connection. This is populated for relational SQL databases (MySQL, PostgreSQL, CockroachDB, SQLite).

Mail is the global mailer facade. Initialise it with InitMail before sending.

View Source
var Mongo *mongo.Client

Mongo is the global GoMon facade exposing the official MongoDB client. This is populated when the application is initialized with a MongoDB connection.

Neo4j is the global Nexus facade exposing the official Neo4j graph database driver. This is populated when the application is initialized with a Neo4j connection.

Functions ΒΆ

func InitAether ΒΆ added in v1.0.1

func InitAether(hosts, keyspace string) error

InitAether provisions and activates the Aether Cassandra integration subsystem. It connects to the Cassandra cluster and sets the global gostack.Cassandra facade.

Parameters:

  • hosts: A comma-separated string of Cassandra contact points (e.g. "127.0.0.1:9042").
  • keyspace: The Cassandra keyspace to bind the session to.

func InitAuth ΒΆ

func InitAuth(defaultGuard string, userProvider contract.UserProvider)

InitAuth provisions and initializes the authentication system, registering default session and token guards.

func InitDatabase ΒΆ

func InitDatabase(driver, dsn string) error

InitDatabase provisions and activates the target relational database driver infrastructure.

Supported drivers: "mysql", "postgres", "sqlite", "sqlite3", "cockroach", "cockroachdb". For MongoDB, Neo4j, and Cassandra use InitMongo, InitNexus, and InitAether instead.

Parameters:

  • driver: The database identifier string (e.g. "mysql", "postgres", "sqlite").
  • dsn: The Data Source Name string configuration mapping host, credentials, and target database.

Returns:

  • An error if the driver registration is missing or connection handshake protocols fail.

func InitMail ΒΆ

func InitMail(cfg mail.Config)

InitMail provisions the global Mail facade from the given SMTP configuration.

Call this once at application boot, typically after InitConfig:

gostack.InitMail(mail.Config{
    Host:        gostack.Config.Get("MAIL_HOST"),
    Port:        587,
    Username:    gostack.Config.Get("MAIL_USERNAME"),
    Password:    gostack.Config.Get("MAIL_PASSWORD"),
    FromAddress: gostack.Config.Get("MAIL_FROM_ADDRESS"),
    FromName:    gostack.Config.Get("MAIL_FROM_NAME"),
})

func InitMongo ΒΆ added in v1.0.1

func InitMongo(uri string) error

InitMongo provisions and activates the GoMon MongoDB integration subsystem. It connects to MongoDB using the provided URI and sets the global gostack.Mongo facade.

Parameters:

  • uri: The MongoDB connection string (e.g. "mongodb://127.0.0.1:27017").

func InitNexus ΒΆ added in v1.0.1

func InitNexus(uri, username, password string) error

InitNexus provisions and activates the Nexus Neo4j graph database integration subsystem. It connects using the official Neo4j driver and sets the global gostack.Neo4j facade.

Parameters:

  • uri: The Neo4j connection URI (e.g. "neo4j://localhost:7687").
  • username: The Neo4j username (typically "neo4j").
  • password: The Neo4j password.

func Table ΒΆ

func Table(name string) *database.QueryBuilder

Table provisions a fluent, decoupled instance of the QueryBuilder pipeline mapping a target table.

Why this exists: It hooks the global active database connection context into the builder framework, providing developers with an expressive data management interface from anywhere in the application scope.

Parameters:

  • name: The target schema table name string to initiate query expressions against.

Types ΒΆ

This section is empty.

Directories ΒΆ

Path Synopsis
_examples
app command
Package main serves as the primary operational entry point for the GoStack framework application.
Package main serves as the primary operational entry point for the GoStack framework application.
cmd
app command
Package main serves as the primary operational entry point for the GoStack framework application.
Package main serves as the primary operational entry point for the GoStack framework application.
gost command
Purpose: This file is the global command-line installer for the GoStack framework.
Purpose: This file is the global command-line installer for the GoStack framework.
gostack command
Purpose: This file is the project-local command-line entrypoint for the GoStack framework.
Purpose: This file is the project-local command-line entrypoint for the GoStack framework.
framework
auth
Purpose: This file implements Cross-Site Request Forgery (CSRF) protection middleware for GoStack.
Purpose: This file implements Cross-Site Request Forgery (CSRF) protection middleware for GoStack.
config
Purpose: This file implements the GoCon environment configuration system.
Purpose: This file implements the GoCon environment configuration system.
console
Purpose: This file implements the `make:migration` and `make:controller` CLI code generation commands.
Purpose: This file implements the `make:migration` and `make:controller` CLI code generation commands.
contract
Purpose: This file defines the abstract contract interfaces for the GoStack framework.
Purpose: This file defines the abstract contract interfaces for the GoStack framework.
database
Aether β€” GoStack Cassandra Wide-Column Database Integration Subsystem.
Aether β€” GoStack Cassandra Wide-Column Database Integration Subsystem.
events
Purpose: This file implements the Spark EventDispatcher subsystem for the GoStack framework.
Purpose: This file implements the Spark EventDispatcher subsystem for the GoStack framework.
foundation
Package foundation (Citadel) serves as the core booting and structural bedrock of the GoStack framework, managing low-level application lifecycles and diagnostics.
Package foundation (Citadel) serves as the core booting and structural bedrock of the GoStack framework, managing low-level application lifecycles and diagnostics.
http
Package http (Navigator, Bridge, Tempose, and Glide) houses the core HTTP request-response lifecycle management.
Package http (Navigator, Bridge, Tempose, and Glide) houses the core HTTP request-response lifecycle management.
mail
Purpose: This file implements the GoMail email sending component.
Purpose: This file implements the GoMail email sending component.
storage
Purpose: This file implements the LocalStorage driver for the Vault storage subsystem of GoStack.
Purpose: This file implements the LocalStorage driver for the Vault storage subsystem of GoStack.
ui
Purpose: This file implements the Tempose Ahead-of-Time (AOT) component compilation engine.
Purpose: This file implements the Tempose Ahead-of-Time (AOT) component compilation engine.
internal

Jump to

Keyboard shortcuts

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