{"id":19721206,"url":"https://github.com/ipfs-search/nsfw-server","last_synced_at":"2025-07-08T11:07:04.296Z","repository":{"id":37823034,"uuid":"434235159","full_name":"ipfs-search/nsfw-server","owner":"ipfs-search","description":"A simple Node.js server to run nsfw.js for images from IPFS and return its results.","archived":false,"fork":false,"pushed_at":"2022-09-27T10:53:16.000Z","size":20410,"stargazers_count":7,"open_issues_count":11,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-12T16:32:09.792Z","etag":null,"topics":["ipfs","nodejs","nsfw","nsfwjs","tensorflowjs"],"latest_commit_sha":null,"homepage":"","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/ipfs-search.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}},"created_at":"2021-12-02T13:39:37.000Z","updated_at":"2024-11-26T21:12:50.000Z","dependencies_parsed_at":"2023-01-17T16:01:20.548Z","dependency_job_id":null,"html_url":"https://github.com/ipfs-search/nsfw-server","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ipfs-search/nsfw-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipfs-search%2Fnsfw-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipfs-search%2Fnsfw-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipfs-search%2Fnsfw-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipfs-search%2Fnsfw-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ipfs-search","download_url":"https://codeload.github.com/ipfs-search/nsfw-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipfs-search%2Fnsfw-server/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260282544,"owners_count":22985775,"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":["ipfs","nodejs","nsfw","nsfwjs","tensorflowjs"],"created_at":"2024-11-11T23:13:41.081Z","updated_at":"2025-07-08T11:07:04.259Z","avatar_url":"https://github.com/ipfs-search.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nsfw-server\n[![Pipeline Status](https://gitlab.com/ipfs-search.com/nsfw-server/badges/main/pipeline.svg)](https://gitlab.com/ipfs-search.com/nsfw-server/-/commits/main)\n[![Maintainability](https://api.codeclimate.com/v1/badges/21a5f471fb41d6c57eec/maintainability)](https://codeclimate.com/github/ipfs-search/nsfw-server/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/21a5f471fb41d6c57eec/test_coverage)](https://codeclimate.com/github/ipfs-search/nsfw-server/test_coverage)\n[![Backers on Open Collective](https://opencollective.com/ipfs-search/backers/badge.svg)](#backers)\n[![Sponsors on Open Collective](https://opencollective.com/ipfs-search/sponsors/badge.svg)](#sponsors)\n\nA microservice to run [nsfw.js](https://nsfwjs.com/) for images on IPFS.\n\n## Requirements\n* Node 16.x (LTS)\n* Python (Windows / Mac OS X Requires Python 2.7)\n* [Running IPFS daemon](https://docs.ipfs.io/how-to/command-line-quick-start/#command-line-quick-start) or [public IPFS gateway](https://docs.ipfs.io/concepts/ipfs-gateway/#gateway-providers) (not recommended, can be configured with environment variable)\n\n## Getting started\n### Install Node dependencies\n`npm install`\n\n### Start IPFS node\nIn a separate terminal, after installing a local IPFS daemon (see requirements):\n`ipfs daemon`\n\n### Start server\nRun (auto-reloading) dev server with full debug enabled:\n`env DEBUG=* npm run-script dev`\n\n### Example usage\n\n```sh\n$ curl -s http://localhost:3423/classify/bafkreiam7vh2raw2chmx6gllup6sd32xsicwus2riglpjtzlygz4lzmxbm | jq\n```\n(Wait a while... IPFS is slow. :/)\n\n```json\n{\n  \"classification\": {\n    \"neutral\": 0.9980410933494568,\n    \"drawing\": 0.001135041005909443,\n    \"porn\": 0.00050011818530038,\n    \"hentai\": 0.00016194644558709115,\n    \"sexy\": 0.00016178081568796188\n  },\n  \"modelCid\": \"QmfBNCmYLxwTr3CHaknd5HdzA6uXcTZqn1hsuLf8mRc3xS\",\n  \"nsfwServerVersion\": \"0.9.0\"\n}\n```\n\n### Production server\nRun in production mode:\n\n`env NODE_ENV=production NSFW_SERVER_PORT=3342 npm start`\n\n### Run tests\n`npm test`\n\n## Docker support\n### Build docker image (tagged as `nsfw-server`)\n\n`docker build -t nsfw-server .`\n\n### Run docker image in production on port 9000\n`docker run --env NODE_ENV=production -p 9000:3423 -t nsfw-server`\n\n## API\nTo classify an [IPLD CID](https://docs.ipfs.io/concepts/content-addressing/):\n\n`/classify/\u003ccid\u003e`\n\n## Supported formats\nWe're using TensorFlow's [decodeImage](https://js.tensorflow.org/api_node/1.2.7/#node.decodeImage), which detects and supports BMP, GIF, JPEG and PNG formats.\n\n## Configuration\nnsfw-server is configured through the following environment variables:\n* `IPFS_GATEWAY_URL`: Gateway to use for loading images. Defaults to `http://localhost:8080` (local node).\n* `NSFW_SERVER_HOST`: Host to run server on. Defaults to `localhost`.\n* `NSFW_SERVER_PORT`: Port to run server on. Defaults to `3423`.\n* `DEBUG`: [Debug](https://www.npmjs.com/package/debug) verbosity level.\n* `NODE_ENV`: Node environment. Set to `production` in ... production. Defaults to `development`.\n* `NSFW_MODEL`: NSFW model to use.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fipfs-search%2Fnsfw-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fipfs-search%2Fnsfw-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fipfs-search%2Fnsfw-server/lists"}