Skip to content

Demonstration back-end API project written in Go. Serving promotions information.

License

Notifications You must be signed in to change notification settings

p44dev/Promotions-API

Repository files navigation

Promotions-API 📓

Table of Contents
  1. About The Project
  2. Getting Started
  3. Roadmap
  4. Contributing
  5. License
  6. Contact
  7. Acknowledgments

About The Project

Sample demonstration project that is about serving promotions data from a backend service. The prject built on top of the REST architecture. Used Go (Gin, GORM) for code. Postgres as a storage. AWS (EC2, Security Group, Load Balancer) for deployment and handling the high load,Docker for containerization and Prometheus for metrics collection.

Live Demo

Project also uses Go program for Bulk data inserting into Postgres.

(back to top)

Used Technology Stack

Go AWS Docker Postgres Git Prometheus Swagger

(back to top)

Getting Started

Prerequisites

Before jumping into project cloning make sure to have

  • Go > 1.17
    Download from here https://go.dev/dl/
  • Postgres
    Download from here https://www.postgresql.org/download/
  • Docker
    Download from here https://www.docker.com/
  • Make
    Download from here https://www.gnu.org/software/make/ (Not Mandatody)
  • Curl
    Download from here https://www.gnu.org/software/make/ (Not Mandatody)

(back to top)

Installation and Usage

Instructions for setting up and running the project

  1. Clone the repo
    git clone https://github.com/p44dev/Promotions-API.git
  2. Configure variables in .env file or export them
    For reference: .env.sample
  3. Go to the Promotions-API/Bulk directory and run command below for bulk insert
    make insert
  4. Go to the Promotions-API directory and run commands below for running app as a container (Not a mandatory option, for testing you can just run -> go run main.go)
    make dockerize
    make run-container
  5. Fetch the data from the backend server.
    curl http://localhost:1321/promotions/1
  6. See Prometheus Logs
    curl http://localhost:9091/metrics

(back to top)

Roadmap

  • Use AWS EC2 more powerful Instace or deploy into Beanstalk (Now using 1 cpu from free tier)
  • Add Cron Job for inserting bulk data every 30 minutes and swap tables.
  • Add POST | PATCH | DELETE etc.. requests into REST service
  • Containerize bulk inserting application and postgres

(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)

License

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

(back to top)

Contact

Anton - @LinkedIn - antonpapazian@gmail.com

Project Link: https://github.com/p44dev/Promotions-API

(back to top)

Acknowledgments

(back to top)

Thank You 😃

(back to top)

About

Demonstration back-end API project written in Go. Serving promotions information.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published