{"id":30354511,"url":"https://github.com/arcjet/example-fastify","last_synced_at":"2025-08-19T03:14:35.817Z","repository":{"id":306494709,"uuid":"1025075473","full_name":"arcjet/example-fastify","owner":"arcjet","description":"An example Fastify application protected by Arcjet","archived":false,"fork":false,"pushed_at":"2025-07-23T17:27:13.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-15T21:27:17.405Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arcjet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2025-07-23T17:21:44.000Z","updated_at":"2025-07-23T17:28:01.000Z","dependencies_parsed_at":"2025-07-26T03:10:00.083Z","dependency_job_id":"8687891c-dd2e-4bcc-a691-67d5dec634e0","html_url":"https://github.com/arcjet/example-fastify","commit_stats":null,"previous_names":["arcjet/example-fastify"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/arcjet/example-fastify","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arcjet%2Fexample-fastify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arcjet%2Fexample-fastify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arcjet%2Fexample-fastify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arcjet%2Fexample-fastify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arcjet","download_url":"https://codeload.github.com/arcjet/example-fastify/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arcjet%2Fexample-fastify/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271093490,"owners_count":24698028,"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","status":"online","status_checked_at":"2025-08-19T02:00:09.176Z","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":[],"created_at":"2025-08-19T03:14:34.506Z","updated_at":"2025-08-19T03:14:35.809Z","avatar_url":"https://github.com/arcjet.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- markdownlint-disable MD033 MD041 --\u003e\n\u003ca href=\"https://arcjet.com\" target=\"_arcjet-home\"\u003e\n  \u003cpicture\u003e\n    \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://arcjet.com/logo/arcjet-dark-lockup-voyage-horizontal.svg\"\u003e\n    \u003cimg src=\"https://arcjet.com/logo/arcjet-light-lockup-voyage-horizontal.svg\" alt=\"Arcjet Logo\" height=\"128\" width=\"auto\"\u003e\n  \u003c/picture\u003e\n\u003c/a\u003e\n\n# Arcjet Fastify example app\n\n[Arcjet](https://arcjet.com) helps developers protect their apps in just a few\nlines of code. Bot detection. Rate limiting. Email validation. Attack\nprotection. Data redaction. A developer-first approach to security.\n\nThis is an example Fastify application demonstrating the use of multiple\nfeatures.\n\n## Features\n\n- Bot protection shows how a page can be protected from automated clients.\n- Rate limiting shows the use of different rate limit configurations depending\n  on the authenticated user. A logged-in user can make more requests than an\n  anonymous user.\n- Signup form protection uses Arcjet's server-side email verification configured\n  to block disposable providers and ensure that the domain has a valid MX\n  record. It also includes rate limiting and bot protection to prevent automated\n  abuse.\n- Sensitive info protects against clients sending you sensitive information such\n  as PII that you do not wish to handle.\n- Attack protection demonstrates Arcjet Shield, which detects suspicious\n  behavior such as SQL injection and cross-site scripting attacks.\n\n## Deploy it now\n\n[![Deploy with Vercel][vercel_button]][vercel_deploy]\n\u0026nbsp; \u0026nbsp;\n[![Deploy to Netlify][netlify_button]][netlify_deploy]\n\n## Run locally\n\n1. [Register for a free Arcjet account](https://app.arcjet.com).\n\n2. Install dependencies:\n\n```sh\nnpm ci\n```\n\n3. Rename `.env.example` to `.env` and add your Arcjet key.\n\n4. Start the dev server\n\n```sh\n# Node.js 24.3+\nnpm run dev\n```\n\n\u003e [!TIP]\n\u003e For older versions of Node.js or if you encounter this error:\n\u003e\n\u003e \u003e Unknown file extension \".ts\"\n\u003e\n\u003e Use this [`tsx`](https://www.npmjs.com/package/tsx)-based command instead:\n\u003e\n\u003e ```sh\n\u003e npm run dev-tsx\n\u003e ```\n\n## Try it out\n\nFastify is a server-side framework, so you won't see much in the browser. Here\nare some API routes to try:\n\n### Bot protection\n\nThe `/bots` route uses a guard to protect the controller. All automated clients\nwill receive a 403 response. `curl` is considered an automated client by\ndefault, so you can test it with:\n\n```sh\ncurl -v http://localhost:3000/bots\n```\n\n### Rate limiting\n\nThe `/rate-limiting` route uses a fixed window rate limit. Send 3 requests in quick\nsuccession to see the rate limit in action:\n\n```sh\ncurl -v http://localhost:3000/rate-limiting\n```\n\n### Signup form protection\n\nThe `/signup` route uses Arcjet's signup form protection which combines bot\nprotection, rate limiting, and email verification. To test it, send a POST\nrequest with different email addresses to test:\n\n```sh\ncurl -v http://localhost:3000/signup \\\n  -X POST \\\n  -H \"Content-Type: application/json\" \\\n  --data '{\"email\":\"invalid.@arcjet.com\"}'\n```\n\nTry these emails to see how it works:\n\n- `invalid.@arcjet` – is an invalid email address.\n- `test@0zc7eznv3rsiswlohu.tk` – is from a disposable email provider.\n- `nonexistent@arcjet.ai` – is a valid email address \u0026 domain, but has no MX\n  records.\n\n### Sensitive info\n\nThe `/sensitive-info` route uses a guard to protect the controller. It will\nblock requests containing credit card numbers:\n\n```sh\ncurl -v http://localhost:3000/sensitive-info \\\n  -X POST \\\n  -H \"Content-Type: application/json\" \\\n  --data '{\"message\":\"Hello my credit card is 4111111111111111\"}'\n```\n\n### Attack protection\n\nThe `/attack` route uses Arcjet Shield to detect and block attacks, such as SQL\ninjection and cross-site scripting. To simulate an attack, send a request with\nthe special header:\n\n```sh\ncurl -v http://localhost:3000/attack \\\n  -H \"x-arcjet-suspicious: true\"\n```\n\nAfter the 5th request, your IP will be blocked for 15 minutes. Suspicious\nrequests must meet a threshold before they are blocked to avoid false positives.\n\n## Need help?\n\nCheck out [the docs](https://docs.arcjet.com/), [contact\nsupport](https://docs.arcjet.com/support), or [join our Discord\nserver](https://arcjet.com/discord).\n\n## Contributing\n\nAll development for Arcjet examples is done in the\n[`arcjet/examples` repository](https://github.com/arcjet/examples).\n\nYou are welcome to open an issue here or in\n[`arcjet/examples`](https://github.com/arcjet/examples/issues) directly.\nHowever, please direct all pull requests to\n[`arcjet/examples`](https://github.com/arcjet/examples/pulls). Take a look at\nour\n[contributing guide](https://github.com/arcjet/examples/blob/main/CONTRIBUTING.md)\nfor more information.\n\n[vercel_deploy]: https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Farcjet%2Fexample-fastify\u0026project-name=arcjet-example\u0026repository-name=arcjet-example\u0026developer-id=oac_1GEcKBuKBilVnjToj1QUwdb8\u0026demo-title=Arcjet%20Example%20\u0026demo-description=Example%20rate%20limiting%2C%20bot%20protection%2C%20email%20verification%20%26%20form%20protection.\u0026demo-url=https%3A%2F%2Fgithub.com%2Farcjet%2Fexample-fastify\u0026demo-image=https%3A%2F%2Fapp.arcjet.com%2Fimg%2Fexample-apps%2Fvercel%2Fdemo-image.jpg\u0026integration-ids=oac_1GEcKBuKBilVnjToj1QUwdb8\u0026external-id=example-fastify\n[vercel_button]: https://vercel.com/button\n[netlify_deploy]: https://app.netlify.com/start/deploy?repository=https://github.com/arcjet/example-fastify\n[netlify_button]: https://www.netlify.com/img/deploy/button.svg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farcjet%2Fexample-fastify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farcjet%2Fexample-fastify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farcjet%2Fexample-fastify/lists"}