Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/go-kratos/kratos-layout
Kratos Project Template
https://github.com/go-kratos/kratos-layout
architecture golang kratos layout micorservices project service template
Last synced: 6 days ago
JSON representation
Kratos Project Template
- Host: GitHub
- URL: https://github.com/go-kratos/kratos-layout
- Owner: go-kratos
- License: mit
- Created: 2020-12-06T05:54:09.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-08-17T05:22:05.000Z (3 months ago)
- Last Synced: 2024-08-18T05:41:10.624Z (3 months ago)
- Topics: architecture, golang, kratos, layout, micorservices, project, service, template
- Language: Go
- Homepage: http://go-kratos.dev
- Size: 262 KB
- Stars: 396
- Watchers: 18
- Forks: 205
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Kratos Project Template
## Install Kratos
```
go install github.com/go-kratos/kratos/cmd/kratos/v2@latest
```
## Create a service
```
# Create a template project
kratos new servercd server
# Add a proto template
kratos proto add api/server/server.proto
# Generate the proto code
kratos proto client api/server/server.proto
# Generate the source code of service by proto file
kratos proto server api/server/server.proto -t internal/servicego generate ./...
go build -o ./bin/ ./...
./bin/server -conf ./configs
```
## Generate other auxiliary files by Makefile
```
# Download and update dependencies
make init
# Generate API files (include: pb.go, http, grpc, validate, swagger) by proto file
make api
# Generate all files
make all
```
## Automated Initialization (wire)
```
# install wire
go get github.com/google/wire/cmd/wire# generate wire
cd cmd/server
wire
```## Docker
```bash
# build
docker build -t .# run
docker run --rm -p 8000:8000 -p 9000:9000 -v :/data/conf
```