A Golang restful API boilerplate based on Echo framework v4

Overview

Build Status codecov License: MIT Go Reference GoReportCard Badge

Echo Rest API boilerplate

A Golang restful API boilerplate based on Echo framework v4. Includes tools for module generation, db migration, authorization, authentication and more.

Overview

Request processing flow - Sequence Diagram

Used libraries:

  • labstack/echo
  • open-policy-agent/opa
  • uber-go/dig
  • spf13/cobra
  • jackc/pgx
  • ory/kratos
  • golang-migrate/migrate

Features

  • User Auth functionality (Signup, Login, Forgot Password, Reset Password) use Ory/Kratos
  • REST API
  • DB Migration
  • Configs via environmental variables
  • Unit tests
  • Dependency injection
  • Role based access control (use Open Policy Agent)
  • Module generation, quickly create model, usecase, api handler

Refs

TODOs

  • Update docker compose for ory/kratos
  • Update README.md
  • Write more tests
  • Add support Heroku
Issues
  • Bump cuelang.org/go from 0.4.2 to 0.4.3

    Bump cuelang.org/go from 0.4.2 to 0.4.3

    Bumps cuelang.org/go from 0.4.2 to 0.4.3.

    Release notes

    Sourced from cuelang.org/go's releases.

    v0.4.3

    This release includes various bug fixes, including fixing some crashes. It also fixes a memory leak that would cause long-running servers to OOM (see #1418). It also now supports Go 1.18.

    It also fixes various builtin extensions.

    This release also makes a lot of preparations for the upcoming comprehension rework, which will allow us to do all kinds improvements and performance enhancements.

    As a reminder: users can register their projects with unity, our regression and performance testing setup. unity is used to ensure that a project's CUE evaluations do not unexpectedly stop working, or regress in terms of performance. unity continues to catch multiple issues with each release. Adding your project to unity not only guarantees that we will not break your tests (if we do, we will work with you to fix your CUE code), but it also helps to improve the quality of each CUE release. We are in the process of adding support for adding private projects to unity.

    Thank you to @​benmoss, @​cuichenli, @​danbison, @​emcfarlane, @​eonpatapon, @​jared-gs, @​jdreaver, @​jlongtine, @​mattmoor, @​mvdan, @​oncilla, @​roidelapluie, @​slewiskelly, @​xinau, and @​yannk for contributing to this release!

    Language changes

    This release removes all remaining support for quoted identifiers. Although this hasn't been supported for a while, there were still parts of the code that handled them, resulting in cryptic error messages.

    Core evaluator

    This release sees an overall improvement in error location reporting. These changes are quite substantial but largely, aside from a few resulting bug fixes, do not alter behavior.

    Builtins

    net

    Add CIDR range verification function.

    regexp

    Add ReplaceAll and ReplaceAllLiteral

    time

    Fixes a hermeticity issues where a local time zone may be selected. Added FormatString to ultimately replace Format, where Format will first have to be deprecated.

    Add FormatString, FormatDuration and Split

    tool/file

    Add MkdirTemp, RemoveAll

    tool/http

    Add Support for TLS settings.

    Changelog

    • 5c43a87a all: apply Go 1.18's gofmt -s
    • 41ad3a08 all: bump x/text
    • e74624be all: drop golang.org/x/xerrors
    • b6cdc743 all: format .cue files in txtar archives
    • 054cc312 all: move to go1.17-based go.mod
    • f396ea88 all: upgrade github.com/spf13/cobra to v1.4.0
    • f26cc29d all: upgrade go-internals
    • 83a17005 build: fix typo inclduded -> included
    • dc2c9e09 ci: add Go 1.18 and bump action and Go versions

    ... (truncated)

    Commits
    • 256f1f9 CI: update to the latest goreleaser version
    • 37cc8ac cmd/cue/cmd: support byte in get go
    • 5127136 cmd/cue/cmd: support uintptr in get go
    • dc2c9e0 internal/ci: add Go 1.18 and bump action and Go versions
    • 05f74a8 pkg: remove usage of qgo in go generate
    • 5c43a87 all: apply Go 1.18's gofmt -s
    • 69e2dcc cmd/cue: make long tests pass with Go 1.18
    • 6b138e4 cue/load: remove some unused code
    • e74624b all: drop golang.org/x/xerrors
    • 935a926 cmd/cue/cmd: make get go work with go 1.18
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    opened by dependabot[bot] 2
  • Bump github.com/tidwall/gjson from 1.14.0 to 1.14.1

    Bump github.com/tidwall/gjson from 1.14.0 to 1.14.1

    Bumps github.com/tidwall/gjson from 1.14.0 to 1.14.1.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    opened by dependabot[bot] 2
  • Bump github.com/jmoiron/sqlx from 1.3.4 to 1.3.5

    Bump github.com/jmoiron/sqlx from 1.3.4 to 1.3.5

    Bumps github.com/jmoiron/sqlx from 1.3.4 to 1.3.5.

    Commits
    • 28212d4 Merge pull request #767 from liftoffio/gpark.sqlx.reset-slice
    • 421d1cd Make Select reset slice length
    • a62bc60 Merge pull request #728 from s7v7nislands/update_mysql_version
    • 2765bc4 update go-sql-driver/mysql to v1.6.0
    • See full diff in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    opened by dependabot[bot] 2
  • Bump github.com/jackc/pgx/v4 from 4.15.0 to 4.16.0

    Bump github.com/jackc/pgx/v4 from 4.15.0 to 4.16.0

    Bumps github.com/jackc/pgx/v4 from 4.15.0 to 4.16.0.

    Changelog

    Sourced from github.com/jackc/pgx/v4's changelog.

    4.16.0 (April 21, 2022)

    • Upgrade pgconn to v1.12.0
    • Upgrade pgproto3 to v2.3.0
    • Upgrade pgtype to v1.11.0
    • Fix: Do not panic when context cancelled while getting statement from cache.
    • Fix: Less memory pinning from old Rows.
    • Fix: Support '\r' line ending when sanitizing SQL comment.
    • Add pluggable GSSAPI support (Oliver Tan)
    Commits
    • 8c1815e Release v4.16.0
    • c74f3f0 Add link to https://github.com/otan/gopgkrb5
    • e012ea0 Upgrade pgconn, pgtype, and pgproto3
    • 49a8601 Try to pacify finicky timing test on CI
    • 097b6aa Add time to logging failed Exec
    • bb8c52f Add doc regarding default pgxpool.Config.MaxConns
    • 3ce50c0 Rename dbSavepoint to dbSimulatedNestedTx
    • a86ece0 Fix single line comment for line endings in mac when sanitizing.
    • b6b24f9 Allocate connRows on demand instead of preallocating in bulk
    • 1e565b0 Handle stmtCache.Get error previously thought impossible
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    opened by dependabot[bot] 2
  • Bump github.com/golang-migrate/migrate/v4 from 4.15.1 to 4.15.2

    Bump github.com/golang-migrate/migrate/v4 from 4.15.1 to 4.15.2

    Bumps github.com/golang-migrate/migrate/v4 from 4.15.1 to 4.15.2.

    Release notes

    Sourced from github.com/golang-migrate/migrate/v4's releases.

    v4.15.2

    Changes

    Documentation

    • 06c25a2 Add pkger to README (by @​glacials )
    • ed8a8b0 Include iofs in migration sources (by @​bndw )
    • b69b032 clarify the package name (#660) (by @​khash )
    • bfd0502 Set syntax highlighting for pkger example (by @​glacials )
    • 81cbc9c fix: incorrect clickhouse dns example (by @​xkisu )

    Database Drivers

    Migration Sources

    • a2b0bda change github auth to use oauth token instead of basic. (by @​Greyeye )

    Builds

    • 5aa1a03 Bump version of autorest/adal (by @​jcmuller )
    • 169d0fc Include 2 letter query param key in unit test (by @​suzaku )
    • 331a15d Update dktest from v0.3.9 to v0.3.10 to fix upstream security issues (by @​dhui )
    • c277388 Update dktest to v0.3.9 for upstream security vulnerability fixes (by @​dhui )
    • cf68462 Run gofmt on internal build dir (by @​dhui )
    • fc7f720 refactor: use sort.Slice (by @​suzaku )
    • 918e13a Upgrade containerd and image-spec for the vulnerabilities (#662) (by @​mopp )
    • 4f82413 len(k) is guaranteed to be greater than 1 in this case (by @​suzaku )

    Thank you for your hard work and all your contributions!

    Commits
    • 331a15d Update dktest from v0.3.9 to v0.3.10 to fix upstream security issues
    • cc5f8b7 Merge pull request #714 from eaze/josh/test-sqlserver-with-edge
    • 9d3babd Run SQL server tests on Azure SQL Edge
    • 57aead3 Merge pull request #659 from AndreasKl/add-with-connection-to-postgres
    • e1d604b Merge pull request #708 from taywrobel/cassandra-connect-timeout
    • 3dfae0d Merge branch 'master' into add-with-connection-to-postgres
    • 6e499cb Expose configuring cassandra connect timeout through query string
    • 0bc9734 Merge pull request #700 from Juneezee/test/t.TempDir
    • 34c9878 Merge branch 'master' into add-with-connection-to-postgres
    • 98d2f99 test: use T.TempDir to create temporary test directory
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    opened by dependabot[bot] 2
Releases(v0.1.0-alpha.2)
Owner
Dzung Tran
Dzung Tran
REST API with Echo Framework from Go

REST API with Echo Framework from Go

Luis Quiñones Requelme 1 Nov 16, 2021
Golang Echo Framework

template-golang-echo Creator: 한승진 Date: 2021/10/13 Description Kubernetes-Istio 환경인 리얼패킹 클라우드에 배포하기 위한 Golang Echo 서버 기초 템플릿입니다. 배포 타겟 기술스텍 : Kubernet

joik1122 1 Oct 13, 2021
Bootstrapper and middleware for Echo framework in golang.

rk-echo Interceptor & bootstrapper designed for echo framework. Currently, supports bellow functionalities. Name Description Start with YAML Start ser

PointGoal 4 Mar 31, 2022
Boilerplate API template includes all the common packages and setup used for API development in this Company

Boilerplate API Boilerplate API template includes all the common packages and setup used for API development in this Company. Development Copy .env.ex

null 11 Feb 19, 2022
It took me a while to figure out how I can use GraphQL with the ent ORM and serve the GraphQL endpoint via the Echo framework

Go + Graphql + Ent + Echo Boilerplate It took me a while to figure out how I can use GraphQL with the ent ORM and serve the GraphQL endpoint via the E

Marc Boeker 1 Feb 12, 2022
Simple REST-API implementation using Golang with several packages (Echo, GORM) and Docker

Simple REST-API Boilerplate This is a simple implementation of REST-API using Golang and several packages (Echo and GORM). By default, I use PostgreSQ

Reza Pahlevi 0 Dec 30, 2021
Fastrest - fast restful framework for golang.

fastrest fast restful framework for golang. Create your app directory, like mkdir myapp; cd myapp; go mod init myapp; Create initial config.toml in a

bingoohuang 0 Jan 11, 2022
Opinionated boilerplate Golang HTTP server with CORS, OPA, Prometheus, rate-limiter for API and static website.

Teal.Finance/Garcon Opinionated boilerplate HTTP server with CORS, OPA, Prometheus, rate-limiter… for API and static website. Origin This library was

Teal.Finance 7 Mar 26, 2022
CRUD API server of Clean Architecture with Go(Echo), Gorm, MySQL, Docker and Swagger

CRUD API Server of Clean Architecture Go(echo) gorm mysql docker swagger build docker-compose up -d --build API Postman and Fiddler is recommended to

null 34 May 14, 2022
A lightweight RESTful web framework for Go

Goweb A lightweight RESTful web framework for Go. For examples and usage, please read the Goweb API Documentation Read our Articles Who uses Goweb? "U

Stretchr, Inc. 630 May 10, 2022
golang crud restful api with gorm , gin and mysql DB

crud restful api with golang , gorm , gin and mysql this api does a simple CRUD operations on a single table mysql Database . this is build on top off

Brahim Bessrour 14 Feb 26, 2022
Implementing a restful-api with Golang.

Go-REST Create a restful api with Golang. The main idea behind this project was to gain some knowledge about implementing a rest-api in Golang. Setup

AmirH.Najafizadeh 2 Dec 19, 2021
EchoMiddleware - Echo Middleware with golang

EchoMiddleware middleware for echo server usage import ( "github.com/universe-3

universe30 0 Jan 4, 2022
A quick and easy way to setup a RESTful JSON API

Go-Json-Rest A quick and easy way to setup a RESTful JSON API Go-Json-Rest is a thin layer on top of net/http that helps building RESTful JSON APIs ea

Antoine Imbert 3.5k May 3, 2022
TeslaMateApi is a RESTful API to get data collected by self-hosted data logger TeslaMate in JSON

TeslaMateApi is a RESTful API to get data collected by self-hosted data logger TeslaMate in JSON.

Tobias Lindberg 43 May 11, 2022
This project demonstrates a simple RESTful API built with Go and Chi.

Go and chi RESTful API This project demonstrates a simple RESTful API built with Go and chi. This API provides the following endpoints: GET / - Verify

newline: sandboxes 18 Apr 12, 2022
An example repo for RESTful API with swagger docs & unit testing

go REST API An example repo for RESTful API with swagger docs & unit testing Starting development server Copy .env.example to .env in the same directo

Rishabh Pandey 0 Nov 5, 2021
An restful api that uses CRUDL to support user endpoints. Stores the users in mysqlite. Creates 10 users when the program starts.

UserAPI An restful api that uses CRUDL to support user endpoints. Stores the users in mysqlite. Creates 10 users when the program starts. How to start

Nazar Trut 0 Nov 26, 2021
GateCracker-REST - A RESTful API example for simple lock model information application with Go

Go Lock Models REST API Example A RESTful API example for simple lock model info

Yunus AYDIN 18 Feb 2, 2022