{"id":18003279,"url":"https://github.com/woss/ipfs-rehost-web-service","last_synced_at":"2026-05-06T11:36:25.036Z","repository":{"id":73162803,"uuid":"416408893","full_name":"woss/ipfs-rehost-web-service","owner":"woss","description":"Web service for re-hosting git repositories, cargo, and npm packages using the IPFS.","archived":false,"fork":false,"pushed_at":"2021-10-26T15:07:55.000Z","size":620,"stargazers_count":2,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-05T16:06:03.189Z","etag":null,"topics":["git","ipfs","rehosting"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/woss.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":"2021-10-12T16:12:07.000Z","updated_at":"2021-10-26T15:07:58.000Z","dependencies_parsed_at":"2023-04-03T12:17:29.099Z","dependency_job_id":null,"html_url":"https://github.com/woss/ipfs-rehost-web-service","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/woss/ipfs-rehost-web-service","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woss%2Fipfs-rehost-web-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woss%2Fipfs-rehost-web-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woss%2Fipfs-rehost-web-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woss%2Fipfs-rehost-web-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/woss","download_url":"https://codeload.github.com/woss/ipfs-rehost-web-service/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woss%2Fipfs-rehost-web-service/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32692329,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-06T08:33:17.875Z","status":"ssl_error","status_checked_at":"2026-05-06T08:33:17.221Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["git","ipfs","rehosting"],"created_at":"2024-10-29T23:26:11.052Z","updated_at":"2026-05-06T11:36:24.997Z","avatar_url":"https://github.com/woss.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ipfs-git-rehost-web-service\n\n**⚒️PoC and HEAVY work in progress**\n\nWeb service for re-hosting the git repositories using the IPFS.\n\n# Production\n\nIt's fairly stable, but run it on production at your own risk.\n\nSee [Building and running the project](#building-and-running-the-project) for more info\n\n# Development and running locally\n\nYou will need:\n\n- PNPM\n- nodejs\n- Docker\n- IPFS node\n- [GitHub personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)\n- editor (VsCode, nvim, ...)\n\nHow to start\n\n```sh\n# copy the env sample file\ncp env.sample .env\n\n# install deps\npnpm i\n\n# make sure you check .env and replace the variables with your own.\n\n# start server and worker. Server starts on the port 3000\npnpm start\n\n# lint and fix stuff\npnpm lint:fix\n```\n\nThere is a ENV variable called `IPFS_PIN` which you want to keep to `false` during the development.\n\n### Building and running the project\n\n#### Building a Docker image\n\nWith `docker-compose` it's easy. Run `docker-compose build rehost` and you will have the image build with all production deps installed.\n\nTo build and tag the latest version run `docker-compose build rehost_latest`\n\n#### Running the service with docker\n\nThe MongoDB is bundeled with, but you can use any mongodb service, just configure the `MONGODB_HOST` and `MONGODB_PORT` in your `.env` file and you are ready to go.\n\nYou can run the docker image from the https://hub.docker.com/r/woss/rehost-service\n\n# API endpoints\n\nBe aware that this is the PoC (ProofOfConcept) and the API is made to serve the purpose. It is NOT optimized or RESTfull.\n\nAll errors are in the format:\n\n```ts\ninterface ErrorResponse {\n  error: true\n  message: string\n}\n```\n\n## QUEUE API\n\n### ADD REPO TO RE-HOST QUEUE\n\nThis is your first stop to start re-hosting the repository. This `GET` endpoint will create the worker job and will return 3 different responses based on the state of the execution.\n\nThis is done intentionally like this since we want to be able to quickly re-host the repo in the browser. Basically you should remove the `https://` and add the `http://localhost:3000/v1/q/` or your own `https://my-rehost/v1/q/` prefix.\n\nThere are few query params that can be passed, one is important and determines the update of the repo. `update=true` query param means that the service will look for new commits to default branch ( only ) and re-host that commit. Previous re-host is NOT deleted.\n\n**REQUEST**\n\nGET `/v1/q/add/:host/:username/:repo`\n\nSignature for the url params are:\n\n```ts\nenum SupportedHosts {\n  GITHUB = 'github.com',\n  GITLAB = 'gitlab.com',\n}\n\ninterface AddQueuePArams {\n  host: SupportedHosts\n  username: string\n  repo: string\n}\n```\n\nSignature for the query params are:\n\n```ts\ninterface AddQueueQueryParams {\n  // unused ATM\n  rev?: string\n  // unused ATM\n  tag?: string\n  // this can be true or 1. the types are handeled properly\n  update?: string\n}\n```\n\nExample:\n\n`http://localhost:3000/v1/q/add/github.com/woss/ipfs-git-rehost-web-service`\n\n**RESPONSEs**\n\nThese are the possible responses:\n\n1. if IPFS node is not connected, error is returned with `STATUS_CODE=400`\n2. Repository check based on the `host`. If it doesn't exist error is returned with `STATUS_CODE=404`\n3. Job added, repo doesn't exist and it's not an update `STATUS_CODE=201`\n4. Job added, repo exists and it's an update `STATUS_CODE=201`\n5. Job not added, repo exists and it's an update `STATUS_CODE=200`\n6. Job not added, repo exists and it's not an update `STATUS_CODE=200`\n\nIn case of the `STATUS_CODE=201` and `STATUS_CODE=200` the response will contain the api URL with the `jobID` which can be followed later to see actual repo information.\n\n\u003e This is done intentionally!! Please don't raise issues for this.\n\nSignatures are:\n\nCase #3\n\n```js\n{\n  apiURL: `/v1/q/${job.attrs._id}`,\n  willUpdate: false,\n}\n```\n\nCase #4\n\n```js\n{\n  apiURL: `/v1/repo/${mongoDocument._id}`,\n  willUpdate: true,\n}\n```\n\nCase #5\n\n```js\n{\n  apiURL: `/v1/repo/${mongoDocument._id}`,\n  willUpdate: true,\n}\n```\n\nCase #6\n\n```js\n{\n  apiURL: `/v1/repo/${mongoDocument._id}`,\n  willUpdate: false,\n}\n```\n\n### GET INFO ON THE JOB\n\nThis endpoint will either show that the job is still running, error with `STATUS_CODE=404` if not found or it will return full re-host document.\n\nExample: `http://localhost:3000/v1/q/61682c90449fa8b7625be6b4`\n\n## REPOS API\n\n### ALL THE REPOS\n\nPaginated list of all the repos with all the re-host versions.\n\nThe hardcoded limit is `10` returned repos and no way to change it via the query param.\n\n\u003e This is done intentionally since the `rehosted` key can be quite big.\n\n**REQUEST**\n\nGET `/v1/repos`\n\n**RESPONSE**\n\nThe successful response has as signature:\n\n```ts\ninterface RehostedEmbedded {\n  cid: string\n  ipfsUrl: string\n  rev: string\n  tag: string\n  size: number\n}\ninterface RepositoryInfo {\n  name: string\n  userName: string\n  host: string\n}\n\ninterface Repository {\n  _id: ObjectId\n  repo: RepositoryInfo\n  repoUrl: string\n  rehosted: RehostedEmbedded[]\n  isFork: boolean\n  createdAt: number\n  updatedAt: number\n}\n\ninterface Response {\n  docs: Repository[]\n  total: number\n  pages: number\n}\n```\n\nExample: `http://localhost:3000/v1/repos`\n\n### SINGLE REPO\n\nGet the information on single repository retrieved by the `_id` field where the `:id` is the `_id` field from the `repos` endpoint.\n**REQUEST**\n\nGET `/v1/repo/:id`\n\n**RESPONSE**\n\n```ts\ninterface RehostedEmbedded {\n  cid: string\n  ipfsUrl: string\n  rev: string\n  tag: string\n  size: number\n}\n\ninterface RepositoryInfo {\n  name: string\n  userName: string\n  host: string\n}\n\ninterface Repository {\n  _id: ObjectId\n  repo: RepositoryInfo\n  repoUrl: string\n  rehosted: RehostedEmbedded[]\n  isFork: boolean\n  createdAt: number\n  updatedAt: number\n}\ninterface Response extends Repository {}\n```\n\nExample: `http://localhost:3000/v1/repo/61682fb7cbf2fcd9ec3d63a8`\n\n## RE-HOST API\n\nEvery re-hosted repository has a CID which is indexed unique identifier. On the DB level these records are part of the repository document and this endpoint returns only the one that matches the given CID.\n\nNote that the CID must be valid, otherwise the request will fail with the generic CID error.\n\n**REQUEST**\n\nGET `/v1/rehosted/:cid`\n\n**RESPONSE**\n\n```ts\ninterface RehostedEmbedded {\n  cid: string\n  ipfsUrl: string\n  rev: string\n  tag: string\n  size: number\n}\ninterface Response extends RehostedEmbedded {}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwoss%2Fipfs-rehost-web-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwoss%2Fipfs-rehost-web-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwoss%2Fipfs-rehost-web-service/lists"}