1- # go-url-shortener-ddd
1+ # go-tiny-url
22
3- [ ![ Linting] ( https://github.com/xgmsx/go-url-shortener-ddd /actions/workflows/golangci-lint.yml/badge.svg?branch=main )] ( https://github.com/xgmsx/go-url-shortener-ddd /actions/workflows/golangci-lint.yml )
4- [ ![ Tests] ( https://github.com/xgmsx/go-url-shortener-ddd /actions/workflows/coverage.yml/badge.svg?branch=main )] ( https://github.com/xgmsx/go-url-shortener-ddd /actions/workflows/coverage.yml )
5- [ ![ CodeQL] ( https://github.com/xgmsx/go-url-shortener-ddd /actions/workflows/codeql.yml/badge.svg?branch=main )] ( https://github.com/xgmsx/go-url-shortener-ddd /actions/workflows/codeql.yml )
6- [ ![ Coverage_Report] ( https://img.shields.io/badge/Coverage_Report-30.8 %25-yellow )] ( https://xgmsx.github.io/go-url-shortener-ddd )
3+ [ ![ Linting] ( https://github.com/xgmsx/go-tiny-url /actions/workflows/golangci-lint.yml/badge.svg?branch=main )] ( https://github.com/xgmsx/go-tiny-url /actions/workflows/golangci-lint.yml )
4+ [ ![ Tests] ( https://github.com/xgmsx/go-tiny-url /actions/workflows/coverage.yml/badge.svg?branch=main )] ( https://github.com/xgmsx/go-tiny-url /actions/workflows/coverage.yml )
5+ [ ![ CodeQL] ( https://github.com/xgmsx/go-tiny-url /actions/workflows/codeql.yml/badge.svg?branch=main )] ( https://github.com/xgmsx/go-tiny-url /actions/workflows/codeql.yml )
6+ [ ![ Coverage_Report] ( https://img.shields.io/badge/Coverage_Report-57.9 %25-yellow )] ( https://xgmsx.github.io/go-tiny-url )
77
8- ** go-url-shortener-ddd ** — это сокращатель ссылок на Go, реализованный с использованием архитектурного подхода Domain-Driven Design (DDD) .
8+ Проект для демонстрации разработки на Golang с использованием gRPC, REST HTTP, Kafka, Postgres, Observability, Unit-testing .
99
1010Структура:
1111* [ internal] ( internal ) содержит пакеты относящиеся к проекту - app, config, shortener.
@@ -35,8 +35,8 @@ Table of Contents:
3535<div class =" termy " >
3636
3737``` console
38- git clone https://github.com/xgmsx/go-url-shortener-ddd
39- cd go-url-shortener-ddd
38+ git clone https://github.com/xgmsx/go-tiny-url
39+ cd go-tiny-url
4040cp ./configs/.env_example ./configs/.env
4141cd ./configs/.env_localhost_example ./configs/.env_localhost
4242```
@@ -45,61 +45,56 @@ cd ./configs/.env_localhost_example ./configs/.env_localhost
4545
4646## Quick start
4747
48- #### Запуск сервиса с зависимостями (postgres, redis, kafka, jaeger, prometheus, grafana) в Docker:
48+ #### Установка инструментов для разработки
4949
50- <div class =" termy " >
50+ ``` shell
51+ make install
52+ ```
5153
52- ``` console
53- $ docker compose up -d --build
54+ Проверка работы установленных инструментов:
5455
55- ✔ Network go-url-shortener-ddd_default Created 0.1s
56- ✔ Container go-url-shortener-ddd-app-1 Started 0.4s
57- ✔ Container go-url-shortener-ddd-postgres-1 Started 0.2s
58- ✔ Container go-url-shortener-ddd-redis-1 Started 0.2s
59- ✔ Container go-url-shortener-ddd-redis-ui-1 Started 0.2s
60- ✔ Container go-url-shortener-ddd-kafka-1 Started 0.2s
61- ✔ Container go-url-shortener-ddd-kafka-init-1 Started
62- ✔ Container go-url-shortener-ddd-kafka-ui-1 Started 0.3s
56+ ``` shell
57+ make generate
58+ make fmt
59+ make lint
6360```
6461
65- </div >
66-
67- #### Локальный запуск сервиса в Linux и MacOS:
62+ #### Запуск сервиса с зависимостями (postgres, redis, kafka, jaeger, prometheus, grafana) в Docker
6863
6964<div class =" termy " >
7065
7166``` console
72- $ export $( grep -v ' ^# ' ./configs/.env_localhost | xargs ) && go run ./cmd/app
67+ $ docker compose up -d --build
7368
74- 2025/01/01 12:00:00 maxprocs: Leaving GOMAXPROCS=8: CPU quota undefined
75- 12:00:00 INF Logger initialized
76- 12:00:00 INF App starting...
77- 12:00:00 INF Sentry is disabled
78- 12:00:00 INF Tracer is disabled
79- 12:00:00 INF HTTP server started on port: 8000
80- 12:00:00 INF gRPC server started on port: 50051
81- 12:00:00 INF Kafka consumer started
82- 12:00:00 INF App started
69+ ✔ Network go-tiny-url_default Created 0.1s
70+ ✔ Container go-tiny-url-app-1 Started 0.4s
71+ ✔ Container go-tiny-url-postgres-1 Started 0.2s
72+ ✔ Container go-tiny-url-redis-1 Started 0.2s
73+ ... 0.3s
8374```
8475
8576</div >
8677
87- #### Локальный запуск сервиса в Windows Git Bash:
78+ #### Локальный запуск сервиса в Linux и MacOS
79+
80+ <div class =" termy " >
8881
8982``` console
83+ # Linux, MacOS
84+ $ export $( grep -v ' ^#' ./configs/.env_localhost | xargs) && go run ./cmd/app
85+
86+ # Windows Git Bash
9087$ env $( grep -v ' ^#' ./configs/.env_localhost | xargs) go run ./cmd/app
9188
92892025/01/01 12:00:00 maxprocs: Leaving GOMAXPROCS=8: CPU quota undefined
939012:00:00 INF Logger initialized
949112:00:00 INF App starting...
95- 12:00:00 INF Sentry is disabled
96- 12:00:00 INF Tracer is disabled
97- 12:00:00 INF HTTP server started on port: 8000
98- 12:00:00 INF gRPC server started on port: 50051
99- 12:00:00 INF Kafka consumer started
92+ ...
1009312:00:00 INF App started
10194```
10295
96+ </div >
97+
10398## Usage
10499
105100#### Migrations
@@ -187,7 +182,7 @@ $ grpcurl -d '{"url": "https://google.com"}' -plaintext localhost:50051 shortene
187182
188183Получение полной ссылки:
189184``` shell
190- $ grpcurl -d ' {"alias": "IFIYr0OGRKeqF9jPUIbwww"}' -plaintext localhost:50051 shortener_v1.Shortener/GetLink
185+ $ grpcurl -d ' {"alias": "IFIYr0OGRKeqF9jPUIbwww"}' -plaintext localhost:50051 shortener_v1.Shortener/FetchLink
191186
192187# {"url": "https://google.com", "alias": "IFIYr0OGRKeqF9jPUIbwww", "expired_at": "2025-01-02T12:00:00.000000000Z"}
193188```
0 commit comments