{"id":47936096,"url":"https://github.com/faiscadev/fila-js","last_synced_at":"2026-04-04T07:43:06.030Z","repository":{"id":339795625,"uuid":"1162213449","full_name":"faiscadev/fila-js","owner":"faiscadev","description":"JavaScript/TypeScript client SDK for the Fila message broker","archived":false,"fork":false,"pushed_at":"2026-03-21T14:17:34.000Z","size":90,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-22T03:47:38.385Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/faiscadev.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-20T01:47:22.000Z","updated_at":"2026-03-21T14:17:40.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/faiscadev/fila-js","commit_stats":null,"previous_names":["faiscadev/fila-js"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/faiscadev/fila-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faiscadev%2Ffila-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faiscadev%2Ffila-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faiscadev%2Ffila-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faiscadev%2Ffila-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/faiscadev","download_url":"https://codeload.github.com/faiscadev/fila-js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faiscadev%2Ffila-js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31392186,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T04:26:24.776Z","status":"ssl_error","status_checked_at":"2026-04-04T04:23:34.147Z","response_time":60,"last_error":"SSL_read: 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":[],"created_at":"2026-04-04T07:43:05.499Z","updated_at":"2026-04-04T07:43:06.017Z","avatar_url":"https://github.com/faiscadev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fila-js\n\nJavaScript/TypeScript client SDK for the [Fila](https://github.com/faisca/fila) message broker.\n\n## Installation\n\n```bash\nnpm install @fila/client\n```\n\n## Usage\n\n```typescript\nimport { Client } from \"@fila/client\";\n\nconst client = new Client(\"localhost:5555\");\n\n// Enqueue a message.\nconst msgId = await client.enqueue(\n  \"my-queue\",\n  { tenant: \"acme\" },\n  Buffer.from(\"hello world\")\n);\nconsole.log(\"Enqueued:\", msgId);\n\n// Consume messages.\nfor await (const msg of client.consume(\"my-queue\")) {\n  console.log(`Received: ${msg.id} (attempt ${msg.attemptCount})`);\n\n  try {\n    // Process the message...\n    await client.ack(\"my-queue\", msg.id);\n  } catch (err) {\n    await client.nack(\"my-queue\", msg.id, String(err));\n  }\n}\n\nclient.close();\n```\n\n### TLS (system trust store)\n\nIf the Fila server uses a certificate signed by a public CA, enable TLS without providing a CA certificate — the OS system trust store is used automatically:\n\n```typescript\nimport { Client } from \"@fila/client\";\n\nconst client = new Client(\"localhost:5555\", { tls: true });\n```\n\n### TLS (custom CA certificate)\n\nFor self-signed or private CA certificates, pass the CA cert explicitly:\n\n```typescript\nimport * as fs from \"fs\";\nimport { Client } from \"@fila/client\";\n\nconst client = new Client(\"localhost:5555\", {\n  caCert: fs.readFileSync(\"ca.pem\"),\n});\n```\n\n### Mutual TLS (mTLS)\n\nClient certificates work with both modes — system trust store or custom CA:\n\n```typescript\nimport * as fs from \"fs\";\nimport { Client } from \"@fila/client\";\n\n// With custom CA:\nconst client = new Client(\"localhost:5555\", {\n  caCert: fs.readFileSync(\"ca.pem\"),\n  clientCert: fs.readFileSync(\"client.pem\"),\n  clientKey: fs.readFileSync(\"client.key\"),\n});\n\n// With system trust store:\nconst client2 = new Client(\"localhost:5555\", {\n  tls: true,\n  clientCert: fs.readFileSync(\"client.pem\"),\n  clientKey: fs.readFileSync(\"client.key\"),\n});\n```\n\n### API key authentication\n\n```typescript\nimport { Client } from \"@fila/client\";\n\nconst client = new Client(\"localhost:5555\", {\n  apiKey: \"my-api-key\",\n});\n```\n\n### mTLS + API key\n\n```typescript\nimport * as fs from \"fs\";\nimport { Client } from \"@fila/client\";\n\nconst client = new Client(\"localhost:5555\", {\n  caCert: fs.readFileSync(\"ca.pem\"),\n  clientCert: fs.readFileSync(\"client.pem\"),\n  clientKey: fs.readFileSync(\"client.key\"),\n  apiKey: \"my-api-key\",\n});\n```\n\n## API\n\n### `new Client(addr: string, options?: ClientOptions)`\n\nConnect to a Fila broker at the given address (e.g., `\"localhost:5555\"`).\n\n**Options:**\n\n| Option       | Type      | Description                                                        |\n|-------------|-----------|---------------------------------------------------------------------|\n| `tls`       | `boolean` | Enable TLS using the OS system trust store. Implied when `caCert` is set. |\n| `caCert`    | `Buffer`  | CA certificate PEM. Enables TLS with a custom CA when set.         |\n| `clientCert`| `Buffer`  | Client certificate PEM for mTLS. Requires TLS to be enabled.      |\n| `clientKey` | `Buffer`  | Client private key PEM for mTLS. Requires TLS to be enabled.      |\n| `apiKey`    | `string`  | API key sent as `Bearer` token on every RPC call.                  |\n\n### `client.enqueue(queue, headers, payload): Promise\u003cstring\u003e`\n\nEnqueue a message. Returns the broker-assigned message ID (UUIDv7).\n\n### `client.consume(queue): AsyncIterable\u003cConsumeMessage\u003e`\n\nOpen a streaming consumer. Returns an async iterable that yields messages as they become available. Nacked messages are redelivered on the same stream.\n\n### `client.ack(queue, msgId): Promise\u003cvoid\u003e`\n\nAcknowledge a successfully processed message. The message is permanently removed.\n\n### `client.nack(queue, msgId, error): Promise\u003cvoid\u003e`\n\nNegatively acknowledge a failed message. The message is requeued or routed to the dead-letter queue based on the queue's configuration.\n\n### `client.close(): void`\n\nClose the underlying gRPC channel.\n\n## Error Handling\n\nPer-operation error classes are thrown for specific failure modes:\n\n```typescript\nimport { QueueNotFoundError, MessageNotFoundError } from \"@fila/client\";\n\ntry {\n  await client.enqueue(\"missing-queue\", null, Buffer.from(\"test\"));\n} catch (err) {\n  if (err instanceof QueueNotFoundError) {\n    // handle queue not found\n  }\n}\n\ntry {\n  await client.ack(\"my-queue\", \"missing-id\");\n} catch (err) {\n  if (err instanceof MessageNotFoundError) {\n    // handle message not found\n  }\n}\n```\n\n## License\n\nAGPLv3\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaiscadev%2Ffila-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffaiscadev%2Ffila-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaiscadev%2Ffila-js/lists"}