{"id":19045446,"url":"https://github.com/marirs/rocketapi","last_synced_at":"2025-04-23T23:45:27.832Z","repository":{"id":55138693,"uuid":"326875819","full_name":"marirs/rocketapi","owner":"marirs","description":"API Rest Server using Rocket.rs","archived":false,"fork":false,"pushed_at":"2022-05-24T04:54:10.000Z","size":106,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-30T04:41:31.589Z","etag":null,"topics":["api","api-rest","boilerplate","boilerplate-application","mongodb","rocket","rust","rust-lang"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/marirs.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}},"created_at":"2021-01-05T03:32:01.000Z","updated_at":"2024-07-31T17:59:40.000Z","dependencies_parsed_at":"2022-08-14T13:10:35.962Z","dependency_job_id":null,"html_url":"https://github.com/marirs/rocketapi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marirs%2Frocketapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marirs%2Frocketapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marirs%2Frocketapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marirs%2Frocketapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marirs","download_url":"https://codeload.github.com/marirs/rocketapi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249369208,"owners_count":21258977,"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":["api","api-rest","boilerplate","boilerplate-application","mongodb","rocket","rust","rust-lang"],"created_at":"2024-11-08T22:50:14.559Z","updated_at":"2025-04-17T19:31:40.989Z","avatar_url":"https://github.com/marirs.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"API REST Server using Rocket.rs\n--------------------------------\n[![Linux Arm7](https://github.com/marirs/rocketapi/actions/workflows/linux_arm.yml/badge.svg)](https://github.com/marirs/rocketapi/actions/workflows/linux_arm.yml)\n[![Linux x86_64](https://github.com/marirs/rocketapi/actions/workflows/linux_x86_64.yml/badge.svg)](https://github.com/marirs/rocketapi/actions/workflows/linux_x86_64.yml)\n[![macOS intel](https://github.com/marirs/rocketapi/actions/workflows/macos_x86_64.yml/badge.svg)](https://github.com/marirs/rocketapi/actions/workflows/macos_x86_64.yml)\n\nA Skeleton API Rest server using [Rocket](https://rocket.rs/) with the backend database as [MongoDB](https://www.mongodb.com/).\n\n### Features\n- Custom config file defining:\n    - server host ip and port to listen\n    - enable/disable ssl with ssl cert auto generation\n    - mongodb configurations\n- Use the `x-api-key` header to validate `API Keys`\n- `Restrict` a client connecting IP Addresses to the endpoints using `Allow ACL`\n- `Restrict` endpoints using the `Deny ACL`\n- `Rate limiter` to throttle incoming requests to endpoints\n- Extend this rocketapi server's boiler plate; with your endpoints\n\n![architecture](docs/rocketapi.png \"Architecture\")\n\n### Requirements\n\n- Rust 1.56+ (2021 edition)\n\n---\n### Compile\n\n```bash\ncargo build --release\n```\n\n- Sample config file is available at `config.sample.yml`\n\n### Starting the server\n```bash\n./target/release/rocketapi -f config.sample.yml\n```\n\n### Available endpoints\n\n- Index/User management endpoint\n\n| Description | Endpoint | Method |\n| --- | --- | --- |\n| Api index | `/` | GET |\n| List all Users | `/users` | GET |\n| Create user | `/users` | POST |\n| Update user | `/users` | PUT |\n| Delete user | `/users/\u003cEmail\u003e` | DELETE |\n\n### POST Request for `new user creation` / `user update`\nThe below example goes into json body of POST/PUT request while creating a new user\n```\n{\n  \"email\": \"email\",\n  \"description\": \"...\",\n  \"is_admin\": false,\n  \"acl_allow_ips\": [\"127.0.0.1\", \"\u003cIP_ADDRESS\u003e\"] // use [\"*\"] if you want to allow from any IP\n  \"acl_allow_endpoints\": {\n    \"name\": \"/endpoint_name\",\n    \"method\": \"GET\", // use \"*\" if you want any methods to be allowed for this endpoint \n    \"throttle\": \"4/min\" // can use sec|min|hour|day\n  }\n}\n```\n\n### Seed data \u0026 Configuration\n\n- Example with rate-limit (throttle)\n```json\n{\n  \"created_ip\" : \"127.0.0.1\",\n  \"created_by\" : \"email\",\n  \"created_at\" : \"2021-08-02T00:00:00Z\",\n  \"email\" : \"email\",\n  \"description\": \"...\",\n  \"api_key\" : \"apikey123\",\n  \"is_admin\" : true,\n  \"acl_allow_ips\" : [\n    \"*\"\n  ],\n  \"acl_allow_endpoints\": [\n    {\"name\": \"/fair\", \"method\": \"*\", \"throttle\": \"4/min\"}\n  ]\n}\n```\n- Example without rate-limit\n```json\n{\n  \"created_ip\" : \"127.0.0.1\",\n  \"created_by\" : \"email\",\n  \"created_at\" : \"2021-08-02T00:00:00Z\",\n  \"email\" : \"email\",\n  \"description\": \"...\",\n  \"api_key\" : \"apikey123\",\n  \"is_admin\" : true,\n  \"acl_allow_ips\" : [\n    \"*\"\n  ],\n  \"acl_allow_endpoints\": [\n    {\"name\": \"*\", \"method\": \"*\"} \n  ]\n}\n````\n\n### Configs\nThe `configs` folder has configurations to start the server as a service and nginx config to server this rocketapi server in reverse proxy mode.\n- Start the rocketapi server as a service\n```text\n1) copy the configs/rocketapi.service to /etc/systemd/system folder\n2) systemctl enable rocketapi\n3) systemctl start rocketapi\n```\n\n- Then you can copy the `configs/nginx.vhost` to `/etc/nginx/sites-enabled` to access the rocketapi server via nginx.\n\n---\n\nIf you need a python version, a python fastapi version can be found [here](https://github.com/marirs/fastapi-boilerplate).\n\n---\n### Contribution\n\nFeel free to make pull requests and make this better and/or contribute to its features.\n\n---\nLicensed under the Apache License, Version 2.0\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarirs%2Frocketapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarirs%2Frocketapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarirs%2Frocketapi/lists"}