Flamingo Framework and Core Library. Flamingo is a go based framework for pluggable web projects. It is used to build scalable and maintainable (web)applications.

Flamingo Framework

Go Report Card GoDoc Tests Release TODOs Join the chat at https://gitter.im/i-love-flamingo/community

Flamingo is a web framework based on Go.
It is designed to build pluggable and maintainable web projects. It is production ready, field tested and has a growing ecosystem.

Quick start

See "examples/hello-world"

Initialize an empty project:

mkdir helloworld
cd helloworld
go mod init helloworld

Create your project main file:

cat main.go
package main

import (
	"flamingo.me/dingo"
	"flamingo.me/flamingo/v3"
)

func main() {
	flamingo.App([]dingo.Module{
	})
}

If you then start your project you will see a list of registered commands:

go run main.go

It will print something like:

Flamingo main

Usage:
  main [command]

Examples:
Run with -h or -help to see global debug flags

Available Commands:
  config      Config dump
  handler     Dump the Handlers and its registered methods
  help        Help about any command
  routes      Routes dump
  serve       Default serve command - starts on Port 3322

Flags:
  -h, --help   help for main

Use "main [command] --help" for more information about a command.

To start the server use the following sub command:

go run main.go serve

And open http://localhost:3322

Hello World Example:

To extend this empty flamingo project with a "Hello World" output please create a new module "helloworld" like this:

mkdir helloworld
cat helloworld/module.go

With the following code in module.go:

package helloworld

import (
        "context"
        "net/http"
        "strings"
        
        "flamingo.me/dingo"
        "flamingo.me/flamingo/v3/framework/web"
)

type Module struct{}

func (*Module) Configure(injector *dingo.Injector) {
        web.BindRoutes(injector, new(routes))
}

type routes struct{}

func (*routes) Routes(registry *web.RouterRegistry) {
        registry.Route("/", "home")
        registry.HandleAny("home", indexHandler)
}

func indexHandler(ctx context.Context, req *web.Request) web.Result {
        return &web.Response{
            Status: http.StatusOK,
            Body:   strings.NewReader("Hello World!"),
        }
}

This file now defines a very simple module, that can be used in the Flamingo bootstrap. In this case it registers a new handler that renders a simple "Hello World" message and binds the route "/" to this handler. Now please include this new module in your existing main.go file:

package main

import (
	"flamingo.me/dingo"
	"flamingo.me/flamingo/v3"
	"helloworld/helloworld"
)

func main() {
	flamingo.App([]dingo.Module{
        new(helloworld.Module),
	})
}

If you now run the server again

go run main.go serve

And open http://localhost:3322 you will see your "Hello World!" output.

Getting started

To learn more about Flamingo you can check out the full hello-world example tutorial and read the documentation under docs.flamingo.me

Getting Help

If you need help you can:

Framework Details

Feature List

  • dependency injection with Dingo
  • Flexible templating engines. (gotemplates and pugtemplates)
  • configuration concepts using cue with support for multiple config areas and additional config contexts
  • A module concept for building modular and pluggable applications based on Dingo
  • Authentication concepts and security middleware
  • Flexible routing with support for prefix routes and reverse routing
  • Web controller concept with request/response abstraction; form handling etc
  • Operational readiness: logging, (distributed) tracing, metrics and healthchecks with separate endpoint
  • Localisation support
  • Commands using Cobra
  • Event handling
  • Sessionhandling and Management (By default uses Gorilla)

Ecosystem

  • GraphQL Module (and therefore support to build SPA and PWAs on top of it)
  • Caching modules providing resilience and caching for external APIs calls.
  • pugtemplate template engine for server side rendering with the related frontend tooling Flamingo Carotene
  • Flamingo Commerce is an active projects that offer rich and flexible features to build modern e-commerce applications.
