Skip to content

Commit 41d6d45

Browse files
Saman NesariSaman Nesari
Saman Nesari
authored and
Saman Nesari
committed
feat: add md refrences in readme file
1 parent 0811214 commit 41d6d45

File tree

6 files changed

+111
-74
lines changed

6 files changed

+111
-74
lines changed

README.md

+82-50
Original file line numberDiff line numberDiff line change
@@ -9,91 +9,123 @@ This is the code repository for [Go Microservice Template](https://www.github.co
99
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
1010
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
1111

12-
- [Golang Template Project](#golang-template-project)
13-
- [About the project](#about-the-project)
12+
- [About the project](#about-the-project)
13+
- [Status](#status)
14+
- [Reference](#reference)
15+
- [Getting started](#getting-started)
1416
- [Prerequisites](#prerequisites)
15-
- [Design](#design)
16-
- [Status](#status)
17-
- [See also](#see-also)
18-
- [Getting started](#getting-started)
19-
- [Database](#database)
20-
- [Protocol Buffer](#protocol-buffer)
21-
- [API docs](#api-docs)
22-
- [Docker Compose](#docker-compose)
23-
- [Linting](#linting)
24-
- [Notes](#notes)
17+
- [Setup](#setup)
18+
- [Testing](#testing)
19+
- [Linting](#linting)
20+
- [Building](#building)
21+
- [Cleaning](#cleaning)
22+
- [Continuous Integration](#continuous-integration)
23+
- [Notes](#notes)
2524

2625
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
2726

28-
# Golang Template Project
29-
3027
## About the project
3128

3229
The template is used to create golang project. All golang projects must follow the conventions in the
3330
template. Calling for exceptions must be brought up in the engineering team.
3431

35-
## Prerequisites
32+
## Status
3633

37-
- Go 1.13+
34+
The template project is in alpha status.
3835

39-
### Design
36+
## Reference
4037

41-
- [Clean Architecture](https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html)
38+
- [Database Schema and Migrations](docs/db.md)
39+
- [Deployment Instructions](docs/deployment.md)
40+
- [Design Decisions and Technical Considerations](docs/design.md)
41+
- [Development and Operations Processes](docs/devops.md)
42+
- [Environment Variables](docs/env.md)
4243

43-
### Status
44+
## Getting started
4445

45-
The template project is in alpha status.
46+
### Prerequisites
4647

47-
### See also
48+
- [Go 1.13+](https://golang.org/doc/install)
4849

49-
- [gRPC](https://grpc.io/) for communication between services
50-
- [SQLx](https://github.com/jmoiron/sqlx) for database access and migrations
51-
- [Redis](github.com/go-redis/redis) for caching and message queues
52-
- [Kafka](https://github.com/segmentio/kafka-go) for streaming data processing
53-
- [Echo](https://echo.labstack.com/) for web server routing
54-
- [Zap Logger](https://github.com/uber-go/zap) for logging
55-
- [Sentry](https://sentry.io/) for error tracking and reporting
56-
- [Cron](https://godoc.org/github.com/robfig/cron) for scheduling tasks
57-
- [errors](https://github.com/pkg/errors) for error handling and adding stack trace to golang
58-
- [OZZO](github.com/go-ozzo/ozzo-validation) for data validation
50+
### Setup
5951

60-
## Getting started
52+
1. Clone the repository and navigate to the root directory of the project:
6153

62-
Below we describe the conventions or tools specific to golang project.
63-
64-
### Database
54+
```bash
55+
git clone https://github.com/infranyx/go-grpc-template.git
56+
cd go-grpc-template
57+
```
6558

66-
For information about the project's database, see the [DB.md](docs/DB.md) file.
59+
2. Install the dependencies:
6760

68-
### Protocol Buffer
61+
```bash
62+
make dep
63+
```
6964

70-
To use protocol buffer for gRPC communication please refer to [Protohub](https://github.com/infranyx/protobuf-template). Protohub is a hub for managing your protobuf files and with auto generation feature you can simply `go get` the generated code of your proto.
65+
3. Run the development server:
7166

72-
### API docs
67+
```bash
68+
make run_dev
69+
```
7370

74-
The template doesn't have API docs. For auto-generated API docs that you include, you can also give instructions on the
75-
build process.
71+
This will start the http server on port 4000 and grpc server on port 3000. You can customize the ports by setting the `HTTP_PORT` and `GRPC_PORT` environment variable.
7672

77-
### Docker Compose
73+
## Testing
7874

79-
Using Compose is an easy way to manage multi-container applications on any system that supports Docker.
75+
To run the tests, use the following command:
8076

8177
```bash
82-
docker-compose up -d # it runs all necessary docker images that is needed
78+
make test
79+
```
80+
81+
To generate a test coverage report, use the following command:
8382

84-
docker-compose -f docker-compose.e2e-local.yaml up -d # it runs all necessary docker images for Testing environment
83+
```bash
84+
make test_coverage
8585
```
8686

8787
### Linting
8888

89-
Linting is an important part of any Go project. It helps to ensure that code is written in a consistent and maintainable way, and can help to catch potential errors before they become problems. It is important to note that linting should be done regularly throughout the development process, not just at the end. This will help ensure that any potential issues are caught early on and can be fixed quickly and easily.
89+
To lint the code, use the following command:
90+
91+
```bash
92+
make lint
93+
```
94+
95+
This will run all available linters, including Go lint, Dockerfile lint, and YAML lint.
96+
97+
### Building
98+
99+
To build the binary, use the following command:
100+
101+
```bash
102+
make build
103+
```
104+
105+
This will create a binary in the `out/bin` directory. You can run the binary with the following command:
106+
107+
```bash
108+
make run
109+
```
110+
111+
### Cleaning
112+
113+
To clean the build artifacts and generated files, use the following command:
90114

91-
To lint your Go project, you can simply use makefile
115+
```bash
116+
make clean
117+
```
92118

93-
```makefile
94-
lint-dockerfile: # Lint your Dockerfile
119+
This will remove the `bin` and `out` directories, as well as any build-related files.
95120

96-
lint-go: # Use golintci-lint on your project
121+
### Continuous Integration
122+
123+
To run the continuous integration tasks, use the following command:
124+
125+
```bash
126+
make ci
97127
```
98128

129+
This will run the tests, linting, and code coverage tasks, and generate the corresponding reports. The reports will be saved to the `out` directory.
130+
99131
## Notes

docs/db.md

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1+
# Database
2+
13
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
24
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
35

4-
- [Database](#database)
5-
- [Migrations](#migrations)
6-
- [Installation](#installation)
7-
- [Usage](#usage)
8-
- [PostgreSQL](#postgresql)
9-
- [Installation](#installation-1)
10-
- [Connecting to the Database](#connecting-to-the-database)
6+
- [Migrations](#migrations)
7+
- [Installation](#installation)
8+
- [Usage](#usage)
9+
- [PostgreSQL](#postgresql)
10+
- [Installation](#installation-1)
11+
- [Connecting to the Database](#connecting-to-the-database)
1112

1213
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
1314

14-
# Database
15-
1615
This project uses PostgreSQL as its primary data store, and Migrate for managing database migrations.
1716

1817
## Migrations

docs/deployment.md

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1+
# Deployment
2+
13
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
24
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
35

4-
- [Deployment](#deployment)
5-
- [Prerequisites](#prerequisites)
6-
- [Setup](#setup)
7-
- [Verification](#verification)
8-
- [Maintenance](#maintenance)
6+
- [Prerequisites](#prerequisites)
7+
- [Setup](#setup)
8+
- [Verification](#verification)
9+
- [Maintenance](#maintenance)
910

1011
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
1112

12-
# Deployment
13-
1413
This guide will walk you through the steps to deploy the Golang microservice application using Docker Compose.
1514

1615
## Prerequisites

docs/design.md

+11
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
- [Key Components and Features](#key-components-and-features)
66
- [Design Decisions](#design-decisions)
77
- [See also](#see-also)
8+
- [Protocol Buffer](#protocol-buffer)
9+
- [API docs](#api-docs)
810
- [Layout](#layout)
911
- [Error Handling](#error-handling)
1012
- [Diagrams and Mockups](#diagrams-and-mockups)
@@ -52,6 +54,15 @@ The following design decisions were made:
5254
- [errors](https://github.com/pkg/errors) for error handling and adding stack trace to golang
5355
- [OZZO](github.com/go-ozzo/ozzo-validation) for data validation
5456

57+
## Protocol Buffer
58+
59+
To use protocol buffer for gRPC communication please refer to [Protohub](https://github.com/infranyx/protobuf-template). Protohub is a hub for managing your protobuf files and with auto generation feature you can simply `go get` the generated code of your proto.
60+
61+
## API docs
62+
63+
The template doesn't have API docs. For auto-generated API docs that you include, you can also give instructions on the
64+
build process.
65+
5566
## Layout
5667

5768
The project is organized into a number of directories and subdirectories, as shown in the following tree structure:

docs/devops.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1+
# DevOps Documentations
2+
13
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
24
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
35

4-
- [DevOps Documentations](#devops-documentations)
5-
66
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
7-
8-
# DevOps Documentations

docs/env.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1+
# Environment Variables
2+
13
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
24
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
35

4-
- [Environment Variables](#environment-variables)
5-
66
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
77

8-
# Environment Variables
9-
108
This file lists the environment variables that are used by the project.
119

1210
| Variable | Description | Required | Default Value |

0 commit comments

Comments
 (0)