orbit

command module
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: GPL-3.0 Imports: 1 Imported by: 0

README

Orbit · prerelease codecov CodeFactor GitHub license

Orbit is a golang server side processing framework for building server side web applications.

  • Micro-frontend: Out of the box support for React and vanilla JavaScript micro frontends.
  • Static bundling: Automatically creates static HTML files for components that don't make use of server side processing.
  • Bundling support: Orbit currently has support for the following tools:
Name Extent of support
Vanilla Javascript Full support
Client side React Full support
Server side React Experimental
Vue Planned

Installation

  • Go Install: To install with go install, you can use the command go install github.com/GuyARoss/orbit@latest
  • Manual Installation: To install manually, clone this repo and compile it with go build.

Examples

There are several examples that exist in the ./examples. Here is a basic one to get you up and running.

  1. Initialize the workspace directory with orbit init, then follow the prompts
  2. Create a react component
// /pages/hello-world.jsx
const HelloWorldComponent = ({ from }) => {
    return (
        <>
            <div> Hello, from {from} </div>
        </>
    )
}

export default HelloWorldComponent
  1. Run the build process with orbit build
  2. Create golang application
// main.go
package main

import (
    // ... 
)

func main() {
    // orbitgen comes from an autogenerated lib output from orbit
    orb, err := orbitgen.New()
    if err != nil {
        panic(err)
    }

    orb.HandleFunc("/", func (r *orbitgen.Request) {
        props := make(map[string]interface{})
        // sets the prop 'from' to the string 'orbit'
        props["from"] = "orbit"

        // renders a single page & passes props into the component
        c.RenderPage(orbitgen.HelloWorldComponent, props)

        // can also use c.RenderPages(...) to build a micro-frontend
    })

    http.ListenAndServe(":3030", orb.Serve())
}

  1. Run golang application with go run main.go

Contributing

Contributing Guide

Please first read our contributing guide before contributing to this project.

Good First Issues

To gain exposure to the project you can find a list of good first issues.

License

Orbit it licensed under GNU GPLv3

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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