Coder Social home page Coder Social logo

go-clean-architecture's Introduction

📝 Description

A REST API boilerplate

🎉 Features

  • TODOS: CRUD around TODOS

🧰 Installation

Prerequisites

  • go1.16
  • Docker

Install go packages and dependencies before continue

go install

Setting up PostgreSQL database

  • This is will make a new PostgreSQL running in the standard port 5432
  • Please shutdown any previous conflicting PostgreSQL instances before starting this
docker-compose up -d

Check the database is up

docker logs -f content_pg

Check that you can log into a database with psql

docker exec -it content_pg psql -U content_pg_user content_pg_db

View tables

\dt

⌨ Development

⚙ Running the app

go run main.go

# or air with live reload
air

🎮 Playground

After the application starts, go to http://localhost:$PORT/swagger/index.html to access swagger playground

Observartion: You must change $PORT for the port to be used in your environment

🧪 Running tests

Creating tests database Only integration tests are supported. Backend is spun up on a special database

Tests use their own database. To create it:

docker exec -it content_pg psql -U content_pg_user -c "create database content_pg_db_test" content_pg_db

Note that in backend/config/typeorm.config.ts the content_db_test database is configured to synchronize TypeORM migrations automatically, unlike the development database.

# unit tests
go test

📦 Building

Before building application to production, make sure environment variables are applied correctly

Building for production

go build

✅ TODO

  • Add environment variables
  • Add migrations to mongo-db-driver
  • Add optional parameters to swagger
  • Add bearer auth to swagger
  • Add unit tests
  • Add integration tests
  • Add e2e tests
  • Add log system
  • Add health check

Observation: Some TODOS are spread across the code and need to be fixed ASAP

🛠 Built with

  • go - Go is an open source programming language supported by Google

👷 Authors

See also the list of contributors who participated in this project

📝 License

Copyright © 2020 Lucas Silva
This project is MIT licensed

go-clean-architecture's People

Contributors

lucasmonstrox avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.