Categorygithub.com/kyoto-framework/kyoto/v2
modulepackage
2.0.2
Repository: https://github.com/kyoto-framework/kyoto.git
Documentation: pkg.go.dev

# README

kyoto

Go library for creating fast, SSR-first frontend avoiding vanilla templating downsides.

Documentation • Quick start • Who uses? • Support us

Motivation

Creating asynchronous and dynamic layout parts is a complex problem for larger projects using html/template. Library tries to simplify this process.

What kyoto proposes?

  • Organize code into configurable and standalone components structure
  • Get rid of spaghetti inside of handlers
  • Simple asynchronous lifecycle
  • Built-in dynamics like Hotwire or Laravel Livewire
  • Using a familiar built-in html/template
  • Full control over project setup (minimal dependencies)
  • 0kb JS payload without actions client (~12kb when including a client)
  • Minimalistic utility-first package to simplify work with Go
  • Internationalizing helper
  • Cache control helper package (with a CDN page caching setup guide)

Reasons to opt out

  • API may change drastically between major versions
  • You want to develop SPA/PWA
  • You're just feeling OK with JS frameworks
  • Not situable for a frontend with a lot of client-side logic

Quick start

If you want to start straight from the example, use a starter project.

$ git clone https://github.com/kyoto-framework/start <project-name>

If you want to start from scratch, we have a minimal working example to start with.

Team

Who uses?

Broker One

Website: https://mybrokerone.com

The first version of the site was developed with Vue and suffered from large payload and low performance. After discussion, it was decided to migrate to Go with a built-in html/template due to existing libraries infrastructure inside of the project.
Despite the good performance result, the code was badly structured and it was very uncomfortable to work in existing paradigm.
On the basis of these problems, kyoto was born. Now, this library lies in the core of the platform.

Using the library in your project?

Please tell us about your story! We would love to talk about your usage experience.

Support us

Any project support is appreciated! Providing a feedback, pull requests, new ideas, whatever. Also, donations and sponsoring will help us to keep high updates frequency. Just send us a quick email or a message on contacts provided above.

If you have an option to donate us with a crypto, we have some addresses.

Bitcoin: bc1qgxe4u799f8pdyzk65sqpq28xj0yc6g05ckhvkk
Ethereum: 0xEB2f24e830223bE081264e0c81fb5FD4DDD2B7B0

Also, we have a page on open collective for backers support.

Open Collective: https://opencollective.com/kyoto-framework

# Functions

Action is a function that handles an action request.
ActionFlush allows to push multiple component UI updates during single action call.
ActionPreload unpacks a component state from an action request.
ActionRedirect is a function to trigger redirect during action handling.
Await accepts any awaitable component and returns it's state.
ComponentName takes a component function and tries to extract it's name.
Deprecated: use mapx.Merge from zen library instead.
HandleAction registers a component action handler with a predefined pattern in the DefaultServeMux.
HandlePage registers the page for the given pattern in the DefaultServeMux.
HandlerAction returns a http.HandlerFunc that handles an action request for a specified component.
HandlerPage returns a http.HandlerPage that renders the page.
MarshalState encodes components' state for a client.
Serve is a simple wrapper around http.ListenAndServe, which will log server starting and will panic on error.
Template creates a new template with a given name, using global parameters stored in kyoto.TemplateConf.
TemplateInline creates a new template with a given template source, using global parameters stored in kyoto.TemplateConf.
TemplateRaw handles a raw template.
UnmarshalState decodes components' state from a client.
Use is a function to use your components in your code.

# Variables

No description provided by the author
ActionConf is a global configuration that will be used during actions handling.
FuncMap holds a library predefined template functions.
TemplateConf is a global configuration that will be used during template building.

# Structs

ActionConfiguration holds a global actions configuration.
ActionParameters is a Go representation of an action request.
Context is the context of the current request.
TemplateConfiguration holds template building configuration.

# Type aliases

Component represents a kyoto component, defined as a function.