{"id":16272044,"url":"https://github.com/sshh12/terrain-diffusion-app","last_synced_at":"2025-09-08T00:02:35.996Z","repository":{"id":189838305,"uuid":"681406835","full_name":"sshh12/terrain-diffusion-app","owner":"sshh12","description":"An infinite collaborative inpainter which allows users to dynamic generate satellite-realistic map tiles.","archived":false,"fork":false,"pushed_at":"2024-12-07T19:03:52.000Z","size":379,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-08T00:02:12.988Z","etag":null,"topics":["ably","image-editor","inpainting","procedural-generation","sentinel-2","stable-diffusion","world-building"],"latest_commit_sha":null,"homepage":"https://terrain.sshh.io","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/sshh12.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,"zenodo":null}},"created_at":"2023-08-22T00:33:06.000Z","updated_at":"2025-03-18T12:29:39.000Z","dependencies_parsed_at":"2023-08-22T02:15:26.595Z","dependency_job_id":"c34e4ac0-bf99-4367-93d8-1c6aa3c681b8","html_url":"https://github.com/sshh12/terrain-diffusion-app","commit_stats":{"total_commits":52,"total_committers":1,"mean_commits":52.0,"dds":0.0,"last_synced_commit":"55acd9ff3ca7b1467d36e96a175130f778cb712d"},"previous_names":["sshh12/terrain-diffusion-app"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sshh12/terrain-diffusion-app","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshh12%2Fterrain-diffusion-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshh12%2Fterrain-diffusion-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshh12%2Fterrain-diffusion-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshh12%2Fterrain-diffusion-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sshh12","download_url":"https://codeload.github.com/sshh12/terrain-diffusion-app/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshh12%2Fterrain-diffusion-app/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274113089,"owners_count":25224335,"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","status":"online","status_checked_at":"2025-09-07T02:00:09.463Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["ably","image-editor","inpainting","procedural-generation","sentinel-2","stable-diffusion","world-building"],"created_at":"2024-10-10T18:15:54.238Z","updated_at":"2025-09-08T00:02:35.857Z","avatar_url":"https://github.com/sshh12.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# terrain-diffusion-app\n\n\u003e AKA This Map Does Not Exist, is an infinite collaborative inpainter which allows users to dynamic generate satellite-realistic map tiles.\n\n![chrome_2jH8rnJo9C](https://github.com/sshh12/terrain-diffusion-app/assets/6625384/3f339c6a-859e-4b8b-800f-4ff885a62c55)\n\n## How it works\n\n\u003cimg width=\"358\" alt=\"chrome_bx4n7yvh2k\" src=\"https://github.com/sshh12/terrain-diffusion-app/assets/6625384/541fc064-84ab-4e60-8458-839fcf5639c2\"\u003e\n\nThe app is pretty much serverless with [Ably](https://ably.io/) doing most of the live networking and communication between the client and the GPU worker. The GPU worker writes directly to AWS s3 and then notifies the client to re-download them. Netlify is mainly there for static hosting but a cloud function is used to init the Ably websocket.\n\nA slight later modification was to replace the GPU worker with a serverless modal app.\n\n#### The GPU Endpoint\n\nThe endpoint listens for generation requests and then:\n\n1. Translates an x, y coordinate into the (up to 4) 512x512 tiles that will need to be modified\n2. Download these tiles from s3 (if s3 doesn't have it just generate a blank image)\n3. Generate a mask based on any areas that are blank\n4. Run this through the stable diffusion inpainting model\n5. Update all the tiles and re-upload to s3\n6. Broadcast which tiles were updated\n\n### The Canvas\n\nThe canvas was written from scratch to support mobile and desktop without too much weirdness. `react-canvas-draw` was used heavily as a reference. It includes minimal optimizations for processing tiles besides lazy loading based on the client's viewport and background image rendering.\n\n## Model\n\nFor more information on training the model see https://github.com/sshh12/terrain-diffusion.\n\n## Self-Hosting\n\nAt a high level:\n\n1. Create a netlify static app from this repo\n2. Create an app on https://ably.io/ (free tier works) and set the environment variable `ABLY_API_KEY`\n3. Create an https://modal.com/ app and `cd modal \u0026\u0026 modal deploy modal_app`\n\nFeel free to create an issue if you want help setting this up. This app should work fairly seamlessly for any [diffusers](https://huggingface.co/docs/diffusers/index) model.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsshh12%2Fterrain-diffusion-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsshh12%2Fterrain-diffusion-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsshh12%2Fterrain-diffusion-app/lists"}