- Backend repository
- traPtitech/traPortfolio (this repository)
- Frontend repositories
- Go 1.22.5 or later
- Docker 27.1.0 or later
- Docker Compose 2.22.0 or later
docker compose up # --build -d
or
# enable live reload
docker compose watch
Now you can access to
- http://localhost:1323 for backend server.
- http://localhost:3001 for adminer
- username:
root
- password:
password
- database:
portfolio
- port:
3306
- username:
If you want to contribute to traPortfolio, then follow these pages.
Usable tasks are below.
Tip
You can use xc
to run the following tasks easily.
See https://xcfile.dev for more details.
go install github.com/joerdav/xc/cmd/xc@latest
Generate code.
go generate -x ./...
Run linter (golangci-lint).
go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest run --fix ./...
Run unit tests.
go test -v -cover -race ./internal/...
Run integration tests.
go test -v -cover -race ./integration_tests/...
Run all tests.
Requires: test:unit, test:integration
RunDeps: async
Migrate the database.
# TODO: use environment variables for config
docker compose run --build --entrypoint "/traPortfolio -c /opt/traPortfolio/config.yaml --db-host mysql --only-migrate" backend
Generate database schema documentation with tbls.
Requires: db:migrate
rm -rf ./docs/dbschema
go run github.com/k1LoW/tbls@latest doc
Lint the database schema with tbls.
Requires: db:migrate
go run github.com/k1LoW/tbls@latest lint
Lint the OpenAPI schema with Spectral.
docker run --rm -it -w /tmp -v $PWD:/tmp stoplight/spectral:latest lint ./docs/swagger/traPortfolio.v1.yaml