All Projects → Fs02 → go-todo-backend

Fs02 / go-todo-backend

Licence: MIT license
Go Todo Backend example using modular project layout for product microservice.

Programming Languages

go
31211 projects - #10 most used programming language
Dockerfile
14818 projects
Makefile
30231 projects

Projects that are alternatives of or similar to go-todo-backend

Project Layout
Standard Go Project Layout
Stars: ✭ 28,275 (+15874.58%)
Mutual labels:  project-template, project-structure
project-template
Sample Go Project Template (based on the layout from the Standard Project Layout repo)
Stars: ✭ 81 (-54.24%)
Mutual labels:  project-template, project-structure
ugly-todo
Just an Ugly To-Do app that I wanted to develop.
Stars: ✭ 35 (-80.23%)
Mutual labels:  todolist
typijs
The Angular CMS Framework for building fully-featured SPA sites powered by NodeJS and MongoDB with TypeScript
Stars: ✭ 141 (-20.34%)
Mutual labels:  modular
VoxelGamesLib
Multi-platform, fully-featured, data-driven, abstract and expendable minecraft minigames framework
Stars: ✭ 15 (-91.53%)
Mutual labels:  modular
RPGenie
A set of tools to help you develop RPG games in Python
Stars: ✭ 27 (-84.75%)
Mutual labels:  modular
pio
Low-level package that provides an easy way to centralize different output targets. Supports colors and text decoration to all popular terminals
Stars: ✭ 21 (-88.14%)
Mutual labels:  modular
cubic
📦 Easy to scale, zero-config, real-time focused app platform for node.js
Stars: ✭ 16 (-90.96%)
Mutual labels:  modular
PexWallpapers
Android application following best practices: Jetpack, Jetpack Compose, Modularity, Clean Architecture, Kotlin Coroutines, Tests, MVVM, DI, Static Analysis
Stars: ✭ 86 (-51.41%)
Mutual labels:  modular
Eurorack
Eurorack modules designed by Lorenz Neumann
Stars: ✭ 28 (-84.18%)
Mutual labels:  modular
lightning-hydra-template
PyTorch Lightning + Hydra. A very user-friendly template for rapid and reproducible ML experimentation with best practices. ⚡🔥⚡
Stars: ✭ 1,905 (+976.27%)
Mutual labels:  project-structure
modular
Scaffold a react monorepo and its component parts.
Stars: ✭ 13 (-92.66%)
Mutual labels:  modular
meerk40t
Hackable Laser software for the K40 Stock-LIHUIYU laser boards.
Stars: ✭ 133 (-24.86%)
Mutual labels:  modular
flutter-todo-list-tutorial
✅ A detailed example/tutorial building a cross-platform Todo List App using Flutter 🦋
Stars: ✭ 60 (-66.1%)
Mutual labels:  todolist
Core-iOS-Application-Architecture
Core iOS Application Architecture - The development paradigm of clean, testable code and modular iOS applications. + Xcode templates
Stars: ✭ 123 (-30.51%)
Mutual labels:  modular
insobot
C99 modular IRC bot with markov chains
Stars: ✭ 71 (-59.89%)
Mutual labels:  modular
vuejs-workshop
Repositório responsável pelos workshops de Vue.js com Azure App Service
Stars: ✭ 23 (-87.01%)
Mutual labels:  todolist
taro-weapp
🎮一款提供餐桌,酒桌上小游戏的小程序。
Stars: ✭ 28 (-84.18%)
Mutual labels:  todolist
core
Platform for rapid application development.
Stars: ✭ 31 (-82.49%)
Mutual labels:  modular
kedro-starters
Templates for your Kedro projects.
Stars: ✭ 39 (-77.97%)
Mutual labels:  project-template

go-todo-backend

GoDoc Build Status Go Report Card Maintainability Test Coverage

Go Todo Backend Example Using Modular Project Layout for Product Microservice. It's suitable as starting point for a medium to larger project.

This example uses Chi for http router and REL for database access.

Feature:

  • Modular Project Structure.
  • Full example including tests.
  • Docker deployment.
  • Compatible with todobackend.

Installation

Prerequisite

  1. Install mockery for interface mock generation.
  2. Install rel cli for database migration.

Running

  1. Prepare .env.
    cp .env.sample .env
    
  2. Start postgresql and create database.
    docker-compose up -d
    
  3. Prepare database schema.
    rel migrate
    
  4. Build and Running
    make
    

Project Structure

.
├── api
│   ├── handler
│   │   ├── todos.go
│   │   └── [other handler].go
│   └── middleware
│       └── [other middleware].go
├── bin
│   ├── api
│   └── [other executable]
├── cmd
│   ├── api
│   │   └── main.go
│   └── [other cmd]
│       └── main.go
├── db
│   ├── schema.sql
│   └── migrations
│       └── [migration file]
├── todos
│   ├── todo.go
│   ├── create.go
│   ├── update.go
│   ├── delete.go
│   ├── service.go
│   └── todostest
│       ├── todo.go
│       └── service.go
├── [other domain]
│   ├── [entity a].go
│   ├── [business logic].go
│   ├── [other domain]test
│   │   └── service.go
│   └── service.go
└── [other client]
    ├── [entity b].go
    ├── client.go
    └── [other client]test
        └── client.go

This project structure is based on a modular project structure, with loosely coupled dependencies between domain, Think of making libraries under a single repo that only exports certain functionality that used by other service and http handler. One of domain that present in this example is todos.

Loosely coupled dependency between domain is enforced by avoiding the use of shared entity package, therefore any entity struct should be included inside it's own respective domain. This will prevent cyclic dependency between entity. This shouldn't be a problem in most cases, becasause if you encounter cyclic dependency, there's huge chance that the entity should belongs to the same domain.

For example, consider three structs: user, transaction and transaction items. transaction and its transaction items might need cyclic dependency and items doesn't works standalone (items without transaction should not exists), thus it should be on the same domain. In the other hand, user and transaction shouldn't require cyclic dependency, transaction might have a user field in the struct, but user shouldn't have a slice of transaction field, therefore it should be on a separate domain.

Domain vs Client

Domain and Client folder is very similar, the difference is client folder doesn't actually implement any business logic (service), but instead a client that calls any internal/external API to works with the domain entity.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].