{"id":21069412,"url":"https://github.com/rishikeshbedre/nats-api-server","last_synced_at":"2026-04-11T02:03:36.383Z","repository":{"id":220055875,"uuid":"237057797","full_name":"rishikeshbedre/nats-api-server","owner":"rishikeshbedre","description":"NATS API Server is a REST based configuration server for the nats-server to configure authorization and reload the nats-server","archived":false,"fork":false,"pushed_at":"2023-02-25T01:30:06.000Z","size":105,"stargazers_count":3,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-12T18:29:20.659Z","etag":null,"topics":["authorization","docker","gin-gonic","golang","jsoniter","kubernetes","nats-server","natsio","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rishikeshbedre.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-29T18:52:06.000Z","updated_at":"2024-02-06T04:59:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"0d43f273-2432-4f60-b77f-ef4bea2b2b90","html_url":"https://github.com/rishikeshbedre/nats-api-server","commit_stats":null,"previous_names":["rishikeshbedre/nats-api-server"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rishikeshbedre/nats-api-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rishikeshbedre%2Fnats-api-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rishikeshbedre%2Fnats-api-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rishikeshbedre%2Fnats-api-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rishikeshbedre%2Fnats-api-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rishikeshbedre","download_url":"https://codeload.github.com/rishikeshbedre/nats-api-server/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rishikeshbedre%2Fnats-api-server/sbom","scorecard":{"id":777313,"data":{"date":"2025-08-11","repo":{"name":"github.com/rishikeshbedre/nats-api-server","commit":"2f76b7aa768ba4ee16cbc0003bc158c8fede0ee0"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.6,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: containerImage not pinned by hash: Dockerfile:1","Warn: containerImage not pinned by hash: Dockerfile:26","Warn: containerImage not pinned by hash: Dockerfile:28: pin your Docker image by updating alpine:3.10 to alpine:3.10@sha256:451eee8bedcb2f029756dc3e9d73bab0e7943c1ac55cff3a4861c52a0fdd3e98","Info:   0 out of   3 containerImage dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"13 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2024-2955 / GHSA-869c-j7wc-8jqv","Warn: Project is vulnerable to: GO-2020-0001 / GHSA-6vm3-jj99-7229","Warn: Project is vulnerable to: GO-2021-0052 / GHSA-h395-qcrw-5vmq","Warn: Project is vulnerable to: GHSA-3vp4-m3rf-835h","Warn: Project is vulnerable to: GO-2023-1737 / GHSA-2c4m-59x9-fr2g","Warn: Project is vulnerable to: GO-2020-0012 / GHSA-ffhg-7mh4-33c4","Warn: Project is vulnerable to: GO-2021-0227 / GHSA-3vm4-22fp-5rfm","Warn: Project is vulnerable to: GO-2022-0968 / GHSA-gwc9-m7rh-j2ww","Warn: Project is vulnerable to: GO-2021-0356 / GHSA-8c26-wmh5-6g9v","Warn: Project is vulnerable to: GO-2024-2961","Warn: Project is vulnerable to: GO-2023-2402 / GHSA-45x7-px36-x8w8","Warn: Project is vulnerable to: GO-2024-3321 / GHSA-v778-237x-gjrc","Warn: Project is vulnerable to: GO-2025-3487 / GHSA-hcg3-q754-cr77"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T03:55:48.586Z","repository_id":220055875,"created_at":"2025-08-23T03:55:48.586Z","updated_at":"2025-08-23T03:55:48.586Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279010366,"owners_count":26084743,"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","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"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":["authorization","docker","gin-gonic","golang","jsoniter","kubernetes","nats-server","natsio","rest-api"],"created_at":"2024-11-19T18:35:06.331Z","updated_at":"2025-10-12T06:02:56.541Z","avatar_url":"https://github.com/rishikeshbedre.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NATS API SERVER\n\n![Licence](https://img.shields.io/github/license/rishikeshbedre/nats-api-server)\n[![Build Status](https://travis-ci.com/rishikeshbedre/nats-api-server.svg?branch=master)](https://travis-ci.com/rishikeshbedre/nats-api-server)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/940a0ccb560941fb9cdbd1b277d6af17)](https://app.codacy.com/manual/rishikeshbedre/nats-api-server?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=rishikeshbedre/nats-api-server\u0026utm_campaign=Badge_Grade_Dashboard)\n[![codecov](https://codecov.io/gh/rishikeshbedre/nats-api-server/branch/master/graph/badge.svg)](https://codecov.io/gh/rishikeshbedre/nats-api-server)\n[![Go Report Card](https://goreportcard.com/badge/github.com/rishikeshbedre/nats-api-server)](https://goreportcard.com/report/github.com/rishikeshbedre/nats-api-server)\n\nNATS API Server is a REST based configuration server for [NATS-Server](https://github.com/nats-io/nats-server). It features REST end-points to configure user authorization and reload the NATS-Server. It is written using [Gin Web Framework](https://github.com/gin-gonic/gin) and [jsoniter](https://github.com/json-iterator/go) to make server high performant. \n\n## Contents\n\n- [NATS API SERVER](#nats-api-server)\n  - [Contents](#contents)\n  - [How it works](#how-it-works)\n  - [Usage](#usage)\n  - [API Documentation](#api-documentation)\n    - [Add User](#add-user)\n    - [Delete User](#delete-user)\n    - [Show User](#show-user)\n    - [Add Topic](#add-topic)\n    - [Delete Topic](#delete-topic)\n    - [Download Configuration](#download-configuration)\n  - [Docker](#docker)\n  - [Kubernetes](#kubernetes)\n  - [Testing](#testing)\n\n## How it Works\n\n![nats-api-server](https://github.com/rishikeshbedre/nats-api-server/blob/master/extras/nats-api-server.jpg)\n\nNATS API Server has rest end points to add|delete user|topic where it writes the authorization configuration to a file. The API Server also has an option to send reload signal to NATS-Server where it reads this configuration file and allows only authenticated users to connect to NATS-Server.\n\n## Usage\n\nTo install NATS API Server, you need to install [Go](https://golang.org/)(**version 1.12+ is required**) and set your Golang workspace.\n\n1. This project uses go modules and provides a make file. You should be able to simply install and start:\n\n```sh\n$ git clone https://github.com/rishikeshbedre/nats-api-server.git\n$ cd nats-api-server\n$ make\n$ ./nats-api-server\n```\n\n2. Then you need to install [NATS-Server](https://docs.nats.io/nats-server/installation#installing-from-the-source) and start the server using the configuration file present in the [NATS API Server](https://github.com/rishikeshbedre/nats-api-server/blob/master/configuration/nats-server.conf).\n\n## API Documentation\n\n### Add User\n\nAdds new user to the authorization configuration.\n\n- **URL:**\n  `/user`\n\n- **Method:**\n  `POST`\n\n- **Request:**\n  - **Header:**\n    - **Content-Type:** `application/json`\n  - **Body:** `{\"user\":\"xyz\",\"password\":\"123\"}`\n\n- **Success Response:**\n  - **Code:** `200` \n  - **Content:** `{\"message\":\"User:xyz added\"}`\n \n- **Error Response:**\n  - **Code:** `400 STATUS BAD REQUEST` \n  - **Content:** `{\"error\":\"User:xyz already present\"}`\n\n  OR\n\n  - **Code:** `400 STATUS BAD REQUEST` \n  - **Content:** `{\"error\":\"Key: 'AddUserJSON.Password' Error:Field validation for 'Password' failed on the 'required' tag\"}`\n\n- **Sample Call:**\n\n  ```ssh\n    $curl --header \"Content-Type: application/json\" --request POST --data '{\"user\":\"xyz\",\"password\":\"123\"}' http://localhost:6060/user\n  ```\n\n### Delete User\n\nDeletes the user from authorization configuration.\n\n- **URL:**\n  `/user`\n\n- **Method:**\n  `DELETE`\n\n- **Request:**\n  - **Header:**\n    - **Content-Type:** `application/json`\n  - **Body:** `{\"user\":\"xyz\"}`\n\n- **Success Response:**\n  - **Code:** `200` \n  - **Content:** `{\"message\":\"User:xyz deleted\"}`\n \n- **Error Response:**\n  - **Code:** `400 STATUS BAD REQUEST`\n  - **Content:** `{\"error\":\"User:xyz cannot be deleted\"}`\n\n  OR\n\n  - **Code:** `400 STATUS BAD REQUEST`\n  - **Content:** `{\"error\":\"Key: 'DeleteUserJSON.User' Error:Field validation for 'User' failed on the 'required' tag\"}`\n\n- **Sample Call:**\n\n  ```ssh\n    $curl --header \"Content-Type: application/json\" --request DELETE --data '{\"user\":\"xyz\"}' http://localhost:6060/user\n  ```\n\n### Show User\n\nReturns the current authorization configuration.\n\n- **URL:**\n  `/user`\n\n- **Method:**\n  `GET`\n\n- **Request:** `NONE`\n\n- **Success Response:**\n  - **Code:** `200` \n  - **Content:** `{\"message\":[{\"user\":\"natsdemouser\",\"permissions\":{\"publish\":null,\"subscribe\":null}}]}`\n \n- **Error Response:**\n  - **Code:** `400 STATUS BAD REQUEST`\n  - **Content:** `{\"error\":\"???jsonbinderror\"}`\n\n- **Sample Call:**\n\n  ```ssh\n    $curl --request GET http://localhost:6060/user\n  ```\n\n### Add Topic\n\nAdds the topics to the particular user in authorization configuration. If any of the topics are present in the request JSON are available in the authorization configuration for that particular user, this end point returns a error message.\n\n- **URL:**\n  `/topic`\n\n- **Method:**\n  `POST`\n\n- **Request:**\n  - **Header:**\n    - **Content-Type:** `application/json`\n  - **Body:** `{\"user\":\"xyz\",\"permissions\":{\"publish\":[\"test\",\"quest\"],\"subscribe\":[\"test\",\"quest\"]}}`\n\n- **Success Response:**\n  - **Code:** `200` \n  - **Content:** `{\"message\":\"Topics Added for the user:xyz\"}`\n \n- **Error Response:**\n  - **Code:** `400 STATUS BAD REQUEST` \n  - **Content:** `{\"error\":\"test topic is already present for the user:xyz\"}`\n\n  OR\n\n  - **Code:** `400 STATUS BAD REQUEST` \n  - **Content:** `{\"error\":\"Key: 'AddDeleteTopicJSON.User' Error:Field validation for 'User' failed on the 'required' tag\"}`\n\n- **Sample Call:**\n\n  ```ssh\n    curl --header \"Content-Type: application/json\" --request POST --data '{\"user\":\"xyz\",\"permissions\":{\"publish\":[\"test\",\"quest\"],\"subscribe\":[\"test\",\"quest\"]}}' http://localhost:6060/topic\n  ```\n\n### Delete Topic\n\nDeletes the topics from the particular user in authorization configuration. If any of the topics are present in the request JSON are not available in the authorization configuration for that particular user, this end point returns a error message.\n\n- **URL:**\n  `/topic`\n\n- **Method:**\n  `DELETE`\n\n- **Request:**\n  - **Header:**\n    - **Content-Type:** `application/json`\n  - **Body:** `{\"user\":\"xyz\",\"permissions\":{\"publish\":[\"quest\"],\"subscribe\":[\"quest\"]}}`\n\n- **Success Response:**\n  - **Code:** `200` \n  - **Content:** `{\"message\":\"Topics deleted for the user:xyz\"}`\n \n- **Error Response:**\n  - **Code:** `400 STATUS BAD REQUEST` \n  - **Content:** `{\"error\":\"Cannot delete topics for the user:xyz\"}`\n\n  OR\n\n  - **Code:** `400 STATUS BAD REQUEST` \n  - **Content:** `{\"error\":\"Key: 'AddDeleteTopicJSON.User' Error:Field validation for 'User' failed on the 'required' tag\"}`\n\n- **Sample Call:**\n\n  ```ssh\n    curl --header \"Content-Type: application/json\" --request DELETE --data '{\"user\":\"xyz\",\"permissions\":{\"publish\":[\"quest\"],\"subscribe\":[\"quest\"]}}' http://localhost:6060/topic\n  ```\n\n### Download Configuration\n\nStores the authorization configuration to the file and reload the nats server.\u003cbr\u003e\n**Note:** Until you send this request to NATS API Server, add|delete user|topic requests doesn't reflect in NATS Server.\n\n- **URL:**\n  `reload`\n\n- **Method:**\n  `POST`\n\n- **Request:** `NONE`\n\n- **Success Response:**\n  - **Code:** `200` \n  - **Content:** `{\"message\":\"Download and reload of Configuration Successful\"}`\n \n- **Error Response:**\n  - **Code:** `400 STATUS BAD REQUEST` \n  - **Content:** `{\"error\":\"??filewriteerror or ??jsonbinderror or ??cmderror\"}`\n\n- **Sample Call:**\n\n  ```ssh\n    curl --request POST http://localhost:6060/reload\n  ```\n\n## Docker\n\nBuilding the image for nats api server acutually builds both nats api server and nats server in one container, so when you run the container two services will run in the same container.\n\n1. To build the image run following command:\n\n  ```ssh\n    $./extras/build.sh\n  ```\n\n2. While running the image you can persist the configuration file by mounting the volume to the host and container. To run the container just run the following command:\n\n  ```ssh\n    $docker run -it -p 4222:4222 -p 6060:6060 -v /home/rishikesh/Desktop/nats-data:/home/nats/configuration nats-api-server:0.0.1\n  ```\n\n## Kubernetes\n\nYou can run this setup in kubernetes also by using this [yaml file](https://github.com/rishikeshbedre/nats-api-server/blob/master/extras/nats-api-server.yaml):\n\n  ```ssh\n    $kubectl apply -f ./nats-api-server.yaml\n  ```\n\n## Testing\n\nTo run test just run following command:\n\n  ```ssh\n    $go mod download\n    $make test\n  ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frishikeshbedre%2Fnats-api-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frishikeshbedre%2Fnats-api-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frishikeshbedre%2Fnats-api-server/lists"}