{"id":50721986,"url":"https://github.com/kai9987kai/scribble-diffusion","last_synced_at":"2026-06-10T01:01:23.071Z","repository":{"id":358854480,"uuid":"626572346","full_name":"kai9987kai/scribble-diffusion","owner":"kai9987kai","description":"Scribble Diffusion is a small Next.js app powered by Replicate ControlNet. Draw or edit a scribble, describe the image you want, then run generation with optional experiment controls for variations, guidance, seeds, and ControlNet structure modes.","archived":false,"fork":false,"pushed_at":"2026-05-19T09:53:07.000Z","size":1532,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-19T12:20:45.457Z","etag":null,"topics":["scribble","scribble-diffusion"],"latest_commit_sha":null,"homepage":"https://kai9987kai.co.uk/","language":"JavaScript","has_issues":false,"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/kai9987kai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-04-11T18:30:51.000Z","updated_at":"2026-05-19T09:53:11.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/kai9987kai/scribble-diffusion","commit_stats":null,"previous_names":["kai9987kai/scribble-diffusion"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/kai9987kai/scribble-diffusion","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kai9987kai%2Fscribble-diffusion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kai9987kai%2Fscribble-diffusion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kai9987kai%2Fscribble-diffusion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kai9987kai%2Fscribble-diffusion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kai9987kai","download_url":"https://codeload.github.com/kai9987kai/scribble-diffusion/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kai9987kai%2Fscribble-diffusion/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34132030,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"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":["scribble","scribble-diffusion"],"created_at":"2026-06-10T01:01:22.561Z","updated_at":"2026-06-10T01:01:23.065Z","avatar_url":"https://github.com/kai9987kai.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Scribble Diffusion\n\nTurn a sketch into a refined image with AI.\n\nScribble Diffusion is a small Next.js app powered by Replicate ControlNet. Draw or edit a scribble, describe the image you want, then run generation with optional experiment controls for variations, guidance, seeds, and ControlNet structure modes.\n\n## Features\n\n- Draw directly in the browser with pen, eraser, brush size, color swatches, undo, redo, clear, and restore-last-sketch tools.\n- Start from a seeded example scribble and prompt, or clear the canvas and draw from scratch.\n- Add prompt style chips such as photorealistic, watercolor, storybook illustration, product concept, isometric, and cinematic lighting.\n- Use the Experiment lab to adjust ControlNet structure, output count, resolution, seed, diffusion steps, guidance scale, quality prompt, and negative prompt.\n- Generate one image or a 4-image variation grid from the same sketch and prompt.\n- Compare the input scribble against outputs, view generation metadata, and copy share links.\n- Persist completed predictions through Replicate webhooks when database and webhook host configuration are available.\n\n## How It Works\n\n1. The browser exports the canvas as a PNG data URI.\n2. The PNG is uploaded through Upload.io.\n3. The app posts the image URL, prompt, and experiment settings to `pages/api/predictions`.\n4. The API validates supported ControlNet inputs and creates a Replicate prediction.\n5. The client polls `pages/api/predictions/[id]` until the prediction succeeds or fails.\n6. If a webhook host and database are configured, completed predictions are saved for share pages and the `/scribbles` gallery.\n\n## Development\n\nInstall a recent version of Node.js, then configure your Replicate token:\n\n```bash\necho \"REPLICATE_API_TOKEN=\u003cyour-token-here\u003e\" \u003e .env.local\n```\n\nInstall dependencies and start the dev server:\n\n```bash\nnpm install\nnpm run dev\n```\n\nOpen [localhost:3000](http://localhost:3000).\n\n## Environment Variables\n\n- `REPLICATE_API_TOKEN`: required for generation.\n- `DATABASE_URL`: required only for persisted shared scribbles and the gallery.\n- `VERCEL_URL`: used in production to build the Replicate webhook URL.\n- `NGROK_HOST`: optional local webhook host for development when testing Replicate webhooks.\n\nIf neither `VERCEL_URL` nor `NGROK_HOST` is set, generation still works, but the API skips webhook registration for local runs.\n\n## Scripts\n\n```bash\nnpm run dev      # Start Next.js locally\nnpm run lint     # Run Next.js linting\nnpm run build    # Build the production app\nnpm run test     # Run lint and build\n```\n\n## Tech Stack\n\n- [Next.js](https://nextjs.org/) pages and API routes\n- [Replicate](https://replicate.com/) for ControlNet predictions\n- [ControlNet](https://arxiv.org/abs/2302.05543) for image generation with structural conditioning\n- [react-sketch-canvas](https://www.npmjs.com/package/react-sketch-canvas) for browser drawing\n- [Tailwind CSS](https://tailwindcss.com/) for styling\n- [Prisma](https://www.prisma.io/) for optional prediction persistence\n- [Upload.io](https://upload.io/) for input image uploads\n\n## Notes\n\nThe default flow remains simple: draw, prompt, and click Go. The Experiment lab is optional and maps to the existing Replicate ControlNet model fields, with server-side validation to keep unsupported values out of prediction requests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkai9987kai%2Fscribble-diffusion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkai9987kai%2Fscribble-diffusion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkai9987kai%2Fscribble-diffusion/lists"}