{"id":24491435,"url":"https://github.com/patelvivekdev/libsql-ratelimiter","last_synced_at":"2026-02-08T09:32:20.413Z","repository":{"id":272540717,"uuid":"916945314","full_name":"patelvivekdev/libsql-ratelimiter","owner":"patelvivekdev","description":"libsql ratelimiter","archived":false,"fork":false,"pushed_at":"2025-01-15T03:53:49.000Z","size":70,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-19T13:23:23.670Z","etag":null,"topics":["libsql","rate-limiter"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/libsql-ratelimiter","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/patelvivekdev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2025-01-15T03:49:18.000Z","updated_at":"2025-04-29T07:53:24.000Z","dependencies_parsed_at":"2025-01-15T05:56:44.343Z","dependency_job_id":"1235e67f-8594-45c7-a8f5-ef74294d5e22","html_url":"https://github.com/patelvivekdev/libsql-ratelimiter","commit_stats":null,"previous_names":["patelvivekdev/libsql-ratelimiter"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/patelvivekdev/libsql-ratelimiter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patelvivekdev%2Flibsql-ratelimiter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patelvivekdev%2Flibsql-ratelimiter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patelvivekdev%2Flibsql-ratelimiter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patelvivekdev%2Flibsql-ratelimiter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patelvivekdev","download_url":"https://codeload.github.com/patelvivekdev/libsql-ratelimiter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patelvivekdev%2Flibsql-ratelimiter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29226470,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-08T09:15:18.648Z","status":"ssl_error","status_checked_at":"2026-02-08T09:14:33.745Z","response_time":57,"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":["libsql","rate-limiter"],"created_at":"2025-01-21T18:18:10.973Z","updated_at":"2026-02-08T09:32:20.389Z","avatar_url":"https://github.com/patelvivekdev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# libsql-ratelimiter\n\nA flexible rate-limiting library built on top of libSQL, providing multiple algorithms (fixed window, sliding window, and token bucket) to control how frequently actions can be performed.\n\n\u003cdiv align=\"center\"\u003e\n\u003ca href=\"https://www.npmjs.com/package/libsql-ratelimiter\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/libsql-ratelimiter\"/\u003e\u003ca\u003e\n\u003ca href=\"https://www.npmjs.com/package/libsql-ratelimiter\"\u003e\u003cimg src=\"https://img.shields.io/npm/dm/libsql-ratelimiter\"/\u003e\u003ca\u003e\n\u003ca href=\"https://github.com/patelvivekdev/libsql-ratelimiter/actions/workflows/CI.yml\"\u003e\u003cimg src=\"https://github.com/patelvivekdev/libsql-ratelimiter/actions/workflows/CI.yml/badge.svg\"/\u003e\u003ca\u003e\n\u003c/div\u003e\n\u003cbr\u003e\n\n## Installation\n\n```bash\nnpm install libsql-ratelimiter\n```\n\n## Configuration\n\nEnvironment variables can be used to set the configuration:\n\n```env\nLIBSQL_URL=\nLIBSQL_AUTH_TOKEN=\n```\n\n## Basic Usage\n\n```typescript\nimport { createRateLimiter } from 'libsql-ratelimiter';\n\nasync function example() {\n  const rateLimiter = await createRateLimiter({\n    url: 'file:./path/to/rate-limit.db', // process.env.LIBSQL_URL\n    // ...other config like authToken LIBSQL_AUTH_TOKEN can be used\n  });\n\n  // Check if it's initialized\n  console.log('Is initialized?', rateLimiter.isInitialized());\n\n  // Limit requests using the fixed window algorithm\n  const result = await rateLimiter.limit({\n    key: 'someUser',\n    limit: 5, // requests\n    window: 60, // seconds\n    algorithm: 'fixed', // 'fixed', 'sliding', or 'token'\n  });\n  console.log('Fixed window result:', result);\n\n  // Close the client when done\n  rateLimiter.close();\n}\n```\n\n## API\n\n### `createRateLimiter(config?)`\n\nCreates and returns a new RateLimiter instance.\n\n### `limit(options)`\n\nChecks if a given request identified by `options.key` should be allowed under the specified algorithm. Returns a RateLimitResult object containing:\n\n- `success`: whether the request is allowed\n- `limit`: max capacity\n- `remaining`: remaining limit\n- `reset`: milliseconds until limit resets\n\n### `isInitialized()`\n\nReturns a boolean indicating if the underlying table is set up.\n\n### `close()`\n\nCloses the underlying client connection.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatelvivekdev%2Flibsql-ratelimiter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatelvivekdev%2Flibsql-ratelimiter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatelvivekdev%2Flibsql-ratelimiter/lists"}