@@ -36,7 +36,7 @@ Using the principles of Robert Martin (aka Uncle Bob).
3636[ Go-clean-template] ( https://evrone.com/go-clean-template?utm_source=github&utm_campaign=go-clean-template ) is created &
3737supported by [ Evrone] ( https://evrone.com/?utm_source=github&utm_campaign=go-clean-template ) .
3838
39- This template implements three types of servers:
39+ This template implements four types of servers:
4040
4141- AMQP RPC (based on RabbitMQ as [ transport] ( https://github.com/rabbitmq/amqp091-go )
4242 and [ Request-Reply pattern] ( https://www.enterpriseintegrationpatterns.com/patterns/messaging/RequestReply.html ) )
@@ -55,11 +55,56 @@ All domains are available across all four transports (REST, gRPC, AMQP RPC, NATS
5555
5656## Content
5757
58+ - [ Domains] ( #domains )
5859- [ Quick start] ( #quick-start )
5960- [ Project structure] ( #project-structure )
6061- [ Dependency Injection] ( #dependency-injection )
6162- [ Clean Architecture] ( #clean-architecture )
6263
64+ ## Domains
65+
66+ The template includes three fully implemented domains, each available across all four transports (REST, gRPC, AMQP RPC, NATS RPC).
67+
68+ ### User Authentication
69+
70+ Registration, login, and JWT-based authorization.
71+
72+ | Operation | REST | gRPC |
73+ | -------------| --------------------------| --------------------------|
74+ | Register | ` POST /v1/auth/register ` | ` AuthService/Register ` |
75+ | Login | ` POST /v1/auth/login ` | ` AuthService/Login ` |
76+ | Get profile | ` GET /v1/user/profile ` | ` AuthService/GetProfile ` |
77+
78+ - Passwords hashed with bcrypt
79+ - JWT tokens with configurable expiry
80+ - Auth middleware on all transports
81+
82+ ### Task Management
83+
84+ CRUD operations with a status state machine.
85+
86+ | Operation | REST | gRPC |
87+ | ------------| ------------------------------| ------------------------------|
88+ | Create | ` POST /v1/tasks ` | ` TaskService/CreateTask ` |
89+ | List | ` GET /v1/tasks ` | ` TaskService/ListTasks ` |
90+ | Get | ` GET /v1/tasks/:id ` | ` TaskService/GetTask ` |
91+ | Update | ` PUT /v1/tasks/:id ` | ` TaskService/UpdateTask ` |
92+ | Transition | ` PATCH /v1/tasks/:id/status ` | ` TaskService/TransitionTask ` |
93+ | Delete | ` DELETE /v1/tasks/:id ` | ` TaskService/DeleteTask ` |
94+
95+ - Status transitions: ` todo ` → ` in_progress ` → ` done ` (and ` in_progress ` → ` todo ` )
96+ - Pagination with ` limit ` /` offset ` and optional status filter
97+ - Tasks scoped to the authenticated user
98+
99+ ### Translation
100+
101+ Text translation via external API with history tracking.
102+
103+ | Operation | REST | gRPC |
104+ | -----------| -------------------------------------| -----------------------------------------|
105+ | Translate | ` POST /v1/translation/do-translate ` | ` TranslationHistoryService/DoTranslate ` |
106+ | History | ` GET /v1/translation/history ` | ` TranslationHistoryService/ShowHistory ` |
107+
63108## Quick start
64109
65110### Local development
@@ -171,9 +216,10 @@ go run -tags migrate ./cmd/app
171216
172217### ` internal/controller `
173218
174- Server handler layer (MVC controllers). The template shows 3 servers:
219+ Server handler layer (MVC controllers). The template shows 4 servers:
175220
176221- AMQP RPC (based on RabbitMQ as transport)
222+ - NATS RPC (based on NATS as transport)
177223- gRPC ([ gRPC] ( https://grpc.io/ ) framework based on protobuf)
178224- REST API ([ Fiber] ( https://github.com/gofiber/fiber ) framework)
179225
@@ -193,7 +239,7 @@ And in the file `internal/controller/amqp_rpc/router.go` add the line:
193239routes := make (map [string ]server.CallHandler )
194240
195241{
196- v1.NewTranslationRoutes (routes, t, l)
242+ v1.NewRoutes (routes, t, u, tk, j , l)
197243}
198244
199245{
@@ -210,10 +256,14 @@ And in the file `internal/controller/grpc/router.go` add the line:
210256
211257``` go
212258{
259+ v1.NewAuthRoutes (app, u, l)
260+ v1.NewTaskRoutes (app, tk, l)
213261 v1.NewTranslationRoutes (app, t, l)
214262}
215263
216264{
265+ v2.NewAuthRoutes (app, u, l)
266+ v2.NewTaskRoutes (app, tk, l)
217267 v2.NewTranslationRoutes (app, t, l)
218268}
219269
@@ -230,7 +280,7 @@ And in the file `internal/controller/nats_rpc/router.go` add the line:
230280routes := make (map [string ]server.CallHandler )
231281
232282{
233- v1.NewTranslationRoutes (routes, t, l)
283+ v1.NewRoutes (routes, t, u, tk, j , l)
234284}
235285
236286{
@@ -247,11 +297,11 @@ And in the file `internal/controller/restapi/router.go` add the line:
247297``` go
248298apiV1Group := app.Group (" /v1" )
249299{
250- v1.NewTranslationRoutes (apiV1Group, t, l)
300+ v1.NewRoutes (apiV1Group, t, u, tk, jwtManager , l)
251301}
252302apiV2Group := app.Group (" /v2" )
253303{
254- v2.NewTranslationRoutes (apiV2Group, t, l)
304+ v2.NewRoutes (apiV2Group, t, u, tk, jwtManager , l)
255305}
256306```
257307
@@ -328,7 +378,7 @@ func (uc *UseCase) Do() {
328378}
329379```
330380
331- It will also allow us to do auto-generation of mocks (for example with [ mockery ] ( https://github.com/vektra/mockery ) ) and
381+ It will also allow us to do auto-generation of mocks (for example with [ go.uber.org/mock ] ( https://go.uber.org/mock ) ) and
332382easily write unit tests.
333383
334384> We are not tied to specific implementations in order to always be able to change one component to another.
@@ -414,9 +464,9 @@ Or more complex business logic:
414464- ** Use Cases** is business logic located in ` internal/usecase ` .
415465
416466The layer with which business logic directly interacts is usually called the _ infrastructure_ layer.
417- These can be repositories ` internal/usecase/ repo ` , external webapi ` internal/usecase /webapi ` , any pkg, and other
467+ These can be repositories ` internal/repo/persistent ` , external webapi ` internal/repo /webapi ` , any pkg, and other
418468microservices.
419- In the template, the _ infrastructure_ packages are located inside ` internal/usecase ` .
469+ In the template, the _ infrastructure_ packages are located inside ` internal/repo ` .
420470
421471You can choose how to call the entry points as you wish. The options are:
422472
0 commit comments