{"id":18485265,"url":"https://github.com/softinstigate/restheart-plugin-skeleton","last_synced_at":"2025-10-04T13:54:39.079Z","repository":{"id":55616565,"uuid":"307667068","full_name":"SoftInstigate/restheart-plugin-skeleton","owner":"SoftInstigate","description":"Skeleton project for developing RESTHeart plugins","archived":false,"fork":false,"pushed_at":"2024-10-16T09:56:42.000Z","size":233,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-18T04:43:19.037Z","etag":null,"topics":["development","java","mongodb","plugin","restheart"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SoftInstigate.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-10-27T10:44:12.000Z","updated_at":"2024-10-16T09:56:46.000Z","dependencies_parsed_at":"2024-10-18T07:35:12.170Z","dependency_job_id":null,"html_url":"https://github.com/SoftInstigate/restheart-plugin-skeleton","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SoftInstigate%2Frestheart-plugin-skeleton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SoftInstigate%2Frestheart-plugin-skeleton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SoftInstigate%2Frestheart-plugin-skeleton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SoftInstigate%2Frestheart-plugin-skeleton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SoftInstigate","download_url":"https://codeload.github.com/SoftInstigate/restheart-plugin-skeleton/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223342774,"owners_count":17129921,"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":["development","java","mongodb","plugin","restheart"],"created_at":"2024-11-06T12:44:40.868Z","updated_at":"2025-10-04T13:54:34.038Z","avatar_url":"https://github.com/SoftInstigate.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RESTHeart Plugin Skeleton\n\nThis repository provides a skeleton project for developing plugins for RESTHeart, a REST API platform for MongoDB.\n\nDocumentation for plugins development is available at [https://restheart.org/docs/plugins/overview/](https://restheart.org/docs/plugins/overview/).\n\nCheck also the [RESTHeart Greetings Services Tutorial](https://restheart.org/docs/plugins/tutorial)\n\n---\n\n## Requirements\n\n- **Java 21+ (or GraalVM 21+)**: Required to compile and run the plugin.\n- **Docker**: Used to containerize and run RESTHeart.\n\n---\n\n## Quick Start\n\n### Use the RESTHeart command line interface\n\n🚀 To run and develop this project you can now use the new [RESTHeart command line interface](https://github.com/SoftInstigate/restheart-cli/tree/master). It provides a convenient interface for watching for code changes and automatically rebuilding/redeploying RESTHeart plugins.\n\nAfter you have installed the cli, follow its [Usage Guide](https://github.com/SoftInstigate/restheart-cli/blob/master/usage-guide.md). It explains how to start from this plugin skeleton to create a __continuous development process__.\n\n### Run with Docker\n\nFollow these steps if you prefer to set up and run the project with docker:\n\n1. Clone the repository:\n   ```bash\n   $ git clone --depth 1 git@github.com:SoftInstigate/restheart-plugin-skeleton.git\n   ```\n2. Navigate to the project directory:\n   ```bash\n   $ cd restheart-plugin-skeleton\n   ```\n3. Build and run the container:\n   ```bash\n   $ ./mvnw clean package \u0026\u0026 docker run --pull=always --name restheart --rm -p \"8080:8080\" -v ./target:/opt/restheart/plugins/custom softinstigate/restheart -s\n   ```\n\n\u003e **Note:** The `-s` option (**standalone mode**) disables MongoDB-dependent plugins. Use this option if you do not intend to connect to a MongoDB instance during runtime.\n\nTest the service using:\n\nWith curl:\n```bash\n$ curl localhost:8080/srv\n{\"message\":\"Hello World!\",\"rnd\":\"njXZksfKFW\"}%\n```\n\nWith httpie:\n```bash\n$ http -b :8080/srv\n{\n    \"message\": \"Hello World!\",\n    \"rnd\": \"KvQGBwsPBp\"\n}\n```\n\n---\n\n## Run RESTHeart with MongoDB\n\n⚠️ **Warning:** This setup is insecure and should only be used for development or testing.\n\nTo run RESTHeart with MongoDB, follow these steps:\n\n1. Launch a MongoDB container:\n   ```bash\n   $ docker run -d --name mongodb -p 27017:27017 mongo --replSet=rs0\n   ```\n2. Initialize MongoDB as a Single Node Replica Set:\n   ```bash\n   $ docker exec mongodb mongosh --quiet --eval \"rs.initiate()\"\n   ```\n3. Build and run the RESTHeart container:\n   ```bash\n   $ ./mvnw clean package \u0026\u0026 docker run --name restheart --rm -p \"8080:8080\" -v ./target:/opt/restheart/plugins/custom softinstigate/restheart\n   ```\n\n\u003e **Note:** The `-s` option is not used here to enable MongoDB-dependent plugins.\n\nTest a simple GET request:\n```bash\n$ curl -u admin:secret localhost:8080/users\n```\n\nFor more details, check the [REST API Tutorial](https://restheart.org/docs/mongodb-rest/tutorial) and the [GraphQL Tutorial](https://restheart.org/docs/mongodb-graphql/tutorial).\n\n---\n\n## RESTHeart Configuration\n\nThe default configuration is used. The environment variable `RHO` can be used to override the configuration. See [Change the configuration in Docker container](https://restheart.org/docs/configuration#change-the-configuration-in-docker-container)\n\nExample:\n```bash\n$ docker run --name restheart --rm     -e RHO=\"/http-listener/host-\u003e'0.0.0.0';/mclient/connection-string-\u003e'mongodb://host.docker.internal';/helloWorldService/message-\u003e'Ciao Mondo!'\"     -p \"8080:8080\"     -v ./target:/opt/restheart/plugins/custom     softinstigate/restheart -s\n```\n\nHere, the `RHO` variable overrides:\n- `/http-listener/host`: Sets the host to `0.0.0.0`.\n- `/mclient/connection-string`: Specifies the MongoDB connection string.\n- `/helloWorldService/message`: Changes the default service message to \"Ciao Mondo!\".\n\n```bash\n$ curl localhost:8080/srv\n{\"message\":\"Ciao Mondo!\",\"rnd\":\"rhyXFHOQUA\"}%\n```\n\n---\n\n## Dependencies\n\nDependencies are managed using Maven. By default, jars are copied to the `target/lib` directory by the `maven-dependency-plugin`. These jars are automatically added to the classpath by RESTHeart.\n\n### Avoid Duplicate JARs\n\nRESTHeart includes several libraries by default. To avoid conflicts:\n- Use the `provided` scope for dependencies already included in RESTHeart.\n\nExample:\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.restheart\u003c/groupId\u003e\n    \u003cartifactId\u003erestheart-commons\u003c/artifactId\u003e\n    \u003cversion\u003e${restheart.version}\u003c/version\u003e\n    \u003cscope\u003eprovided\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n\nTo list included libraries:\n```bash\n$ git clone https://github.com/SoftInstigate/restheart.git \u0026\u0026 cd restheart\n$ mvn dependency:tree -Dscope=compile\n```\n\n---\n\n## Build Native Image\n\nRESTHeart supports building native images with GraalVM for optimized startup time and memory usage.\n\n### Requirements\n- Install GraalVM using [sdkman](https://sdkman.io/):\n  ```bash\n  $ sdk install java 21.0.3-graal\n  ```\n\n### Build and Run Native Image\n\n1. Build the native image:\n   ```bash\n   $ ./mvnw clean package -Pnative\n   ```\n2. Run the binary:\n   ```bash\n   $ RHO=\"/fullAuthorizer/enabled-\u003etrue\" target/restheart-plugin-skeleton\n   ```\n\nFor more details, check [Deploy Java Plugins on RESTHeart native](https://restheart.org/docs/plugins/deploy#deploy-java-plugins-on-restheart-native).\n\n---\n\n## Maven Profiles\n\n### Available Profiles\n\n| Profile ID             | Description                                                                       |\n| ---------------------- | --------------------------------------------------------------------------------- |\n| `native`               | Builds a native image using GraalVM with custom plugins.                          |\n| `security`             | Includes the `restheart-security` module for advanced security.                   |\n| `mongodb`              | Adds MongoDB support with the `restheart-mongodb` module.                         |\n| `graphql`              | Enables GraphQL APIs using the `restheart-graphql` module.                        |\n| `mongoclient-provider` | Provides a MongoClient provider with the `restheart-mongoclient-provider` module. |\n| `metrics`              | Adds monitoring capabilities with the `restheart-metrics` module.                 |\n\n### Using Maven Profiles\n\nActivate a profile with the `-P` option:\n```bash\n$ ./mvnw clean package -Psecurity\n```\n\nCombine profiles as needed:\n```bash\n$ ./mvnw clean package -Psecurity,mongodb\n```\n\nFor more details, refer to the `pom.xml` file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftinstigate%2Frestheart-plugin-skeleton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoftinstigate%2Frestheart-plugin-skeleton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftinstigate%2Frestheart-plugin-skeleton/lists"}