Skip to content

ExchangeDiary/exchange-diary

Repository files navigation

exchange-diary

exchange-diary backend server

Structure

Domain Driven Design (Hexagonal architecture)

├── application         // same as interface layer in hexagonal architecture
│   ├── cmd             // command line interface
│   ├── controller      // http controller
│   ├── middleware      // middleware that handles requests
│   └── route           // http route, which delegate impl to controller
├── domain   // domain layer in hexagonal architecture, never have any external dependencies
│   ├── entity  // entity in domain layer
│   ├── repository  // interface of persistence layer
│   └── service     // domain service layer
└── infrastructure  // handle external dependencies
    ├── configs     // every configs include gin framework
    └── persistence // impl of persistence layer

GOLDEN_RULE: domain/ 에는 외부 dependency가 들어오지 않는다.

  • application/: application layer
    • 원래는 interface라고 명칭을 가져가야 하지만, 코드의 interface와 명칭이 중복되어, application 영역으로 명시함.
    • hexagonal에서 application service layer + interface layer의 코드가 들어있음
  • domain/: domain layer
  • infrastructure/: infra layer

Precommit-hook

refs

.zshrc or .bashrc

  • go mod를 사용할 경우
... 중략 ...
export PATH="$PATH:$HOME/go/bin"
export GO111MODULE=on
$ go install golang.org/x/tools/cmd/goimports
$ go install golang.org/x/lint/golint

$ cp pre-commit.example .git/hooks/pre-commit
$ chmod +x .git/hooks/pre-commit

Cmd

local

  • go run + local mysql db
$ make run
$ make build
$ make docker
$ make clean

$ ./bin/exchange-diray -phase=${phase}

sandbox

  • local docker api server image + google cloud sql
$ make down && make up

prod

  • google cloud run + google cloud sql (same as sandbox db)
  • trigger (cloud build)
    • push to /main branch

Deploy env

  • api server: google cloud run
  • static server: google cloud storage FUSE
  • db: google cloud sql
  • ci / cd: Cloud Code & Cloud Build
  • devops
    • Cloud Monitoring
    • Cloud Logging
    • Cloud Trace

Phase

Erd

voda v1 erd

Room flow

CRUD

다이어리방 생성 / 읽기 / 업데이트 / 나가기 관련 플로우

room crud api

ETC

crud를 제외한 나머지 api 플로우

room etc

Diary flow

다이어리 관련된 플로우

diary api