gelt

package module
v0.0.0-...-39b146d Latest Latest
Warning

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

Go to latest
Published: May 21, 2025 License: MIT Imports: 24 Imported by: 0

README

Gelt

Gelt is a powerful framework for Go, inspired by Svelte and Vue, that enables developers to build modern web applications with ease.

Gelt – Short for Go + Svelte, also means money in Yiddish.

Features

  • Full-Stack Development: Gelt can be used to build frontend, backend, and full-stack applications seamlessly.
  • Hot Reloading: Automatically refreshes static files for a smooth development experience.
  • File-Based Routing: Organize routes intuitively using the file system.
  • Go-Powered Performance: Leveraging the efficiency and concurrency model of Go.
  • Component-Based UI: Write reusable components just like in Svelte and Vue.
  • Easy-to-Use: A simple and elegant syntax inspired by Svelte and Vue.

Getting Started

To create a new Gelt project, simply run:

go run github.com/struckchure/gelt/cmd new

This command scaffolds a new Gelt project with the necessary structure and configuration.

Building Applications with Gelt

Frontend

Gelt allows you to build dynamic frontend applications with declarative UI components and reactive data binding.

Backend

Gelt can also serve as a backend framework, leveraging Go’s speed and scalability to handle API requests efficiently.

Full-Stack

With Gelt, you can combine frontend and backend into a single project, keeping everything streamlined and optimized.

Hot Reloading

Gelt supports hot reloading for static files, ensuring a smooth development workflow. Any changes to your frontend assets or templates are reflected instantly without restarting the server.

File-Based Routing

Gelt simplifies route management with a file-based routing system. Just like in SvelteKit, pages are created based on file structure, making it intuitive to define your application's routes.


Check this Post on X for a Demo 👇

🔗 Demo on X

Get started with Gelt today and experience the power of Go-driven web development! 🚀

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeWeight

func ComputeWeight(path string) int

ComputeWeight calculates the weight of a route

func ExtractQueryTags

func ExtractQueryTags(data any) map[string]any

ExtractQueryTags extracts all struct field values that have the "query" tag

func GetFunction

func GetFunction[T any](target any, methodName string) (T, bool, error)

func GetGoModuleName

func GetGoModuleName(dir string) (string, error)

func GetPackageName

func GetPackageName(filename string) (string, error)

GetPackageName extracts the package name from a Go source file

func JoinURL

func JoinURL(base string, parts ...string) string

func Prettify

func Prettify(v any) (string, error)

func SortRoutes

func SortRoutes(routes []Route)

SortRoutes sorts routes based on their weight

func ToJSON

func ToJSON(data any) string

Types

type Action

type Action[T, R any] func(c any) (R, error)

type EventBus

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

EventBus struct

func NewEventBus

func NewEventBus() *EventBus

NewEventBus creates a new event bus

func (*EventBus) Publish

func (eb *EventBus) Publish(event, data string)

Publish an event

func (*EventBus) Subscribe

func (eb *EventBus) Subscribe(event string) chan string

Subscribe to an event

type Handler

type Handler func() error

type IServer

type IServer interface {
	Start(...int) error
}

type Load

type Load func(c echo.Context) (any, error)

type Registry

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

func NewRegistry

func NewRegistry(rootPath string, registryPath string, modulePath string) *Registry

func (*Registry) Generate

func (r *Registry) Generate() error

type Route

type Route struct {
	Pattern  *regexp.Regexp
	Params   []string
	Path     string
	Script   string
	Template string
	Weight   int
}

type Router

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

func NewRouter

func NewRouter(pageRegistry map[string]any, eventBus *EventBus) *Router

func (*Router) AddRoute

func (r *Router) AddRoute(path string, route Route) error

func (*Router) Register

func (r *Router) Register(srv *echo.Echo) error

type Server

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

func NewServer

func NewServer(pageRegistry map[string]any) *Server

func (*Server) Start

func (s *Server) Start(port ...int) error

func (*Server) Watcher

func (s *Server) Watcher()

Directories

Path Synopsis
examples
godom command
wasm command

Jump to

Keyboard shortcuts

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