Skip to content

iqhater/clean-arch-basic-example

Repository files navigation

Issues MIT License Tests


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

(back to top)

Built With

  • Go

(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 *recommended
golangci-lint *optional
go-arch-lint *optional

Installation

  1. Clone the repo

    git clone https://github.com/iqhater/clean-arch-basic-example.git
  2. Install project dependencies

    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.

     MODULE_NAME: greeter_api
    
     # Binary name
     BINARY_NAME: greeter_api
    
     # App entrypoint path
     APP_ENTRYPOINT: ./cmd/greeter
  5. Build and run project

    task run

(back to top)

Usage

Clean arch data flow concept schema Clean Arch Schema Concept

Request public greeting example

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

Response

{
  "request_id":"1ddb50f2-6fde-4fda-9d5c-51a23fcaa935",
  "greeting":"👋 Hello Gopher Bob!"
}

Request private greeting example

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

Response with counter

{
  "id":1,
  "greeting":"👋 Hello Gopher Bob!",
  "total_greetings":3
}

Taskfile useful commands

Run all tests

task test

Run project linter

task lint

Remove all binaries

task clean

(back to top)

Roadmap

  • Deploy openapi static docs located at the /api folder
  • Deploy greeter API service

See the open 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 - [email protected]

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

(back to top)