Implementing back-end services for blog application

Overview

Go Blog API

Real-world examples implementing back-end services for blog application using Go programming language to build RESTful API, all routes and API documentation can be found at {{base_url}}/swagger/index.html

Architecture

This project using Clean Architecture with 4 domain layers:

  • Model
  • Repository
  • Service
  • Handler

Features

  • API Documentation Swagger (auto generate)
  • Command line options
  • Authentication Json Web Token
  • CRUD operations MySQL / MariaDB (raw sql)
  • Caching Redis
  • Pagination, URL query search, etc
  • Environment variables config
  • Database Migrations, Rollbacks, Steps, Drop, etc
  • Validation data request
  • Middlewares CORS, Rate Limit, Logger, Recover, Custom, etc
  • Graceful shutdown
  • Many more...

System Requirements

  • Golang
  • Docker
  • MySQL / MariaDB (included in docker compose)
  • Redis (included in docker compose)

Running

Setting up all containers

$ make compose.up

Applying all up migrations and start the server

$ make launch

Destroy

Applying all down migrations

$ make rollbacks

Destroy running containers

$ make compose.down

Delete all volumes that doesn't used

$ docker volume prune

Environment Variables

Key Type Value (Example)
APP_PORT int 1401
HTTP_RATE_LIMIT_REQUEST int 100
HTTP_RATE_LIMIT_TIME duration 1s
JWT_SECRET_KEY string secret
JWT_TTL duration 48h
PAGINATION_LIMIT int 100
MYSQL_USER string admin
MYSQL_PASSWORD string secret
MYSQL_HOST string localhost
MYSQL_PORT int 3306
MYSQL_DATABASE string test
MYSQL_MAX_IDLE_CONNS int 5
MYSQL_MAX_OPEN_CONNS int 10
MYSQL_CONN_MAX_LIFETIME duration 30m
REDIS_PASSWORD string secret
REDIS_HOST string localhost
REDIS_PORT int 6379
REDIS_DATABASE int 0
REDIS_POOL_SIZE int 10
REDIS_TTL duration 1h
You might also like...
Hexya business application development framework

Hexya Hexya is an open source ERP and a business application development framework written in Go. This repository houses the business application deve

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

golang library for creating web application

RUI library The RUI (Remoute User Interface) library is designed to create web applications in the go language. The peculiarity of the library is that

Template/Starter code for Go application with Gin, System Tray, Gorm, Air, Swagger, JWT

gin-systray-starter Starter code for Go application with Gin, System Tray, Gorm, Air, Swagger, JWT systray, https://github.com/getlantern/systray gin,

GoFarm is an Application Development Framework for especially Backend Developer with Golang

What is GoFarm GoFarm is an Application Development Framework for especially Backend Developer with Golang. Our goal is to develop easier, standardize

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

A web application framework with complete functions and good scalability
A web application framework with complete functions and good scalability

English | 中文 Abuout Goravel Goravel is a web application framework with complete

GateCracker-REST - A RESTful API example for simple lock model information application with Go
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

Year-end-review - enables those want to look back on PRs at the end of year to review PRs and the comments as single Markdown file.

year-end-review year-end-review enables those want to look back on PRs at the end of year to review PRs and the comments as single Markdown file. HOW

Beautifully simple single author blog in Go - derived from Bear Blog.
Beautifully simple single author blog in Go - derived from Bear Blog.

Polar Bear Blog 🐻‍❄️ Lightweight blogging system for a single author. Written in Go and deploys to your own GCP project with a few commands. It's a d

Golang && Back-end Stack , Continually updated

Stack Here Golang OS Net Note Tool Delve Authentication Paper Paper 📚 Link GO官方文档 GO Official Doc GO官方博客 GO Official Blog GO官方仓库

Teste prático para vaga de back-end Python / Go na Stone.

Stone_GitHub_API_Golang Teste prático para vaga de back-end Python / Go na Stone. Nota 1: Utilizar a branch Release Nota 2: É necessário adicionar o T

Repository belajar docker ALTA Immerseive Back-End Batch 4

Belajar Docker Repository belajar docker ALTA Immerseive Back-End Batch 4 Untuk materi ini teman-teman bisa download docker sesuai dengan OS masing-ma

Project E-Commerce Alta Store Program Immersive Back End Batch 4
Project E-Commerce Alta Store Program Immersive Back End Batch 4

Project E-Commerce Project E-Commerce Alta Store Program Immersive Back End Batch 4 Explore the docs » Daftar Isi About The Project Built With ERD Con

A go program that relies on back-end ffmpeg to process video-related content

Video Compress A go program that relies on back-end ffmpeg to process video-related content Installation v-go You can download the corresponding v-go

Desafio 1 da trilha de estágio em back end go da Stone

desafio_estagio_1 Desafio 1 da trilha de estágio em back end go da Stone. Neste desafio as entradas são uma lista de items e uma lista de e-mails. Cri

Discord-finder - The back-end for retrieving information about people on discord
Discord-finder - The back-end for retrieving information about people on discord

About This is the backend application for Discord Finder, it allows you to retrive information about people on discord just like the discord lookup we

Back end of e-books and papers collection website. Only for internal use.

Back end of e-books and papers collection website. Only for internal use.

Expressive end-to-end HTTP API testing made easy in Go

baloo Expressive and versatile end-to-end HTTP API testing made easy in Go (golang), built on top of gentleman HTTP client toolkit. Take a look to the

Owner
Achmad Chun-Chun Winata Adi
Software Engineer specialized in the back-end of an application, playing with server-side code and cloud technology
Achmad Chun-Chun Winata Adi
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 3 Aug 22, 2022
Flexible E-Commerce Framework on top of Flamingo. Used to build E-Commerce "Portals" and connect it with the help of individual Adapters to other services.

Flamingo Commerce With "Flamingo Commerce" you get your toolkit for building fast and flexible commerce experience applications. A demoshop using the

Flamingo 354 Sep 20, 2022
A REST framework for quickly writing resource based services in Golang.

What is Resoursea? A high productivity web framework for quickly writing resource based services fully implementing the REST architectural style. This

Resoursea 33 Sep 27, 2022
A Go framework for building JSON web services inspired by Dropwizard

Tiger Tonic A Go framework for building JSON web services inspired by Dropwizard. If HTML is your game, this will hurt a little. Like the Go language

Richard Crowley 1000 Sep 2, 2022
package for building REST-style Web Services using Go

go-restful package for building REST-style Web Services using Google Go Code examples using v3 REST asks developers to use HTTP methods explicitly and

Ernest Micklei 4.6k Sep 15, 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 86 Sep 14, 2022
lightweight, idiomatic and composable router for building Go HTTP services

chi is a lightweight, idiomatic and composable router for building Go HTTP services. It's especially good at helping you write large REST API services

go-chi 12.3k Sep 24, 2022
hiboot is a high performance web and cli application framework with dependency injection support

Hiboot - web/cli application framework About Hiboot is a cloud native web and cli application framework written in Go. Hiboot is not trying to reinven

hidevops.io 177 Aug 27, 2022
Mango is a modular web-application framework for Go, inspired by Rack, and PEP333.

Mango Mango is a modular web-application framework for Go, inspired by Rack and PEP333. Note: Not actively maintained. Overview Mango is most of all a

Paul Bellamy 370 Sep 27, 2022
GoFrame is a modular, powerful, high-performance and enterprise-class application development framework of Golang.

GoFrame English | 简体中文 GoFrame is a modular, powerful, high-performance and enterprise-class application development framework of Golang. If you're a

GoFrame 8.2k Sep 22, 2022