{"id":15095884,"url":"https://github.com/john98nf/ultimatemicroservice","last_synced_at":"2026-01-06T20:41:23.958Z","repository":{"id":246097975,"uuid":"819456281","full_name":"john98nf/UltimateMicroservice","owner":"john98nf","description":"A simple microservice exposing a RESTfull API that handles companies information.","archived":false,"fork":false,"pushed_at":"2024-06-26T01:49:14.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-01T17:44:17.811Z","etag":null,"topics":["docker","docker-compose","gin","go","jwt","mysql","uuid"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/john98nf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-24T14:38:29.000Z","updated_at":"2024-06-26T01:59:00.000Z","dependencies_parsed_at":"2024-06-25T21:24:19.325Z","dependency_job_id":"25a31d2f-6470-42b5-be12-3548f8402c32","html_url":"https://github.com/john98nf/UltimateMicroservice","commit_stats":{"total_commits":15,"total_committers":1,"mean_commits":15.0,"dds":0.0,"last_synced_commit":"a5fd41eda4b7d871b5b769108d1aaeb4c58eadd4"},"previous_names":["john98nf/ultimatemicroservice"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/john98nf%2FUltimateMicroservice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/john98nf%2FUltimateMicroservice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/john98nf%2FUltimateMicroservice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/john98nf%2FUltimateMicroservice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/john98nf","download_url":"https://codeload.github.com/john98nf/UltimateMicroservice/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245852610,"owners_count":20683065,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-compose","gin","go","jwt","mysql","uuid"],"created_at":"2024-09-25T15:43:07.282Z","updated_at":"2026-01-06T20:41:23.929Z","avatar_url":"https://github.com/john98nf.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UltimateMicroservice 🏢\n[![Go](https://img.shields.io/badge/Go-73d6ec)](https://go.dev/)\n[![MySQL](https://img.shields.io/badge/MySQL-eb7c01)](https://www.mysql.com/)\n[![Gin](https://img.shields.io/badge/Gin%20Framework-8A2BE2)](https://gin-gonic.com/)\n[![Google UUID](https://img.shields.io/badge/Google%20UUID-e30419)](https://github.com/google/uuid)\n[![JWT](https://img.shields.io/badge/JWT-d63aff)](https://github.com/google/uuid)\n[![Docker](https://img.shields.io/badge/Docker-1d63ed)](https://www.docker.com/)\n\u003cbr/\u003e\n\n## General\nA simple microservice exposing a RESTfull API that handles companies information.\n\n## Table of Contents 🗂️\n- [Functionality](#functionality)\n- [Directories' Structure](#directories)\n- [Installation Process](#installation)\n\n## Functionality ⚙️ \u003ca name=\"functionality\"\u003e\u003c/a\u003e\nThe RESTful API exposes the following endpoints (i.e. resources) at port 8080:\n\n|Endpoint|HTTP Method|Usage|Comment|\n|---|---|---|---|\n|host:8080/company/:id|GET|Fetch the requested company resource based on company id||\n|host:8080/company|POST|Insert a new Company resource|User authentication required|\n|host:8080/company/:id|DELETE|Delete the specified company resource|User authentication required|\n|host:8080/company/:id|PATCH|Modify the requested company resource|User authentication required|\n|host:8080/signin|POST|User Autherntication Utility: Login process||\n|host:8080/signup|POST|User Autherntication Utility: User creation process||\n\n\n## Directories' Structure 📂\u003ca name=\"directories\"\u003e\u003c/a\u003e\n\nAs far as directory management is concerned, it was decided to follow the structure mentioned below:\n\n```\nUltimateMicroservice\n├── database\n│   ├── queries\n│   │   └── databaseCreation.sql\n│   └── Dockerfile\n├── microservice\n│   ├── cmd\n│   │   └── app\n│   │       ├── dataManagement\n│   │       │   └── dataManagement.go\n│   │       ├── model\n│   │       │   └── model.go\n│   │       └── main.go\n│   ├── Dockerfile\n│   ├── go.mod\n│   └── go.sum\n├── compose.yaml\n└── README.md\n```\n\n* The __database__ folder includes the SQL query for the database initialliazation.\n* The __microservice__ folder contains the source code of our application, which according to Go standards is stored inside the __cmd/app__ folder. Inside this folder the __main__ package contains the web server, the __model__ package offers a basic data model of the application, while the __dataManagement__ package implements the business logic of this application.\n\n## Installation 📦\u003ca name=\"installation\"\u003e\u003c/a\u003e\n\nOne may use two different ways in order to run this simple application. The first one is to run both the web server services and the database service locally, while the second one is to utilize the power of Docker containers and Docker compose.\n\n### Option I: Local Execution\n\nIn this particular case, the installation of the go compiler (version 1.20 or later) is needed for the host machine to run this application, alongside the set up of mySQL server. Further instructions, suitable for each architecture and operating system, can be found at the related websites ([MySQL](https://dev.mysql.com/doc/refman/8.4/en/installing.html) \u0026 [Go](https://go.dev/dl/)).\n\nAfter those steps, the process is straght forward.\nConnect to the database and run the __databaseCreation.sql__\n\n```\ncd UltimateMicroservice\nmysql -u root -p \u003cyour_password\u003e\nsource database/queries/databaseCreation.sql\n```\n\nNavigate to the microservice directory, build the project and run.\n\n```\ncd UltimateMicroservice/microservice/cmd/app\ngo mod download\ngo build .\n./app\n```\n\n### Option II: Containerization\n\nIn this option, the only thing that the user needs to install is the Docker engine \u0026 the Docker Compose tool, which is described thoroughly in the related website ([here](https://docs.docker.com/compose/install/)).\n\nThe advantages of this approach is the fact that docker will handle the building process of the appliation for us and in fact in a isolated manner.\n\nThe first time running the application, we need to run just the following command:\n\n```\ncd UltimateMicroservice\ndocker compose up --build\n```\nAfter that, the _--buid_ flag can be omitted. It is important to note that while the compose.yaml file sets a volume for the databse in order to achieve persistance, __the databaseCreation.sql will drop the previously created database and create a new one__. If this is not the desirable behaviour, the only thing that needs to happen is the removal of the _--init-file /docker-entrypoint-initdb.d/databaseCreation.sql_ flag inside the compose.yaml file (located in the parent folder of this directory).\n\n### ⚠️ Important Notice ⚠️\n\nNone of the above solutions wil **NOT** work without the creation of a **.evt** file, containing the secrets of the application.\n\n```\ncd UltimateMicroservice\ntouch .env\n```\n\nIts internal structure should look like this:\n\n```\nDBENDPOINT=\u003clocalhost | db\u003e # The endpoint for the database.\nMYSQL_DATABASE= \"goSchema\"\nMYSQL_USER= \u003cuser for DB access\u003e\nMYSQL_PASSWORD= \u003cpassword of the same user\u003e\nJWT_SECRET_KEY=\u003cJWT Key of the Web Server\u003e\n```\nLocalhost should be used in case of bare metal execution, while the db tag should be specified during docker usage (Otherwise the web app container will receive a connection refuse from the database).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohn98nf%2Fultimatemicroservice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohn98nf%2Fultimatemicroservice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohn98nf%2Fultimatemicroservice/lists"}