An open API service indexing awesome lists of open source software.

https://github.com/iqhater/clean-arch-basic-example

Basic greeter API service example (clean arch)
https://github.com/iqhater/clean-arch-basic-example

api clean-arch clean-architecture-template example go golang openapi redoc taskfile

Last synced: 6 months ago
JSON representation

Basic greeter API service example (clean arch)

Awesome Lists containing this project

README

          

[![Issues][issues-shield]][issues-url]
[![MIT License][license-shield]][license-url]
[![Tests][tests-shield]][tests-url]




Clean Arch Basic Example


Clean architecture with a basic greeter API service example







View Example
ยท
Report Bug
ยท
Request Feature


Table of Contents



  1. About The Project



  2. Getting Started


  3. Usage

  4. Roadmap

  5. Contributing

  6. License

  7. Contact

## About The Project

Graph generated by `go-arch-lint` utility
[![Product Name Screen Shot][product-screenshot]](https://example.com)

(back to top)

### Built With

* [![Go][go.dev]][Go-url]

(back to top)

## Getting Started

Setting up your project locally.
To get a local copy up and running follow these simple example steps.

### Prerequisites

Prepare some useful tools for project development

* install project dependencies (Taskfile and go-arch-lint)

[Taskfile](https://taskfile.dev/installation/) _`*recommended`_
[golangci-lint](https://golangci-lint.run/welcome/install/) _*optional_
[go-arch-lint](https://github.com/fe3dback/go-arch-lint) _*optional_

### Installation

1. Clone the repo

```sh
git clone https://github.com/iqhater/clean-arch-basic-example.git
```

2. Install project dependencies

```sh
task install
```

3. Add `.env` file to project root. See `.env.example`

4. *Optional Feel free to edit `Taskfile` binary name, module name and entrypoint path if you wish.

```yml
MODULE_NAME: greeter_api

# Binary name
BINARY_NAME: greeter_api

# App entrypoint path
APP_ENTRYPOINT: ./cmd/greeter
```

5. Build and run project

```sh
task run
```

(back to top)

## Usage

Clean arch data flow concept schema
[![Clean Arch Schema Concept][schema-concept]](https://bloghugocoutinho.wordpress.com/wp-content/uploads/2020/05/cleanarchitecture-1.jpg)

#### Request public greeting example

```sh
curl "http://localhost:8080/greet?name=Bob"
```

#### Response

```json
{
"request_id":"1ddb50f2-6fde-4fda-9d5c-51a23fcaa935",
"greeting":"๐Ÿ‘‹ Hello Gopher Bob!"
}
```

#### Request private greeting example

```sh
curl "http://localhost:8080/greet/1?name=Bob"
```

#### Response with counter

```json
{
"id":1,
"greeting":"๐Ÿ‘‹ Hello Gopher Bob!",
"total_greetings":3
}
```

### Taskfile useful commands

Run all tests

```sh
task test
```

Run project linter

```sh
task lint
```

Remove all binaries

```sh
task clean
```

(back to top)

## Roadmap

* [ ] Deploy openapi static docs located at the `/api` folder
* [ ] Deploy greeter API service

See the [open issues](https://github.com/iqhater/clean-arch-basic-example/issues) for a full list of proposed features (and known issues).

(back to top)

## Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
Don't forget to give the project a star! Thanks again!

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

(back to top)

### Top contributors


contrib.rocks image

## License

Distributed under the MIT License. See `LICENSE.txt` for more information.

(back to top)

## Contact

email -

Project Link: [https://github.com/iqhater/clean-arch-basic-example](https://github.com/iqhater/clean-arch-basic-example)

(back to top)

[issues-shield]: https://img.shields.io/github/issues/iqhater/clean-arch-basic-example.svg?style=for-the-badge
[issues-url]: https://github.com/iqhater/clean-arch-basic-example/issues
[license-shield]: https://img.shields.io/github/license/iqhater/clean-arch-basic-example.svg?style=for-the-badge
[license-url]: https://github.com/iqhater/clean-arch-basic-example/blob/main/LICENSE.txt
[tests-url]: https://github.com/iqhater/clean-arch-basic-example/actions/workflows/develop_run_tests.yml/badge.svg
[tests-shield]: https://github.com/iqhater/clean-arch-basic-example/actions/workflows/develop_run_tests.yml/badge.svg
[product-screenshot]: go-arch-lint-graph.svg
[schema-concept]: clean_arch_concept_go_vector.svg
[go.dev]: https://img.shields.io/badge/golang-00ADD8?style=for-the-badge&logo=go&logoColor=white
[Go-url]: https://go.dev