{"id":25208061,"url":"https://github.com/comfy-org/registry-backend","last_synced_at":"2025-10-28T08:42:35.280Z","repository":{"id":241390118,"uuid":"805024727","full_name":"Comfy-Org/registry-backend","owner":"Comfy-Org","description":"Backend API for Comfy Registry + CI Dashboard","archived":false,"fork":false,"pushed_at":"2025-02-02T16:14:40.000Z","size":1511,"stargazers_count":51,"open_issues_count":9,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-02T16:23:39.580Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://registry.comfy.org","language":"Go","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/Comfy-Org.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":"2024-05-23T18:26:58.000Z","updated_at":"2025-02-02T16:14:42.000Z","dependencies_parsed_at":"2024-06-27T05:24:45.612Z","dependency_job_id":"2e7f5962-d57c-43ce-8136-741dc13dc919","html_url":"https://github.com/Comfy-Org/registry-backend","commit_stats":null,"previous_names":["comfy-org/registry-backend"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Comfy-Org%2Fregistry-backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Comfy-Org%2Fregistry-backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Comfy-Org%2Fregistry-backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Comfy-Org%2Fregistry-backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Comfy-Org","download_url":"https://codeload.github.com/Comfy-Org/registry-backend/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238109530,"owners_count":19417881,"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":[],"created_at":"2025-02-10T12:18:35.562Z","updated_at":"2025-10-25T08:30:53.050Z","avatar_url":"https://github.com/Comfy-Org.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# registry-backend\n\nThe server that backs ComfyUI Registry, a public collection of custom node packs used in ComfyUI. Read the [docs]() to publish your first node. Browse existing nodes at https://registry.comfy.org.\n\nThe backend API server for [Comfy Registry](https://registry.comfy.org) and [Comfy CI/CD](https://ci.comfy.org).\n\n[Discord](https://discord.gg/comfyorg)\n\n[Registry Frontend](https://github.com/Comfy-Org/registry-web)\n\n[cli](https://github.com/Comfy-Org/comfy-cli)\n\n## Local Development\n\n### Golang\n\nInstall Golang [here](https://go.dev/doc/install).\n\nInstall go packages\n\n`go get`\n\n### Atlas\n\nAtlas is used for editing the database, so install it from \u003chttps://github.com/ariga/atlas/?tab=readme-ov-file#quick-installation\u003e\n\n### Supabase\n\nInstall [Supabase Cli](https://supabase.com/docs/guides/cli/getting-started)\n\n`brew install supabase/tap/supabase`\n\n`supabase start`\n\nOpen [Supabase Studio](http://127.0.0.1:54323/project/default) locally.\n\n### Set up local ADC credentials\n\nInstall GCloud CLI \u003chttps://cloud.google.com/sdk/docs/install\u003e\n\nThese are needed for authenticating Firebase JWT token auth + calling other GCP APIs.\n\nWhen testing login with registry, use this:\n`gcloud config set project dreamboothy-dev`\n\n`gcloud auth application-default login`\n\nIf you are testing creating a node, you need to impersonate a service account because it requires signing cloud storage urls.\n\n`gcloud auth application-default login --impersonate-service-account 357148958219-compute@developer.gserviceaccount.com`\n\nTODO(robinhuang): Create a service account suitable for dev.\n\n### Start API Server\n\n`docker compose up`\n\nThis commands starts the server with Air that listens to changes. It connects to the Supabase running locally.\n\n# Code Generation\n\nMake sure you install the golang packages locally.\n\n`go get`\n\n## Schema Change\n\nUpdate the files in `ent/schema`.\n\n### Regenerate code\n\nThis should search all directories and run go generate. This will run all the commands in the `generate.go` files in the repository.\n\n`go generate ./...`\n\nOr manually run:\n\n`go run -mod=mod entgo.io/ent/cmd/ent generate --feature sql/upsert --feature sql/lock --feature sql/modifier ./ent/schema`\n\n### Generate Migration Files\n\nRun this command to generate migration files needed for staging/prod database schema changes:\n\n```shell\natlas migrate diff migration --dir \"file://ent/migrate/migrations\" --to \"ent://ent/schema\" --dev-url \"docker://postgres/15/test?search_path=public\"\n```\n\n## API Spec Change (openapi.yml)\n\n### Regenerate code\n\nThis should search all directories and run go generate. This will run all the commands in the `generate.go` files in the repository.\n\n`go generate ./...`\n\nOr manually run:\n\n`export PATH=\"$PATH:$HOME/bin:$HOME/go/bin\"`\n\n\u003chttps://github.com/deepmap/oapi-codegen/issues/795\u003e\n\n`oapi-codegen --config drip/codegen.yaml openapi.yml`\n\n## TroubleShooting / Common Errors\n\nHere are some common errors and how to resolve them.\n\n### Security Scan\n\nIf you are calling the `security-scan` endpoint, you need to add the endpoint url to `docker-compose.yml` and then make sure you have the correct permissions to call that function.\n\nCheck the `security-scan` Cloud Function repo for instructions on how to do that with `gcloud`.\n\nFor non Comfy-Org contributors, you can use your own hosted function or just avoid touching this part. We keep the security scan code private to avoid exploiters taking advantage of it.\n\n### Firebase Token Errors\n\nUsually in localdev, we use dreamboothy-dev Firebase project for authentication. This conflicts with our machine creation logic because all of those machine images are in dreamboothy. TODO(robinhuang): Figure out a solution for this. Either we replicate things in dreamboothy-dev, or we pass project information separately when creating machine images.\n\n### Creating VM instance error\n\n**Example:**\n\n```\n{\n    \"severity\": \"ERROR\",\n    \"error\": \"error creating instance: Post \\\"https://compute.googleapis.com/compute/v1/projects/dreamboothy/zones/us-central1-a/instances\\\": oauth2: \\\"invalid_grant\\\" \\\"reauth related error (invalid_rapt)\\\" \\\"https://support.google.com/a/answer/9368756\\\"\",\n    \"time\": \"2024-02-26T01:32:27Z\",\n    \"message\": \"Error creating instance:\"\n}\n\n{\n    \"severity\": \"ERROR\",\n    \"error\": \"failed to get session using author id 'nz0vAxfqWLSrqPcUhspyuOEp03z2': error creating instance: Post \\\"https://compute.googleapis.com/compute/v1/projects/dreamboothy/zones/us-central1-a/instances\\\": oauth2: \\\"invalid_grant\\\" \\\"reauth related error (invalid_rapt)\\\" \\\"https://support.google.com/a/answer/9368756\\\"\",\n    \"time\": \"2024-02-26T01:32:27Z\",\n    \"message\": \"Error occurred Path: /workflows/:id, Method: GET\\n\"\n}\n```\n\n**Resolution:**\n\nYou would likely need to run `gcloud auth application-default login` again and\nrestart your docker containers/services to pick up the new credentials.\n\n### Calling CreateSession endpoint\n\nUse the postman collection to call the CreateSession endpoint. You should be able to import changes with `openapi.yml`\nfile.\nYou should use this as a request body since there are list of supported GPU type.\n\n```json\n{\n  \"gpu-type\": \"nvidia-tesla-t4\"\n}\n```\n\n### Bypass Authentication Error\n\nIn order to bypass authentication error, you can add make the following changes in `firebase_auth.go` file.\n\n```go\npackage drip_middleware\n\nfunc FirebaseMiddleware(entClient *ent.Client) echo.MiddlewareFunc {\n return func(next echo.HandlerFunc) echo.HandlerFunc {\n  return func(ctx echo.Context) error {\n   userDetails := \u0026UserDetails{\n    ID:    \"test-james-token-id\",\n    Email: \"test-james-email@gmail.com\",\n    Name:  \"James\",\n   }\n\n   authdCtx := context.WithValue(ctx.Request().Context(), UserContextKey, userDetails)\n   ctx.SetRequest(ctx.Request().WithContext(authdCtx))\n   newUserError := db.UpsertUser(ctx.Request().Context(), entClient, userDetails.ID, userDetails.Email, userDetails.Name)\n   if newUserError != nil {\n    log.Ctx(ctx).Info().Ctx(ctx.Request().Context()).Err(newUserError).Msg(\"error User upserted successfully.\")\n   }\n   return next(ctx)\n  }\n }\n}\n\n```\n\n### Machine Image Not Found\n\nWe use a custom machine image to create VM instances. That machine image is specified in `docker-compose.yml` file.\n\n```yaml\nMACHINE_IMAGE: \"comfy-cloud-template-3\"\n```\n\nIf you are getting an error that the machine image is not found, you can create a new machine image by following the\nsteps below:\n\n**TODO**: explore steps to create machine image with comfy setup.\n\nFor the purpose of just testing endpoints, you don't really need to worry about Comfy specific machine image.\nYou can simply create a new VM on the GCP console and use that VM's image to create a new machine image.\nAnd then update the `docker-compose.yml` file with the new machine image name.\n\n## Clean Up Resources\n\nYou can use this script to cleanup resources for specific user.\n\n```shell\n`docker compose -f scripts/cleanup/docker-compose.cleanup.yml run --rm cleanup -u \u003cuser id\u003e`\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomfy-org%2Fregistry-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcomfy-org%2Fregistry-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomfy-org%2Fregistry-backend/lists"}