This project is code.id boilerplate to create API in Golang Echo Framework
- PORT : 3030
- PATH : /
# clone the repo
$ git clone
# go into app's directory
$ cd my-project
Local environment
# build
$ go build
# run in development
$ ENV=DEV go run main.go
$ ENV=DEV ./filego
# run in staging
$ ENV=STAGING go run main.go
$ ENV=STAGING ./filego
# run in production
$ ENV=PROD go run main.go
$ ENV=PROD ./filego
Docker environment
# build
$ docker build -t codeid-api:latest .
# config
sudo sysctl -w vm.max_map_count=262144 # it is required for elasticsearch config
# run
$ docker compose up
Install environment
# get swagger package
$ go get github.com/swaggo/swag
# move to swagger dir
$ cd $GOPATH/src/github.com/swaggo/swag
# install swagger cmd
$ go install cmd/swag
Generate documentation
# generate swagger doc
$ swag init --propertyStrategy snakecase
to see the results, run app and access {{url}}/swagger/index.html
This project built in clean architecture that contains :
- Http
- Factory
- Middleware
- Handler
- Binder
- Validation
- Service
- Repository
- Model
- Database
This project have some default function :
- Context
- Validator
- Transaction
- Pagination & Sort
- Filter
- Env
- Response
- Redis
- Elasticsearch
- Log
This project have some default endpoint :
- Auth
- Login
- Register
- Sample
- Get (with pagination, sort, & filter)
- GetByID
- Create (with transaction)
- Update (with transaction)
- Delete
CodeID Backend Team