{"id":49600061,"url":"https://github.com/kmilodenisglez/github.template-srv.restapi.iris-go","last_synced_at":"2026-05-04T08:51:59.768Z","repository":{"id":65149918,"uuid":"541731606","full_name":"kmilodenisglez/github.template-srv.restapi.iris-go","owner":"kmilodenisglez","description":"github template for restapi server using golang iris framework","archived":false,"fork":false,"pushed_at":"2022-10-11T17:03:47.000Z","size":179,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-13T15:57:44.361Z","etag":null,"topics":["cronjob","github-template","golang","iris-golang","rest-api"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kmilodenisglez.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-09-26T18:36:26.000Z","updated_at":"2022-10-02T12:40:01.000Z","dependencies_parsed_at":"2023-01-03T20:33:57.649Z","dependency_job_id":null,"html_url":"https://github.com/kmilodenisglez/github.template-srv.restapi.iris-go","commit_stats":null,"previous_names":["kmilodenisglez/github.template-srv.restapi.iris.go"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/kmilodenisglez/github.template-srv.restapi.iris-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmilodenisglez%2Fgithub.template-srv.restapi.iris-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmilodenisglez%2Fgithub.template-srv.restapi.iris-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmilodenisglez%2Fgithub.template-srv.restapi.iris-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmilodenisglez%2Fgithub.template-srv.restapi.iris-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kmilodenisglez","download_url":"https://codeload.github.com/kmilodenisglez/github.template-srv.restapi.iris-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmilodenisglez%2Fgithub.template-srv.restapi.iris-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32600968,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T22:12:39.696Z","status":"online","status_checked_at":"2026-05-04T02:00:06.625Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cronjob","github-template","golang","iris-golang","rest-api"],"created_at":"2026-05-04T08:51:59.168Z","updated_at":"2026-05-04T08:51:59.763Z","avatar_url":"https://github.com/kmilodenisglez.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🛰 GitHub Template API server\nREST API that allows clients to communicate with * (i.e. **dispatch controller**).\n\n\u003e **NOTE**: Drones app has been tested on **Ubuntu 18.04** and on **Windows 10 with WSL** and Golang 1.18 was used.\n\n## Table of Contents\n\n- [API specification](#api_spec)\n- [Configuration file](#config_file)\n- [Get Started](#get_started)\n  * [Deployment ways (2 ways)](#deploy_ways)\n    - [Docker way](#docker_way)\n    - [Manual way](#manual_way)\n- [Tech and packages](#tech)\n- [Architecture](#arch)\n- [SWAGGER](#swagger)\n## ⚙️API specification \u003ca name=\"api_spec\"\u003e\u003c/a\u003e\n\nThe **GitHub Template API server** provides the following Example API with communicating the **DB**:\n\n| Tag           | Title                              | URL                                      | Query | Method |\n| ------------- | ---------------------------------- | ---------------------------------------- | ----- | ---- |\n| Auth          | user authentication (Using JWT)    | `/api/v1/auth`                           |   -   |`POST`|\n| Auth          | user logout                        | `/api/v1/auth/logout`                    |   -   |`GET` |\n| Auth          | get user authenticated             | `/api/v1/auth/user`                      |   -   |`GET` |\n| Database      | Populate DB with fake data         | `/api/v1/database/populate`              |   -   |`POST`|\n| Drones        | Get all drones or filters for State| `/api/v1/drones`                         |?state=|`GET` |\n| Drones        | Registers or update a drone        | `/api/v1/drones`                         |   -   |`POST`|\n| Drones        | Get a drone by serialNumber        | `/api/v1/drones/:serialNumber`           |   -   |`GET` |\n| Medications   | Get medications                    | `/api/v1/medications`                    |   -   |`GET` |\n| Medications   | Checking loaded items for a drone  | `/api/v1/medications/items/:serialNumber`|   -   |`GET` |\n| Medications   | Load a drone with medication items | `/api/v1/medications/items/:serialNumber`|   -   |`POST`|\n\nTo see the API specifications in more detail, run the app and visit the swagger docs:\n\n\u003e http://localhost:7001/swagger/index.html\n\n![swagger ui](/docs/images/swagger-ui.png)\n\n\n## 🛠️️ Configuration file (conf.yaml) \u003ca name=\"config_file\"\u003e\u003c/a\u003e\n👉🏾 [The config file](/conf/conf.yaml)\n\n|  Param      | Description       | default value   |\n| ----------- | -----------|------------------------- |\n| APIDocIP    | IP to expose the api (unused)  | 127.0.0.1\n| DappPort    | app PORT              | 7001\n| StoreDBPath | DB file location      | ./db/data.db\n| CronEnabled | active the cron job   | true\n| LogDBPath   | DB file event logs    | ./db/event_log.db\n| EveryTime   | time interval (in seconds) that the cron task is executed | 300 seconds (every 5 minutes)\n\nBy default, **StoreDBPath** generates the database file in the /db folder at the root of the project.\n\nThe server exposes the `/api/v1/database/populate` POST endpoint to generate and repopulate the database whenever necessary.\n## ⚡ Get Started \u003ca name=\"get_started\"\u003e\u003c/a\u003e\n\nDownload the github.template-srv.restapi.iris-go project and move to root of project:\n```bash\ngit clone https://github.com/kmilodenisglez/github.template-srv.restapi.iris-go.git \u0026\u0026 cd github.template-srv.restapi.iris-go\n```\n\n### 🚀 Deployment ways (2 ways)  \u003ca name=\"deploy_ways\"\u003e\u003c/a\u003e\nYou can start the server in 2 ways, the first is using **docker** and **docker-compose** and the second is **manually**\n#### 📦 Docker way \u003ca name=\"docker_way\"\u003e\u003c/a\u003e\nYou will need docker and docker-compose in your system.\n\nTo builds Docker image from  Dockerfile, run:\n```bash\ndocker build --no-cache --force-rm --tag app_restapi .\n```\nUse docker-compose to start the container:\n```bash\ndocker-compose up\n```\n\n#### 🔧 Manual way  \u003ca name=\"manual_way\"\u003e\u003c/a\u003e\n\nRun:\n```bash\ngo mod download\ngo mod vendor\n```\n\nIf you make changes to the Endpoint you must generate Swagger API Spec:\n \n![swagger doc](/docs/swagger.md)\n\nBuild:\n```bash\ngo build\n```\n\n#### 🌍 Environment variables\nThe environment variable is exported with the location of the server configuration file.\n\nIf you have 🐧Linux or 🍎Dash, run:\n```bash\nexport SERVER_CONFIG=$PWD/conf/conf.yaml\n```\nbut if it is in the windows cmd, then run:\n```bash\nset SERVER_CONFIG=%cd%/conf/conf.yaml\n```\n#### 🏃🏽‍♂️ Start the server\nBefore it is recommended that you read more about the server configuration file in the section 👉🏾  .\n\nRun the server:\n```bash\n./restapi.app\n```\n\nand visit the swagger docs:\n\n\u003e http://localhost:7001/swagger/index.html\n\nThe first endpoint to execute must be /api/v1/database/populate [POST], to populate the database. That endpoint does not need authentication.\n\n![swagger ui](/docs/images/populate_endpoint.png)\n\nYou can then authenticate and test the remaining endpoints.\n\n### 🧪 Unit or End-To-End Testing\nRun:\n```bash\ngo test -v\n```\n\n## 🔨 Tech and packages \u003ca name=\"tech\"\u003e\u003c/a\u003e\n* [Iris Web Framework](https://github.com/kataras/iris)\n* [validator/v10](https://github.com/go-playground/validator)\n* [Buntdb](https://github.com/tidwall/buntdb)\n* [govalidator](https://github.com/asaskevich/govalidator)\n* [gocron](https://github.com/go-co-op/gocron)\n* [swag](https://github.com/swaggo/swag)\n* [Docker](https://docs.docker.com)\n* [docker-compose](https://docs.docker.com/compose/)\n\n## 📐 Architecture \u003ca name=\"arch\"\u003e\u003c/a\u003e\nThis project has 3 layer :\n\n- Controller Layer (Presentation)\n- Service Layer (Business)\n- Repository Layer (Persistence)\n\n\nTag | Path | Layer |\n--- | ---- | ----- |\nAuth     | [end_auth.go](/api/endpoints/end_auth.go) | Controller | \nDrones   | [end_drones.go](/api/endpoints/end_drones.go) |  Controller |\nEventLog | [end_eventlog.go](/api/endpoints/end_eventlog.go) |  Controller |\n |  |  |\nAuth     | [svc_authentication.go](/service/auth/svc_authentication.go) | Service | \nDrones   | [svc_drones.go](/service/svc_drones.go) |  Service |\nEventLog | [svc_eventlog.go](/service/cron/svc_eventlog.go) |  Service |\n |  |  |\nAuth     | [repo_drones.go](/repo/db/repo_drones.go) | Repository | \nDrones   | [repo_drones.go](/repo/db/repo_drones.go) |  Repository |\nEventLog | [repo_eventlog.go](/repo/db/repo_eventlog.go) |  Repository |\n\n## 📐 Swagger \u003ca name=\"swagger\"\u003e\u003c/a\u003e\nRead ![swagger doc](/docs/swagger.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkmilodenisglez%2Fgithub.template-srv.restapi.iris-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkmilodenisglez%2Fgithub.template-srv.restapi.iris-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkmilodenisglez%2Fgithub.template-srv.restapi.iris-go/lists"}