A simple note service built with Kitex
and Hertz
which is divided into three microservices.
Service Name | Usage | Framework | protocol | Path | IDL |
---|---|---|---|---|---|
demoapi | HTTP interface | kitex/hertz | http | cmd/api | idl/api.thrift |
demouser | user data management | kitex/gorm | thrift | cmd/user | idl/user.thrift |
demonote | note data management | kitex/gorm | thrift | cmd/note | idl/note.thrift |
- Hertz
- Use
thrift
IDL to define HTTP interface - Use
hz
to generate server/client code - Use
Hertz
binding and validate - Use
obs-opentelemetry
andjarger
fortracing
,metrics
,logging
- Middleware
- Use
requestid
,jwt
,recovery
,pprof
,gzip
- Use
- Use
- Kitex
- Use
thrift
IDL to defineRPC
interface - Use
kitex
to generate code - Use
thrift-gen-validator
for validating RPC request - Use
obs-opentelemetry
andjarger
fortracing
,metrics
,logging
- Use
registry-etcd
for service discovery and register
- Use
catalog | introduce |
---|---|
hertz_handler | HTTP handler |
service | business logic |
rpc | RPC call logic |
dal | DB operation |
pack | data pack |
pkg/mw | RPC middleware |
pkg/consts | constants |
pkg/errno | customized error number |
pkg/configs | SQL and Tracing configs |
catalog | command |
---|---|
hertz_api_model | make hertz_gen_model |
hertz_api_client | make hertz_gen_client |
kitex_user_client | make kitex_gen_user |
kitex_note_client | make kitex_gen_note |
hertz_api_new | cd cmd/api && make hertz_new_api |
hertz_api_update | cd cmd/api && make hertz_update_api |
kitex_user_server | cd cmd/user && make kitex_gen_server |
kitex_note_server | cd cmd/note && make kitex_gen_server |
docker-compose up
cd cmd/user
sh build.sh
sh output/bootstrap.sh
cd cmd/note
sh build.sh
sh output/bootstrap.sh
cd cmd/api
sh build.sh
sh output/bootstrap.sh
Visit http://127.0.0.1:16686/
on browser
Visit http://127.0.0.1:3000/
on browser
cd api_request
go run main.go -action register
cd api_request
go run main.go -action login
cd api_request
go run main.go -action createNote
cd api_request
go run main.go -action queryNote
cd api_request
go run main.go -action updateNote
cd api_request
go run main.go -action deleteNote