{"id":13590285,"url":"https://github.com/CyanAsterisk/FreeCar","last_synced_at":"2025-04-08T13:30:57.027Z","repository":{"id":64887628,"uuid":"574985563","full_name":"CyanAsterisk/FreeCar","owner":"CyanAsterisk","description":"Time-sharing car rental system suite based on CloudWeGo series framework","archived":false,"fork":false,"pushed_at":"2024-12-12T03:39:32.000Z","size":10442,"stargazers_count":253,"open_issues_count":5,"forks_count":44,"subscribers_count":1,"default_branch":"dev","last_synced_at":"2024-12-12T04:25:24.508Z","etag":null,"topics":["cloudnative","cloudwego","distributed","go","hertz","kitex","microservice"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CyanAsterisk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":"L2ncE","issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2022-12-06T14:02:09.000Z","updated_at":"2024-12-12T03:39:37.000Z","dependencies_parsed_at":"2023-02-19T14:45:33.884Z","dependency_job_id":"f68d26f8-7298-4b68-9192-b91fb26011fc","html_url":"https://github.com/CyanAsterisk/FreeCar","commit_stats":{"total_commits":360,"total_committers":5,"mean_commits":72.0,"dds":0.5361111111111111,"last_synced_commit":"8a8974f6b05badec0e9a10b107529da2f9f0fea6"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":"CyanAsterisk/.github","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyanAsterisk%2FFreeCar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyanAsterisk%2FFreeCar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyanAsterisk%2FFreeCar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyanAsterisk%2FFreeCar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CyanAsterisk","download_url":"https://codeload.github.com/CyanAsterisk/FreeCar/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247851454,"owners_count":21006762,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloudnative","cloudwego","distributed","go","hertz","kitex","microservice"],"created_at":"2024-08-01T16:00:42.810Z","updated_at":"2025-04-08T13:30:52.016Z","avatar_url":"https://github.com/CyanAsterisk.png","language":"Go","funding_links":["https://liberapay.com/L2ncE"],"categories":["Go"],"sub_categories":[],"readme":"![FreeCar](img/FreeCar.png)\n\nEnglish | [中文](README_zh.md)\n\nFreeCar is a cloud-native time-sharing car rental system suite based on [Hertz](https://github.com/cloudwego/hertz) and [Kitex](https://github.com/cloudwego/kitex).\n\n## Project Architecture\n\n### Call Relationship\n\n![call_relations.png](img/call_relation.png)\n\n### Technology Architecture\n\n![tech_arch](img/tech_arch.png)\n\n### Service Relations\n\n![service_relations.png](img/service_relations.png)\n\n## Technology Stack\n\n| Function                         | Implementation        |\n|----------------------------------|-----------------------|\n| HTTP Framework                   | Hertz                 |\n| RPC Framework                    | Kitex                 |\n| Database                         | MongoDB, MySQL, Redis |\n| Authentication                   | Paseto                |\n| Service and Configuration Center | Consul                |\n| Metrics Monitoring               | Prometheus            | \n| Tracing                          | Jaeger                |\n| Message Queue                    | RabbitMQ              |\n| Service Governance               | OpenTelemetry         |\n| Current Limiting Fuse            | Sentinel              |\n| Object Storage                   | MinIO                 |\n| Image Recognition                | Baidu OCR             |\n| CI                               | GitHub Actions        |\n\n## Display\n\n### Mini Program\n\nMini program project address [FreeCar-MP](https://github.com/CyanAsterisk/FreeCar-MP)\n\n![display.png](img/display.png)\n\n### Admin\n\nAdmin project address [FreeCar-Admin](https://github.com/CyanAsterisk/FreeCar-Admin)\n\n![data-analize.png](img/data-analize.png)\n\n![back.png](img/back.png)\n\n## Catalog Introduce\n\n| Catalog | Introduction                             |\n|---------|------------------------------------------|\n| Cmd     | Project Core                             |\n| Idl     | IDL file for all services of the project |\n| Shared  | Reusable Code                            |\n\n## Service Introduce\n\n| Catalog | Introduction                                       |\n|---------|----------------------------------------------------|\n| API     | Hertz-based gateway service                        |\n| User    | User Authentication Service                        |\n| Blob    | Services related to image and MinIO object storage |\n| Car     | Car Service                                        |\n| Profile | Home Page and Image Recognition Service            |\n| Trip    | Itinerary Services                                 |\n\n## Quick start\n\n### Start the Dependence\n\n```shell\nmake start\n```\n\n### Consul\n\n\u003e For the default Consul address and KV configuration, please refer to each `config.yaml` configuration file.\n\n![consul_service.png](img/consul_service.png)\n\n![consul_kv.png](img/consul_kv.png)\n\nFor detailed configuration of KV key-value pairs, [see](docs/CONSUL_CONFIG.md).\n\n### Start HTTP\n\n```shell\nmake api\n```\n\n### Start RPC\n\n```shell\nmake user\nmake blob\nmake car\nmake profile\nmake trip\n```\n\n### Jaeger\n\n\u003e Visit `http://127.0.0.1:16686/` on your browser\n\n![jaeger.jpg](img/jaeger.png)\n\n![jaeger2.png](img/jaeger2.png)\n\n### Prometheus\n\n\u003e Visit `http://127.0.0.1:3000/` on your browser\n\n![prometheus.jpg](img/prometheus.png)\n\n### MinIO\n\n\u003e Visit `http://127.0.0.1:9000/` on your browser\n\n![minio.jpg](img/minio.png)\n\n## K8s Deployment\n\n```shell\ncd deployment/freecar-k8s\nmake all\n```\n\n### Pod\n\n![pod.png](img/pod.png)\n\n### PVC\n\n![pvc.png](img/pvc.png)\n\n### Service\n\n![service.png](img/service.png)\n\n## Development Guide\n\nIt is very difficult to understand this project by directly reading the source code. Here is a development guide for\ndevelopers to quickly understand and get started with this project, including frameworks such as Kitex and Hertz.\n\n### Preparation\n\nUse the commands in the quick start to quickly start the required tools and environment. If you need special\ncustomization, please modify the contents of `docker-compose.yaml` and Nacos configuration.\n\n### IDL\n\nBefore development, we need to define the IDL file, among which hz provides developers with many\ncustomized [api annotations](https://www.cloudwego.io/zh/docs/hertz/tutorials/toolkit/usage/annotation/#%E6%94%AF%E6%8C%81%E7%9A%84-api-%E6%B3%A8%E8%A7%A3).\n\nSample code:\n\n```thrift\nnamespace go user\n\nstruct LoginRequest {\n     1: string code\n}\n\nstruct LoginResponse {\n     1: i64 accountID\n}\n\nservice UserService {\n     LoginResponse Login(1: LoginRequest req)\n}\n```\n\n### Code Generation\n\n#### Kitex\n\nFirst generate `kitex_gen` in the `shared` folder, and then rely on `kitex_gen` in the corresponding service folder to\ngenerate. Execute under the new service directory, only need to change the service name and IDL path each time.\n\n```shell\nkitex -module github.com/CyanAsterisk/FreeCar ./../idl/rpc/user.thrift\nkitex -service user -module github.com/CyanAsterisk/FreeCar -use github.com/CyanAsterisk/FreeCar/server/shared/kitex_gen ./../../idl/rpc/user.thrift\n```\n\nNote:\n\n- Use `-module github.com/CyanAsterisk/FreeCar` This parameter is used to specify the Go module to which the generated\n  code belongs to avoid path problems.\n- When the current service needs to call other services, it needs to rely on `kitex_gen`.\n\n#### Hertz\n\n##### Initialize\n\n```shell\nhz new -idl ./../../idl/api.proto -mod github.com/CyanAsterisk/FreeCar/server/cmd/api\n```\n\nNote:\n\n- Use `-module github.com/CyanAsterisk/FreeCar/server/cmd/api` This parameter is used to specify the Go module to which\n  the generated code belongs to avoid path problems.\n\n### Business Development\n\nAfter the code is generated, some necessary components need to be added to the project. Since the api layer does not\nneed to be added again, the following mainly explains about Kitex-Server\nsection, the code is located under `server/cmd`.\n\n#### Config\n\nRefer to `server/cmd/user/config` for the configuration structure of microservices.\n\n#### Initialize\n\nRefer to `server/cmd/user/initialize` to provide the initialization function of the necessary components, among\nwhich `config.go` `registry.go` `flag.go` `logger.go` are required.\n\n#### Pkg\n\nRefer to `server/cmd/user/pkg` to provide calling functions of microservices, which are mainly used to implement the\ninterfaces defined in `handler.go`.\n\n#### API\n\nWhen writing the business logic of the gateway layer, you only need to update the IDL and the new microservice client\ncode each time. If you need to add new components, you can add them directly. The project is highly pluggable, and the\narchitecture is similar to the microservice layer.\n\nThe business logic of the gateway layer is under `server/cmd/api/biz`, and most of the code will be automatically\ngenerated. If you need to add a new route separately, you need to go to `server/cmd/api/router.go`.\n\nRegarding the use of middleware, you only need to add middleware logic in `server/cmd/api/biz/router/api/middleware.go`.\n\n## License\n\nFreeCar is open source under the GNU General Public License version 3.0.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCyanAsterisk%2FFreeCar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCyanAsterisk%2FFreeCar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCyanAsterisk%2FFreeCar/lists"}