Owner
Flamingo
Flamingo is a frontend framework made in go. It is especially useful for building web based sites and portals in a microservice oriented architecture.
Flamingo
Comments
  • Focus items in RESTful API

    Focus items in RESTful API

    hello. Whether optimization of the REST API project will be considered later?

    I intend to use this for RESTful projects that do not require the functionality of templates

  • Multilevel/Redis cache backend

    Multilevel/Redis cache backend

    A simple implementation of an MultiLevel-Cache-Backends and an Redis-Cache-Backend.

    The redisBackend can be used as a second-level cache together with the inMemoryBackend to reduced the pressure to http-backends in case of large traffic-increase in a short time-period.

    The RedisBackend has a simple Lock-Mechanism which prevents parallel writes of the same cache-key.

    Another idea is to creata an awsS3 Backend. This will remove the need of manage an additional redis-instance. It is a little slower than redis, but scales really well.

    Additional i created a common backend test case, which can tests the basic functionality of all implemented backends.

    This is a first concept. Implementation to be discussed. I will add some documentation the next days.

  • Version endpoint

    Version endpoint

    Some projects want build time informations returned by a path.

    Typically this is done by writing a version.json file during build time.

    This Feature provides an endpoint to return the content of that file, if given.

  • Commands not stopping

    Commands not stopping

    Currently all commands are not stopping unless you hit STRG-C

    This is because the rootcommand inherits the PersistentPostRun which always blocks until termination signal is send.

    Proposal A) We can send own signal in all commands that should stop immediatelly (see commit)

    Proposal B) The root command should not block Instead it should just trigger the ShutdownEvent in its PersistentPostRun Then it is the job of the "serve" command to handle the interruption

    Thoughts?

  • framework/web: add handler as part of request

    framework/web: add handler as part of request

    This code adds handler name attribute to web.Request and so possibility to have information if there is assigned handler and it's name later in ChainFilter, Middleware or Controller.

  • Problem in bootstrapping graphql module

    Problem in bootstrapping graphql module

    This is the error that is thrown when I try to run go generate . as mentioned in the graphql module readme.

    2020/06/16 21:19:46 app: config load: root: flamingo.me/flamingo/v3/core/oauth.Module:4:10: cue: marshal error at path core.oauth.secret: cannot convert incomplete value "string" to JSON
    exit status 1
    main.go:4: running "go": exit status 1
    

    Any idea?

  • Adding EmptySessionWithID to web.session for testing purposes

    Adding EmptySessionWithID to web.session for testing purposes

    The additional function allows to create sessions for tests with a set ID. The ID is usually set by the session store, but as soon as a test requires sessions with ID things start to get complicated.

  • move httpFrontent_test.go to cache_test package

    move httpFrontent_test.go to cache_test package

    This is just an cosmetic pr. To be able to move HttpFrontent_test.go from the cache-package to the cache_test-packed, i needed to do some small refactorings:

    • factory cache.NewEntryMeta: needed to build an Meta-Object inside tests
    • exported cache.cachedResponse struct: needed to convert an interface to cache.CachedRepsonse conversion inside the tests
    • factory cache.NewCachedResponse: needed to build an CachedResponse inside tests
    • getter cache.CachedResponse.Body(): needed to compare the cache-results inside tests

    As far as i can see, the changes are backward-compatible and hotfix-version compatible (correct me if i am wrong ;)).

    Just cosmetic, but from my point of view unit-tests should be always in additional packages.

  • core/auth: update to recent go-oidc v3, allow oidc issuer URL override

    core/auth: update to recent go-oidc v3, allow oidc issuer URL override

    According to the OpenID Connect specs, the /.well-known/openid-configuration should contain an issuer field that matches the URL used to fetch the configuration metadata:

    The issuer value returned MUST be identical to the Issuer URL that was directly used to retrieve the configuration information. This MUST also be identical to the iss Claim value in ID Tokens issued from this Issuer.

    https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfig

    The OIDC solutions provided from Azure for example when using the Azure Active Directory B2C currently doesn't adhere to the OpenID Connect spec and returns a wrong issuer.

    Since that's something they won't fix that fast (or maybe not even at all) we should introduce a configuration to support overriding the issuer URL.

    https://github.com/MicrosoftDocs/azure-docs/issues/38427#issuecomment-555855086

    Changes in go-oidc: https://github.com/coreos/go-oidc/compare/v2.0.0...v3.1.0

  • #77 autogomaxprocs

    #77 autogomaxprocs

    adding the blank import "go.uber.org/automaxprocs" to app.go ensures the correct gomaxprocs settings in container-environments with cgroups.

    fixes #77

  • chore(deps): update module go to 1.19

    chore(deps): update module go to 1.19

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | go (source) | golang | minor | 1.17 -> 1.19 |


    Release Notes

    golang/go

    v1.19.0

    v1.18.5

    v1.18.4

    v1.18.3

    v1.18.2

    v1.18.1

    v1.18.0


    Configuration

    📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, click this checkbox.

    This PR has been generated by Mend Renovate. View repository job log here.

  • chore(deps): update module golang.org/x/oauth2 to v0.4.0

    chore(deps): update module golang.org/x/oauth2 to v0.4.0

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | golang.org/x/oauth2 | require | minor | v0.2.0 -> v0.4.0 |


    Release Notes

    golang/oauth2

    v0.4.0

    Compare Source

    v0.3.0

    Compare Source


    Configuration

    📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

  • chore(deps): update module github.com/golang-jwt/jwt/v4 to v4.4.3

    chore(deps): update module github.com/golang-jwt/jwt/v4 to v4.4.3

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | github.com/golang-jwt/jwt/v4 | require | patch | v4.4.2 -> v4.4.3 |


    Release Notes

    golang-jwt/jwt

    v4.4.3: 4.4.3

    Compare Source

    What's Changed

    New Contributors

    Full Changelog: https://github.com/golang-jwt/jwt/compare/v4.4.2...v4.4.3


    Configuration

    📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

  • Opencensus Module sets X-Correlation-Id even if already present

    Opencensus Module sets X-Correlation-Id even if already present

    Description

    Currently the open census module adds a correlation id header and value to every HTTP request. This leads to problems in our project as we already use the X-Correlation-Id header in other contexts throughout our services.

    Proposed solution

    To deal with this issue I suggest to modify the corresponding module.go to only set the X-Correlation-Id header if it isn't already present and to instead use the existing X-Correlation-Id value if it is.

    Acknowledgements

    I know that the open census module has since been deprecated but as we are currently dealing with this problem and the ETA for open census' replacement is yet to be determined, I think taking on this issue is still viable.

  • feat(core/zap): Make caller encoder configurable, add additional one

    feat(core/zap): Make caller encoder configurable, add additional one

    Currently, we use the short caller encoder to receive file names/positions from zap. Due to this shortness, we often aren'T able to find the actual file. Lets make it configurable and introduce additional caller encoders that give more insights without polluting the log too mutch.

