Skip to content

no-de-lab/nodelab-server

Repository files navigation

Nodelab API

Actions Status golangci-lint codecov

Tech stack

  • Golang
  • MySQL
  • AWS ECS
  • GraphQL

Core dependency

  • echo
    • Web framework
  • sqlx
    • Database entity mapping
  • wire
    • Dependency injection
  • viper
    • Manage configuration
  • model
    • DTO & entity mapping

Structure

pre-commit

Install pre-commit (https://pre-commit.com/)

brew install pre-commit

Run install command (project root)

pre-commit install

Setup

# install go1.15
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)

# install go 1.7 (binary install)
gvm install go1.7 -B
gvm use go1.7

# install go 1.15
gvm install go1.15

# run main
make run

Run with docker-compose

# local database create & run with air
$ make up

# cleanup container & local data
$ make down

Make command

  • test
    • run all test
  • run
    • run main
  • vendor
    • install dependencies
  • up
    • run with docker-compose for development
  • down
    • remove all container
    • remove with docker named volume (local data)
  • wire
    • make wire_gen
  • build
    • build for production
  • build-air
    • build for air

DB Migration

To migrate up, use positive number of steps To migrate down, use negative number of steps

go run ./cmd/migrate/main.go -steps=NUMBER_OF_STEPS

App Configuration

# for db connection
[database]
host = "mysql"
database = "nodelab"
username = "nodelab"
password = "test"

# context timeout
[context]
timeout = 2

# etc
# ...

Appendix

Design and Planning Docs

Workflow

  • Choose an issue to work on from server project board
  • Create a branch type/#issue/short_description_of_issue from dev branch
  • Work on branch and make a PR (PR review is required)
  • If no review is received within 2 days, you are free to merge to dev

Semantic Commit messages

  • feat: ⚡ 새로운 기능 (issue 번호 달 것)
  • fix: 🐛 버그 수정
  • refactor: 🔨 기능을 추가하지 않는 코드 변경
  • chore: 📦 src 또는 테스트 파일을 수정하지 않는 기타 변경 사항
  • docs: 📚 문서만 변경
  • style: 👕 코드의 의미에 영향을 미치지 않는 변경 사항 (공백, 서식, 누락 된 세미콜론 등)
  • test: 🚨 테스트 케이스 추가
  • deploy: 🚀

Database Schema

About

go application with echo, graphql, sqlx

Resources

Stars

Watchers

Forks

Languages