TurboGo

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2025 License: MIT Imports: 9 Imported by: 0

README ΒΆ

πŸŒ€ TurboGo β€” High Performance Middleware-First Go Framework

Go Benchmarks Go Report Card Coverage Contributions License Last Commit Issues

TurboGo is a blazing-fast, middleware-first, and event-driven web framework built with Go β€” inspired by Express, but optimized for high concurrency, clean extensibility, and developer control.

TurboGo Key Features are :

  • Middleware-first β€” use .Use()
  • Ultra-fast router & context engine
  • Built-in async engines (PubSub, Queue, Cache)
  • Extensible and clean internal architecture
  • Optional middleware: Auth, Logger, Recovery, Auto-cache
  • CLI generator: npx create-turbogo for instant project scaffolding

🧭 Request Lifecycle Overview

                           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                           β”‚   Client   β”‚
                           β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
                                β”‚
                                β–Ό
                        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                        β”‚  HTTP Router  β”‚  ← core/routing.go
                        β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β–Ό
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚  Turbo Middleware Pipeline      β”‚ ← middleware/logger.go, auth.go, etc.
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       β–Ό
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚ Redis Auto-Cache Layer (Check & Set)        β”‚ ← middleware/cache.go
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜
                 β–Ό                              β–Ό
          Cache Hit β†’ Return JSON       Cache Miss β†’ Proceed
                                                 β”‚
                                                 β–Ό
                           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                           β”‚     Handler Logic (Dev)      β”‚ ← developer handler: func(ctx *Context)
                           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                          β–Ό
                     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                     β”‚       Embedded Infrastructure Engine       β”‚ ← core/context.go
                     β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β–Ό            β–Ό            β–Ό
                         Redis         Kafka       RabbitMQ
                      (inmem.go)   (pubsub.go)   (taskqueue.go)
                            β–Ό            β–Ό            β–Ό
                         persist       persist       persist
                          (.json)       (.log)        (.log)
                                β–Ό
                        Response + Cache Set

πŸ” Example: Auth Middleware

Use the built-in auth middleware with environment variable AUTH_SECRET:

app.Use(middleware.Auth(os.Getenv("AUTH_SECRET")))

Set your secret in .env:

export AUTH_SECRET=supersecurekey123

πŸš€ Getting started

Manual Installation TurboGo
go get github.com/Dziqha/TurboGo
TurboGo CLI (npx create-turbogo)

Scaffold TurboGo apps instantly via CLI.

npx create-turbogo myapp

Prompted features:

  • βœ… Controller name
  • πŸ“ Structure auto-generated

⚠️ We intentionally use Node.js to overcome limitations of Go's CLI tooling, especially for rich interactive workflows.

Running TurboGo Example

Gin requires Go version 1.23 or above.

package main

import (
	"github.com/Dziqha/TurboGo"
	"github.com/Dziqha/TurboGo/core"
)

func main() {
	app := TurboGo.New()

	app.Get("/", func(c *core.Context) {
		c.Text(200, "Hello from TurboGo!")
	})

	app.RunServer(":8080")
}

To run the code, use the go run command, like:

go run example.go

Your TurboGo app will be available at http://localhost:8080


πŸ§ͺ Benchmark Overview

Benchmark Name Iterations Time per Operation Memory per Operation Allocations per Operation
BenchmarkPubSub_1000Messages-12 3,941,121 284.3 ns/op 249 B/op 4 allocs/op
BenchmarkTaskQueue_1000Tasks-12 4,266,667 297.1 ns/op 4 B/op 1 allocs/op
BenchmarkTaskQueue_WithDelay-12 1,069 1,124,821 ns/op 252 B/op 4 allocs/op
BenchmarkTaskQueue_CPUProfile-12 1,883,364 652.6 ns/op 4 B/op 1 allocs/op
BenchmarkCPUPrint-12 1,000,000,000 0.4956 ns/op 0 B/op 0 allocs/op
BenchmarkTaskQueue_Print-12 1,809,789 652.3 ns/op 4 B/op 1 allocs/op
BenchmarkTaskQueue_Parallel-12 28,087,125 46.83 ns/op 18 B/op 1 allocs/op
BenchmarkTaskQueue_DelayRetry-12 24,147,055 48.40 ns/op 19 B/op 1 allocs/op
BenchmarkTaskQueue_WorkerPool-12 4,324,900 306.5 ns/op 4 B/op 1 allocs/op
BenchmarkTaskQueue_RateLimit-12 2,259 533,127 ns/op 3 B/op 1 allocs/op