The jin is a simplified version of the gin web framework that can help you quickly understand the core principles of a web framework.

jin About The jin is a simplified version of the gin web framework that can help you quickly understand the core principles of a web framework. If thi

Jul 14, 2022
A powerful go web framework for highly scalable and resource efficient web application

webfr A powerful go web framework for highly scalable and resource efficient web application Installation: go get -u github.com/krishpranav/webfr Exa

Nov 28, 2021
A powerful go web framework for highly scalable and resource efficient web application

A powerful go web framework for highly scalable and resource efficient web application

Oct 3, 2022
Golanger Web Framework is a lightweight framework for writing web applications in Go.

/* Copyright 2013 Golanger.com. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except

Nov 14, 2022
Eudore is the core of a golang lightweight web framework.

Eudore eudore是一个golang轻量级web框架核心,可以轻松扩展成一个技术栈专用框架,具有完整框架设计体系。 反馈和交流请加群组:QQ群373278915。 Features 易扩展:主要设计目标、核心全部解耦,接口即为逻辑。 简单:对象语义明确,框架代码量少复杂度低,无依赖库。 易用

Nov 7, 2022
based on go lang build WEB development framework for go lang beginners .

based on go lang build WEB development framework for go lang beginners .

Oct 31, 2021
A minimal framework to build web apps; with handler chaining, middleware support; and most of all standard library compliant HTTP handlers(i.e. http.HandlerFunc).
A minimal framework to build web apps; with handler chaining, middleware support; and most of all standard library compliant HTTP handlers(i.e. http.HandlerFunc).

WebGo v4.1.3 WebGo is a minimalistic framework for Go to build web applications (server side) with zero 3rd party dependencies. Unlike full-fledged fr

Jan 1, 2023
re:Web enables classic web applications to run on AWS Lambda.
re:Web enables classic web applications to run on AWS Lambda.

re:Web re:Web enables classic web applications to run on AWS Lambda. re:Web interfaces with the Lambda Runtime API. It translates API Gateway requests

Jan 1, 2023
Couper is a lightweight API gateway designed to support developers in building and operating API-driven Web projects
Couper is a lightweight API gateway designed to support developers in building and operating API-driven Web projects

Couper Couper is a lightweight API gateway designed to support developers in building and operating API-driven Web projects. Getting started The quick

Nov 18, 2022
An app skeleton for very simple golang web applications

Golang App Skeleton This is a skeleton for a golang web application optimized for simplicity and rapid development. Prerequisites Go 1.15 or greater O

Oct 16, 2022
Pulp allows you to write dynamic web-applications entirely in go

pulp Pulp allows you to write dynamic web-applications entirely in go, by reacting to events on the server-side. func (c index) Render(pulp.Socket) (p

Dec 5, 2022
Go-app is a package to build progressive web apps with Go programming language and WebAssembly.
Go-app is a package to build progressive web apps with Go programming language and WebAssembly.

Go-app is a package to build progressive web apps with Go programming language and WebAssembly.

Dec 30, 2022
Vektor - Build production-grade web services quickly
Vektor - Build production-grade web services quickly

Vektor enables development of modern web services in Go. Vektor is designed to simplify the development of web APIs by eliminating boilerplate, using secure defaults, providing plug-in points, and offering common pieces needed for web apps. Vektor is fairly opinionated, but aims to provide flexibility in the right places.

Dec 15, 2022
🚀‏‏‎ ‎‏‏‎‏‏‎‎‎‎‎‎Copper is a Go toolkit complete with everything you need to build web apps.

Copper Copper is a Go toolkit complete with everything you need to build web apps. It focuses on developer productivity and makes building web apps in

Jan 7, 2023
GoAdmin Instruction - A golang framework help gopher quickly build a data visualization platform

GoAdmin Instruction - A golang framework help gopher quickly build a data visualization platform

Jan 21, 2022
Swagger + Gin = SwaGin, a web framework based on Gin and Swagger
Swagger + Gin = SwaGin, a web framework based on Gin and Swagger

Swagger + Gin = SwaGin Introduction SwaGin is a web framework based on Gin and Swagger, which wraps Gin and provides built-in swagger api docs and req

Dec 30, 2022
Swagger + Gin = SwaGin, a web framework based on Gin and Swagger
Swagger + Gin = SwaGin, a web framework based on Gin and Swagger

Swagger + Gin = SwaGin Introduction SwaGin is a web framework based on Gin and Swagger, which wraps Gin and provides built-in swagger api docs and req

Dec 30, 2022
Goa is a web framework based on middleware, like koa.js.

Goa Goa is under construction, if you are familiar with koa or go and interested in this project, please join us. What is goa? goa = go + koa Just lik

Sep 27, 2022