{"id":15152969,"url":"https://github.com/consensys/mahuta","last_synced_at":"2025-04-06T12:11:28.385Z","repository":{"id":42561865,"uuid":"121661420","full_name":"Consensys/Mahuta","owner":"Consensys","description":"IPFS Storage service with search capability","archived":false,"fork":false,"pushed_at":"2024-06-24T13:23:57.000Z","size":1047,"stargazers_count":242,"open_issues_count":17,"forks_count":49,"subscribers_count":39,"default_branch":"master","last_synced_at":"2025-04-06T12:11:20.294Z","etag":null,"topics":["caching","elasticsearch","ipfs","search-engine"],"latest_commit_sha":null,"homepage":null,"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/Consensys.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":"2018-02-15T17:51:49.000Z","updated_at":"2025-04-04T03:04:27.000Z","dependencies_parsed_at":"2024-01-05T20:46:57.140Z","dependency_job_id":"abe80941-40cf-4734-8c08-a9ca4d1d827f","html_url":"https://github.com/Consensys/Mahuta","commit_stats":{"total_commits":408,"total_committers":9,"mean_commits":"45.333333333333336","dds":0.5612745098039216,"last_synced_commit":"548340375af577931eda9005ed4dbc43fb24fbe8"},"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Consensys%2FMahuta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Consensys%2FMahuta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Consensys%2FMahuta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Consensys%2FMahuta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Consensys","download_url":"https://codeload.github.com/Consensys/Mahuta/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247478324,"owners_count":20945266,"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":["caching","elasticsearch","ipfs","search-engine"],"created_at":"2024-09-26T16:42:25.599Z","updated_at":"2025-04-06T12:11:28.365Z","avatar_url":"https://github.com/Consensys.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"Mahuta\n======\n\n**Mahuta** (formerly known as IPFS-Store) is a library to aggregate and consolidate files or documents stored by your application on the IPFS network. It provides a solution to collect, store, index, cache and search IPFS data handled by your system in a convenient way.\n\n## Project status\n\n| Service | Master | Development |\n| -------- | -------- | -------- |\n| CI Status | ![](https://img.shields.io/circleci/project/github/ConsenSys/Mahuta/master.svg) | ![](https://img.shields.io/circleci/project/github/ConsenSys/Mahuta/development.svg) |\n| Test Coverage | [![Coverage](https://coveralls.io/repos/github/ConsenSys/Mahuta/badge.svg?branch=master)](https://coveralls.io/github/ConsenSys/Mahuta?branch=master) | [![Coverage](https://coveralls.io/repos/github/ConsenSys/Mahuta/badge.svg?branch=development)](https://coveralls.io/github/ConsenSys/Mahuta?branch=development) |\n| Bintray | [ ![Bintray](https://api.bintray.com/packages/consensys/kauri/mahuta/images/download.svg) ](https://bintray.com/consensys/kauri/mahuta/_latestVersion) |\n| Docker | [![](https://img.shields.io/docker/pulls/gjeanmart/mahuta.svg?style=flat)](https://cloud.docker.com/repository/docker/gjeanmart/mahuta)|\n| Sonar | [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=gjeanmart_IPFS-Store\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=gjeanmart_IPFS-Store) |\n\n\n\n## Features\n\n- **Indexation**: Mahuta stores documents or files on IPFS and index the hash with optional metadata.\n- **Discovery**: Documents and files indexed can be searched using complex logical queries or fuzzy/full text search)\n- **Scalable**: Optimised for large scale applications using asynchronous writing mechanism and caching\n- **Replication**: Replica set can be configured to replicate (pin) content across multiple nodes (standard IPFS node or IPFS-cluster node)\n- **Multi-platform**: Mahuta can be used as a simple embedded Java library for your JVM-based application or run as a simple, scalable and configurable Rest API.\n\n\n![Mahuta.jpg](https://imgur.com/tIdQRD8.png)\n\n\n-------------------------------------------------------------------------\n\n\n## Getting Started\n\nThese instructions will get you a copy of the project up and running on your local machine for development and testing purposes.\n\n#### Prerequisites\n\nMahuta depends of two components:\n- an IPFS node ([go](https://github.com/ipfs/go-ipfs) or [js](https://github.com/ipfs/js-ipfs) implementation)\n- a search engine (currently only ElasticSearch is supported)\n\nSee how to run those two components first [run IPFS and ElasticSearch](https://github.com/ConsenSys/Mahuta/blob/master/mahuta-docs/run_ipfs_and_elasticsearch.md)\n\n## Java library\n\n1. Import the Maven dependencies (core module + indexer)\n\n```xml\n\u003crepository\u003e\n    \u003cid\u003econsensys-kauri\u003c/id\u003e\n    \u003cname\u003econsensys-kauri\u003c/name\u003e\n    \u003curl\u003ehttps://consensys.bintray.com/kauri/\u003c/url\u003e\n\u003c/repository\u003e\n```    \n\n````xml\n\u003cdependency\u003e\n    \u003cgroupId\u003enet.consensys.mahuta\u003c/groupId\u003e\n    \u003cartifactId\u003emahuta-core\u003c/artifactId\u003e\n    \u003cversion\u003e${MAHUTA_VERSION}\u003c/version\u003e\n\u003c/dependency\u003e\n\u003cdependency\u003e\n    \u003cgroupId\u003enet.consensys.mahuta\u003c/groupId\u003e\n    \u003cartifactId\u003emahuta-indexing-elasticsearch\u003c/artifactId\u003e\n    \u003cversion\u003e${MAHUTA_VERSION}\u003c/version\u003e\n\u003c/dependency\u003e\n````\n\n2. Configure Mahuta to connect to an IPFS node and an indexer\n\n```\nMahuta mahuta = new MahutaFactory()\n    .configureStorage(IPFSService.connect(\"localhost\", 5001))\n    .configureIndexer(ElasticSearchService.connect(\"localhost\", 9300, \"cluster-name\"))\n    .defaultImplementation();\n```\n\n3. Execute high-level operations\n\n```\nIndexingResponse response = mahuta.prepareStringIndexing(\"article\", \"## This is my first article\")\n    .contentType(\"text/markdown\")\n    .indexDocId(\"article-1\")\n    .indexFields(ImmutableMap.of(\"title\", \"First Article\", \"author\", \"greg\"))\n    .execute();\n    \nGetResponse response = mahuta.prepareGet()\n    .indexName(\"article\")\n    .indexDocId(\"article-1\")\n    .loadFile(true)\n    .execute();\n    \nSearchResponse response = mahuta.prepareSearch()\n    .indexName(\"article\")\n    .query(Query.newQuery().equals(\"author\", \"greg\"))\n    .pageRequest(PageRequest.of(0, 20))\n    .execute();\n```\n\nFor more info, [Mahuta Java API](https://github.com/ConsenSys/Mahuta/blob/master/mahuta-docs/mahuta_java_api.md)\n\n## Spring-Data\n\n1. Import the Maven dependencies \n\n````\n\u003cdependency\u003e\n    \u003cgroupId\u003enet.consensys.mahuta\u003c/groupId\u003e\n    \u003cartifactId\u003emahuta-springdata\u003c/artifactId\u003e\n    \u003cversion\u003e${MAHUTA_VERSION}\u003c/version\u003e\n\u003c/dependency\u003e\n````\n\n2. Configure your spring-data repository\n\n```\n@IPFSDocument(index = \"article\", indexConfiguration = \"article_mapping.json\", indexContent = true)\npublic class Article {\n    \n    @Id\n    private String id;\n\n    @Hash\n    private String hash;\n\n    @Fulltext\n    private String title;\n\n    @Fulltext\n    private String content;\n\n    @Indexfield\n    private Date createdAt;\n\n    @Indexfield\n    private String createdBy;\n}\n\n\n\npublic class ArticleRepository extends MahutaRepositoryImpl\u003cArticle, String\u003e {\n\n    public ArticleRepository(Mahuta mahuta) {\n        super(mahuta);\n    }\n}\n```\n\n\nFor more info, [Mahuta Spring Data](https://github.com/ConsenSys/Mahuta/blob/master/mahuta-docs/mahuta_spring_data.md)\n\n\n## HTTP API with Docker\n\n### Prerequisites\n\n- Docker\n- [run IPFS and ElasticSearch with Docker](https://github.com/ConsenSys/Mahuta/blob/master/mahuta-docs/run_ipfs_and_elasticsearch.md#Docker)\n\n\n### Docker\n\n```\n$ docker run -it --name mahuta \\ \n    -p 8040:8040 \\\n    -e MAHUTA_IPFS_HOST=ipfs \\\n    -e MAHUTA_ELASTICSEARCH_HOST=elasticsearch \\\n    gjeanmart/mahuta\n```\n\n### Docker Compose\n\nCheck out the [documentation](https://github.com/ConsenSys/Mahuta/blob/master/mahuta-docs/mahuta_docker-compose.md) to configure Mahuta HTTP-API with Docker.\n\n### Examples\n\nTo access the API documentation, go to [Mahuta HTTP API](https://github.com/ConsenSys/Mahuta/blob/master/mahuta-docs/mahuta_http-api.md)\n\n#### Create the index `article` \n\n-   *Sample Request:*\n\n```\ncurl -X POST \\\n  http://localhost:8040/mahuta/config/index/article \\\n  -H 'Content-Type: application/json' \n```\n\n-   *Success Response:*\n\n    -   Code: 200  \n        Content:\n```\n{\n    \"status\": \"SUCCESS\"\n}\n```\n\n#### Store and index an article and its metadata\n\n-   *Sample Request:*\n\n```\ncurl -X POST \\\n  'http://localhost:8040/mahuta/index' \\\n  -H 'content-type: application/json' \\\n  -d '{\"content\":\"# Hello world,\\n this is my first file stored on **IPFS**\",\"indexName\":\"article\",\"indexDocId\":\"hello_world\",\"contentType\":\"text/markdown\",\"index_fields\":{\"title\":\"Hello world\",\"author\":\"Gregoire Jeanmart\",\"votes\":10,\"date_created\":1518700549,\"tags\":[\"general\"]}}'\n```\n\n-   *Success Response:*\n\n    -   Code: 200  \n        Content:\n```\n{\n  \"indexName\": \"article\",\n  \"indexDocId\": \"hello_world\",\n  \"contentId\": \"QmWHR4e1JHMs2h7XtbDsS9r2oQkyuzVr5bHdkEMYiqfeNm\",\n  \"contentType\": \"text/markdown\",\n  \"content\": null,\n  \"pinned\": true,\n  \"indexFields\": {\n    \"title\": \"Hello world\",\n    \"author\": \"Gregoire Jeanmart\",\n    \"votes\": 10,\n    \"createAt\": 1518700549,\n    \"tags\": [\n      \"general\"\n    ]\n  },\n  \"status\": \"SUCCESS\"\n}\n```\n\n#### Search by query\n\n\n-   *Sample Request:*\n\n```\ncurl -X POST \\\n 'http://localhost:8040/mahuta/query/search?index=article' \\\n -H 'content-type: application/json' \\\n -d '{\"query\":[{\"name\":\"title\",\"operation\":\"CONTAINS\",\"value\":\"Hello\"},{\"name\":\"author.keyword\",\"operation\":\"EQUALS\",\"value\":\"Gregoire Jeanmart\"},{\"name\":\"votes\",\"operation\":\"GT\",\"value\":\"5\"}]}'\n```\n\n-   *Success Response:*\n\n    -   Code: 200  \n        Content:\n\n```\n{\n  \"status\": \"SUCCESS\",\n  \"page\": {\n    \"pageRequest\": {\n      \"page\": 0,\n      \"size\": 20,\n      \"sort\": null,\n      \"direction\": \"ASC\"\n    },\n    \"elements\": [\n      {\n        \"metadata\": {\n          \"indexName\": \"article\",\n          \"indexDocId\": \"hello_world\",\n          \"contentId\": \"Qmd6VkHiLbLPncVQiewQe3SBP8rrG96HTkYkLbMzMe6tP2\",\n          \"contentType\": \"text/markdown\",\n          \"content\": null,\n          \"pinned\": true,\n          \"indexFields\": {\n            \"author\": \"Gregoire Jeanmart\",\n            \"votes\": 10,\n            \"title\": \"Hello world\",\n            \"createAt\": 1518700549,\n            \"tags\": [\n              \"general\"\n            ]\n          }\n        },\n        \"payload\": null\n      }\n    ],\n    \"totalElements\": 1,\n    \"totalPages\": 1\n  }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconsensys%2Fmahuta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconsensys%2Fmahuta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconsensys%2Fmahuta/lists"}