Benchmarked on Windows amd64, Ryzen 5 5600H, Go 1.24. ⚠️ Results may varyβ€”run on idle system for accuracy.


🀝 Contributing

Contributions are welcome β€” from fixing typos to suggesting ideas or building features. TurboGo grows through small steps, open discussions, and shared curiosity. Join the conversation on Discussions.

❀️ About

TurboGo is handcrafted with performance, simplicity, and extensibility in mind β€” empowering developers to build Go web backends without the bloat.

Ready to go fast? Build with TurboGo. πŸŒ€ Give it a ⭐ on GitHub if you like it!


πŸ“„ License

This project is licensed under the MIT License

Built with love by @dziqha

Documentation ΒΆ

Index ΒΆ

Constants ΒΆ

This section is empty.

Variables ΒΆ

This section is empty.

Functions ΒΆ

func Banner(addr string) string

func CenterText ΒΆ

func CenterText(text string, addr ...string) string

Types ΒΆ

type App ΒΆ

type App struct {
	// contains filtered or unexported fields
}

func New ΒΆ

func New() *App

func (*App) Add ΒΆ

func (a *App) Add(methods []string, path string, handler core.Handler, handlers ...core.Handler) *core.Route

func (*App) All ΒΆ

func (a *App) All(path string, h core.Handler, hs ...core.Handler) *core.Route

func (*App) Connect ΒΆ

func (a *App) Connect(path string, h core.Handler, hs ...core.Handler) *core.Route

func (*App) Delete ΒΆ

func (a *App) Delete(path string, h core.Handler, hs ...core.Handler) *core.Route

func (*App) Get ΒΆ

func (a *App) Get(path string, h core.Handler, hs ...core.Handler) *core.Route

HTTP Methods

func (*App) GetMiddleware ΒΆ

func (a *App) GetMiddleware() []core.Handler

func (*App) GetRouter ΒΆ

func (a *App) GetRouter() *router.Router

func (*App) GetRoutes ΒΆ

func (a *App) GetRoutes() []*core.Route

func (*App) Group ΒΆ

func (a *App) Group(prefix string, handlers ...core.Handler) core.Router

func (*App) Handler ΒΆ

func (a *App) Handler() fasthttp.RequestHandler

func (*App) Head ΒΆ

func (a *App) Head(path string, h core.Handler, hs ...core.Handler) *core.Route

func (*App) InitEmptyEngine ΒΆ

func (a *App) InitEmptyEngine() *core.EngineContext

func (*App) Options ΒΆ

func (a *App) Options(path string, h core.Handler, hs ...core.Handler) *core.Route

func (*App) Patch ΒΆ

func (a *App) Patch(path string, h core.Handler, hs ...core.Handler) *core.Route

func (*App) Post ΒΆ

func (a *App) Post(path string, h core.Handler, hs ...core.Handler) *core.Route

func (*App) Put ΒΆ

func (a *App) Put(path string, h core.Handler, hs ...core.Handler) *core.Route

func (*App) Route ΒΆ

func (a *App) Route(path string) *core.Route

func (*App) RoutesInfo ΒΆ

func (a *App) RoutesInfo() []map[string]string

func (*App) RunServer ΒΆ

func (a *App) RunServer(addr string) error

func (*App) SetRoutes ΒΆ

func (a *App) SetRoutes(routes []*core.Route)

func (*App) Trace ΒΆ

func (a *App) Trace(path string, h core.Handler, hs ...core.Handler) *core.Route

func (*App) Use ΒΆ

func (a *App) Use(args ...any) core.Router

func (*App) WithPubsub ΒΆ

func (a *App) WithPubsub(ctx *core.EngineContext)

func (*App) WithQueue ΒΆ

func (a *App) WithQueue(ctx *core.EngineContext)

func (*App) WrapHandlers ΒΆ

func (a *App) WrapHandlers(handlers []core.Handler) fasthttp.RequestHandler

Directories ΒΆ

Path Synopsis
internal

Jump to

Keyboard shortcuts

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