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.

Overview

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.
Issues
  • 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

    opened by xserve98 8
  • 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.

    opened by jochen42 8
  • 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.

    opened by danielpoe 7
  • 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?

    enhancement 
    opened by danielpoe 7
  • 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.

    opened by Ompluscator 6
  • 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?

    opened by asif-ir 5
  • 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.

    opened by masmrlar 5
  • 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.

    opened by jochen42 5
  • 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

    opened by carstendietrich 4
  • #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

    opened by jochen42 4
  • framework/web: add sorting option for filters

    framework/web: add sorting option for filters

    Added option for web.Filter to be prioritised. By default, priority for all filters is 0, until it's specified differently. During web.ChainFilter initialisation, filters are stored in descending order.

    opened by Ompluscator 3
  • Memory stats are not updated

    Memory stats are not updated

    Hello Flamingo team,

    due to an issue in https://github.com/census-instrumentation/opencensus-go, the memory stats do not seem to be updated for opencensus. In line https://github.com/i-love-flamingo/flamingo/blob/fa5bd34bea32f0a38948f2c7875aed733c62e7d4/framework/opencensus/module.go#L155-L158 the RunMetricOptions are instantiated without setting UseDerivedCumulative. Consequently, in line https://github.com/census-instrumentation/opencensus-go/blob/052120675fac2ace91dc2c01e5f63c3e6ec62f04/plugin/runmetrics/producer.go#L133 only producer.deprecatedMemStats is instantiated and not producer.memStats. But, the latter seems to be required to read current memory metrics => see https://github.com/census-instrumentation/opencensus-go/blob/052120675fac2ace91dc2c01e5f63c3e6ec62f04/plugin/runmetrics/producer.go#L169 A possible workaround might be, to set UseDerivedCumulative in framework/opencensus/module.go

    bug 
    opened by mkrill 1
  • Release v3.4.0

    Release v3.4.0

    Release v3.4.0 🏆

    Summary

    There are 2 🆕 feature, 8 👾 fix, 1 🤖 devops, 2 🧹 chore, 4 📝 other commits since v3.3.0.

    This is a minor 📦 release.

    Changelog

    Version v3.4.0 (2022-05-10)

    Features

    • core/oauth: support issuer URL overriding (#227) (fa5bd34b)
    • oauth: add oauth identifier (#220) (9883a4dc)

    Fixes

    • router: allow config for public endpoint (3f47d251)
    • framework/systemendpoint: use real port information in systemendpoint (4f59dc4a)
    • framework/prefixrouter: use real port information in ServerStartEvent (79ae6f95)
    • servemodule: use real port information in ServerStartEvent (c5209de3)
    • oauth: correctly map access-token claims (5a7331f3)
    • auth: add missing auth.Identity interface (#216) (27b93c16)
    • deps: exclude unmaintained redigo (#218) (6061f4ab)
    • fix missing gob register (0c488981)

    Ops and CI/CD

    • semanticore: add semanticore (a741f30d)

    Chores and tidying

    • bump go version to 1.17, replace golint with staticcheck (#222) (ae2b39e8)
    • auth: switch to github.com/gofrs/uuid (1854abc6)

    Other

    • framework/flamingo: replace redis session backend (#219) (8451ed0b)
    • core/auth: update to recent go-oidc v3, allow oidc issuer URL override (#212) (86076485)
    • add comment to StateEntry (a8be5d77)
    • allow multiple parallel state responses (d7b30a06)

    This changelog was generated by your friendly Semanticore Release Bot

    opened by github-actions[bot] 0
  • Update Cue library

    Update Cue library

    cuelang has developed new features. Let's make them available in Flamingo, too.

    current in Flamingo: cuelang.org/[email protected] actual version: cuelang.org/[email protected]

    opened by tessig 0
  • provide Bind methods like gin framework

    provide Bind methods like gin framework

    Bind methods are provided in gin.Context: https://pkg.go.dev/github.com/gin-gonic/gin#readme-model-binding-and-validation

    It is useful when post json struct data in request body.

    Will flamingo provide similar api in the future?

    opened by eastfisher 1
Releases(v3.3.0)
  • v3.3.0(Oct 14, 2021)

    • relative urls in openid connect
    • fix session bug with openid connect
    • minor refactorings
    • Updates dependencies (could be breaking for a deprecated dependency)
    Source code(tar.gz)
    Source code(zip)
  • v3.2.1(Oct 26, 2020)

  • v3.2.0(Feb 26, 2020)

    • license:
      • Flamingo now uses the MIT license. The CLA has been removed.
    • core/auth:
      • Flamingo v3.2.0 provides a new auth package which makes authentication easier an more canonical.
      • the old core/oauth is deprecated and provides a compatibility layer for core/auth.
    • sessions:
      • web.SessionStore provides programmatic access to web.Session
      • flamingo.session.saveMode allows to define a more granular session save behaviour
    • config loading:
      • both routes.yml and routes.yaml are now supported
    • framework/web:
      • the framework router got a couple of stability updates.
      • the web responder and responses don't fail anymore for uninitialized responses.
      • error responses are wrapped with a http error message
      • the flamingo.static.file controller needs a dir to not serve from root.
    • errors:
      • all errors are handled via Go's error package
    • go 1.13/1.14:
      • support for 1.12 has been dropped
    Source code(tar.gz)
    Source code(zip)
  • v3.1.0(Dec 19, 2019)

    v3.1.0:

    • Dingo is bumped to v0.2.4, so we are up to date now with the improved error handling
    • flamingo.App is reorganized, providing way more possibilities to debug and improved handling of dingo&co
    • we now support Cue configuration
    Source code(tar.gz)
    Source code(zip)
  • v3.0.0(Aug 26, 2019)

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
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

null 8 Dec 27, 2021
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

Krisna Pranav 13 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

null 20 Feb 2, 2022
Eudore is the core of a golang lightweight web framework.

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

null 71 Apr 6, 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

golanger 299 Mar 3, 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 .

zhenfan.yu 1 Oct 31, 2021
henrylee2cn 1.6k May 17, 2022
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

Kamaleshwar 240 May 3, 2022
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

Avenga 63 Mar 29, 2022
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

null 96 Apr 29, 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

Ad Hoc 73 Apr 3, 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

malte.l 17 Dec 11, 2021
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.

Maxence Charriere 6.1k May 12, 2022
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

palutova 0 Jan 21, 2022
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.

Suborbital 82 May 3, 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

Copper 44 May 4, 2022
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

long2ice 44 May 15, 2022
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

long2ice 44 May 15, 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

null 47 Apr 26, 2022