{"id":15412990,"url":"https://github.com/stephancill/lazy-indexer","last_synced_at":"2025-04-15T21:35:30.061Z","repository":{"id":246581012,"uuid":"821546893","full_name":"stephancill/lazy-indexer","owner":"stephancill","description":"Selectively index data on the Farcaster protocol for a subset of FIDs","archived":false,"fork":false,"pushed_at":"2025-01-09T17:14:12.000Z","size":620,"stargazers_count":23,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-20T22:21:38.723Z","etag":null,"topics":["farcaster"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/stephancill.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-06-28T19:44:31.000Z","updated_at":"2025-01-09T17:14:16.000Z","dependencies_parsed_at":"2024-06-28T20:47:32.102Z","dependency_job_id":"f20379e7-681f-4c3f-9e12-0802736d21cc","html_url":"https://github.com/stephancill/lazy-indexer","commit_stats":null,"previous_names":["stephancill/lazy-indexer"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephancill%2Flazy-indexer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephancill%2Flazy-indexer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephancill%2Flazy-indexer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephancill%2Flazy-indexer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stephancill","download_url":"https://codeload.github.com/stephancill/lazy-indexer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235515426,"owners_count":19002481,"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":["farcaster"],"created_at":"2024-10-01T16:54:59.029Z","updated_at":"2025-01-24T23:12:12.099Z","avatar_url":"https://github.com/stephancill.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lazy Indexer\n\nThis is a Farcaster indexer which only syncs network data for specified target user IDs. It borrows indexing logic from the [Greg's indexer](https://github.com/gskril/farcaster-indexer), and streaming logic from [shuttle](https://github.com/farcasterxyz/hub-monorepo/tree/main/packages/shuttle).\n\n## Principles\n\n- Hub stream events are only indexed when they involve a target FID\n- A root target is a target which also spawns other targets\n- Root targets are backfilled along with all the users they follow.\n- When a root target user follows a new user, the indexer will automatically backfill the new FID and add it as a target.\n- When a new signer is detected which contains metadata from a specified app, the FID or signer public key will be added as a root target.\n\n## API Endpoints\n\n### POST `/root-backfill/:fid`\n\n- **Description**: Creates or updates a root backfill job for the specified FID (file identifier). If a job exists and the force query parameter is not set, the existing job's status is returned.\n- **Parameters**:\n  - `:fid` - Farcaster ID of the user\n  - `force` - Query parameter to force the creation of a new job even if one exists (optional).\n- **Response Codes**:\n  - `200` - Job successfully created or updated.\n  - `409` - Conflict, job already exists.\n\n### GET `/root-backfill/:fid`\n\n- **Description**: Retrieves the status of the root backfill job for the specified FID.\n- **Parameters**:\n  - `:fid` - Farcaster ID of the user\n- **Response Codes**:\n  - `200` - Job status retrieved successfully.\n  - `404` - Job not found.\n- **Sample Response**:\n\n```json\n{\n  \"status\": \"50 minutes remaining\",\n  \"completedCount\": 5,\n  \"waitingCount\": 10,\n  \"childCount\": 15,\n  \"done\": false\n}\n```\n\n### POST `/backfill/:fid`\n\n- **Description**: Creates or updates a backfill job for the specified FID. If a job exists and the force query parameter is not set, the existing job's data is returned.\n- **Parameters**:\n  - `:fid` - Farcaster ID of the user\n  - `force` - Query parameter to force the creation of a new job even if one exists (optional).\n- **Response Codes**:\n  - `200` - Job successfully created or updated.\n  - `409` - Conflict, job already exists.\n\n## How it works\n\n- Targets are stored in a Redis set\n- Whenever the hub stream consumer receives an event it checks if the FID involved with the message is in the targets set and only indexes it if it is\n\n## How to run\n\nClone this repo\n\n```bash\ngit clone https://github.com/stephancill/lazy-indexer.git\n```\n\nInstall dependencies\n\n```bash\nyarn install\n```\n\nCreate a `.env` file with your hub, database, and redis connection details\n\n```bash\ncp .env.example .env\n```\n\nRun the latest database migrations\n\n```bash\nyarn migrate\n```\n\nRun the indexer\n\n```bash\n# Starts a server and backfill workers\nyarn backfill\n\n# Opens a Hub stream and indexes events in the targets set\nyarn stream\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephancill%2Flazy-indexer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstephancill%2Flazy-indexer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephancill%2Flazy-indexer/lists"}