{"id":24308950,"url":"https://github.com/marktawa/supreme-disco","last_synced_at":"2026-05-08T06:05:21.996Z","repository":{"id":272705785,"uuid":"917490746","full_name":"Marktawa/supreme-disco","owner":"Marktawa","description":"Filter deeply nested results in Strapi","archived":false,"fork":false,"pushed_at":"2025-02-07T10:56:40.000Z","size":1006,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-06T20:17:20.845Z","etag":null,"topics":["cms","filter","javascript","koajs","nodejs","strapi","webdev"],"latest_commit_sha":null,"homepage":"https://strapi.io/blog/deep-filtering-alpha-26","language":"JavaScript","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/Marktawa.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":"2025-01-16T04:52:41.000Z","updated_at":"2025-02-07T11:03:39.000Z","dependencies_parsed_at":"2025-01-16T06:39:13.105Z","dependency_job_id":null,"html_url":"https://github.com/Marktawa/supreme-disco","commit_stats":null,"previous_names":["marktawa/supreme-disco"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marktawa%2Fsupreme-disco","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marktawa%2Fsupreme-disco/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marktawa%2Fsupreme-disco/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marktawa%2Fsupreme-disco/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Marktawa","download_url":"https://codeload.github.com/Marktawa/supreme-disco/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242277694,"owners_count":20101545,"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":["cms","filter","javascript","koajs","nodejs","strapi","webdev"],"created_at":"2025-01-17T05:11:59.282Z","updated_at":"2026-05-08T06:05:16.946Z","avatar_url":"https://github.com/Marktawa.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# How to Filter deeply nested results in Strapi\n\n![cover](cover.jpg)\n\n## Description\n\nThis repository contains the source code for the article: [How to Filter Results on Deeply-Nested fields in Strapi](https://strapi.io/blog/deep-filtering-alpha-26), written for [Strapi's Blog](https://strapi.io/blog).\n\n## Prerequisites\n\nTo test out the source code you will need the following installed:\n- [Node.js LTS v18 or v20](https://nodejs.org)\n\n## Getting started\n\nClone the repository.\n```bash\ngit clone https://github.com/Marktawa/supreme-disco.git\n```\n\n## Install dependencies\n\n```bash\ncd supreme-disco/my-strapi-project\n```\n\n```bash\nnpm install\n```\n\n## Setup environment variables.\n\n```bash\ncp .env.example .env\n```\n\n## Register Admin\n\nCreate admin user with email `chef@strapi.io` and password `Gourmet1234`.\n```bash\nnpm run strapi admin:create-user -- --firstname=Kai --lastname=Doe --email=chef@strapi.io --password=Gourmet1234\n```\n\n## Test out code\n\nRun your Strapi app.\n```bash\nnpm run develop\n```\n\nLogin to your Strapi admin by visiting [localhost:1337/admin](http://localhost:1337/admin) and login using admin user with email `chef@strapi.io` and password `Gourmet1234`.\n\n![Strapi Admin Login](https://res.cloudinary.com/craigsims808/image/upload/v1737184283/strapi/strapi-railway/strapi-admin-login_mxcmfn.png)\n\nClicking on **Login** gives you the Strapi Admin Dashboard Home page:\n\n![Strapi Admin Dashboard Home Page](https://res.cloudinary.com/craigsims808/image/upload/v1738201442/strapi/strapi-next-auth/strapi_admin_ja7t4h.png)\n\n\nCheck to see if Public Read access to your API is enabled\n\nClick on `Settings` \u003e `Users \u0026 Permissions Plugin` \u003e `Roles` \u003e `Public` \u003e `Permissions`.\n\nIf not enable Public Read access to your `Book` and `Author` collection API. \n\n![Enable Public Access to API](https://res.cloudinary.com/craigsims808/image/upload/v1738925158/strapi/supreme-ocean/enable-public-access-collection_z0wj6d.png)\n\n## Deep Filtering Using the REST API\n\nRun the following command in your terminal:\n```shell\ncurl --globoff localhost:1337/api/books?filters\\[authors\\][hobby][$contains]=dance\n```\n\nYou should get the following response:\n```json\n{\n    \"data\": [\n        {\n            \"id\": 10,\n            \"documentId\": \"kte9yxf6oami3680br3gapfl\",\n            \"title\": \"How to be Flexible\",\n            \"createdAt\": \"2025-01-16T05:49:53.037Z\",\n            \"updatedAt\": \"2025-01-16T06:06:43.838Z\",\n            \"publishedAt\": \"2025-01-16T06:06:43.851Z\"\n        },\n        {\n            \"id\": 6,\n            \"documentId\": \"mfnvnveobtf4fzporv9k2z3x\",\n            \"title\": \"How to Dance\",\n            \"createdAt\": \"2025-01-16T05:49:27.517Z\",\n            \"updatedAt\": \"2025-01-16T05:49:27.517Z\",\n            \"publishedAt\": \"2025-01-16T05:49:27.522Z\"\n        }\n    ],\n    \"meta\": {\n        \"pagination\": {\n            \"page\": 1,\n            \"pageSize\": 25,\n            \"pageCount\": 1,\n            \"total\": 2\n        }\n    }\n}\n```\n\n## Deep Filtering Using the Document Service API\n\n\u003e*NOTE: Instructions apply for `Query Engine API` and `Entity Service API` as well*\n\nRun the following command in your terminal:\n```shell\ncurl localhost:1337/api/dance-books\n```\n\nExpected response:\n```json\n[\n    {\n        \"id\": 5,\n        \"documentId\": \"mfnvnveobtf4fzporv9k2z3x\",\n        \"title\": \"How to Dance\",\n        \"createdAt\": \"2025-01-16T05:49:27.517Z\",\n        \"updatedAt\": \"2025-01-16T05:49:27.517Z\",\n        \"publishedAt\": null,\n        \"locale\": null\n    },\n    {\n        \"id\": 7,\n        \"documentId\": \"kte9yxf6oami3680br3gapfl\",\n        \"title\": \"How to be Flexible\",\n        \"createdAt\": \"2025-01-16T05:49:53.037Z\",\n        \"updatedAt\": \"2025-01-16T06:06:43.838Z\",\n        \"publishedAt\": null,\n        \"locale\": null\n    }\n]\n```\n\n## Deep Filtering Using the GraphQL API\n\nNavigate to GraphQL Playground. [localhost:1337/graphql](http://localhost:1337/graphql)\n\nThe following GraphQL query will give back all the books whose author’s hobby contains the word “dance”:\n\n```js\nquery {\n  books (filters: { authors:{hobby : { contains: \"dance\" }}} ){\n    authors {\n      hobby\n    }\n    title\n  }\n}\n```\n\nThe playground should look like the image below:\n\n![A GraphQL playground demonstrating the deep-filtering capabilities of Strapi](https://hackmd.io/_uploads/SkgyihLwJe.png)\n\n## Resources\n\n- [Article](https://strapi.io/blog/deep-filtering-alpha-26)\n- [REST API Docs](https://docs.strapi.io/dev-docs/api/rest)\n- [Document Service API Docs](https://docs.strapi.io/dev-docs/api/document-service)\n- [Query Engine API Docs](https://docs.strapi.io/dev-docs/api/query-engine)\n- [GraphQL API Docs](https://docs.strapi.io/dev-docs/api/graphql)\n- [Entity Service API Docs](https://docs.strapi.io/dev-docs/api/entity-service)\n\n![Second Cover](authorcover.jpg)\n\n## Author\n\nMark Munyaka  \n[dev.to/markmunyaka](https://dev.to/markmunyaka)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarktawa%2Fsupreme-disco","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarktawa%2Fsupreme-disco","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarktawa%2Fsupreme-disco/lists"}