Auto-generated tile from GitHub (10 skills)
92
94%
Does it follow best practices?
Impact
92%
1.16xAverage score across 44 eval scenarios
Advisory
Suggest reviewing before use
A SaaS startup needs a standalone authentication microservice. The security team has reviewed the previous implementation and raised several concerns: passwords were hashed with bcrypt (which they consider insufficiently memory-hard), rate limiting was implemented using an in-memory counter that could be bypassed by spinning up multiple instances behind the load balancer, and the service had no graceful shutdown — deployments caused in-flight login requests to fail.
Your task is to build a production-ready authentication API in Fastify that addresses all three concerns. The service must issue short-lived JWTs, refresh those tokens, and protect the login and registration endpoints from brute-force attacks in a way that works correctly across multiple instances.
The service needs:
POST /auth/register — accepts email and password, stores hashed password, returns user IDPOST /auth/login — validates credentials, returns access token and refresh tokenPOST /auth/refresh — exchanges a valid refresh token for a new access tokenPOST /auth/logout — invalidates the refresh tokenThe service will run behind an AWS load balancer with at least two instances.
Produce:
package.jsonsrc/app.ts — Fastify factory functionsrc/plugins/auth.ts — JWT plugin registration and authenticate decoratorsrc/routes/auth.ts — the four auth routessrc/server.ts — entry point with graceful shutdownarchitecture-notes.md documenting: the password hashing library chosen and why, the rate limiting storage backend chosen and why it works across instances, and the graceful shutdown mechanism usedevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10
scenario-11
scenario-12
scenario-13
scenario-14
scenario-15
scenario-16
scenario-17
scenario-18
scenario-19
scenario-20
scenario-21
scenario-22
scenario-23
scenario-24
scenario-25
scenario-26
scenario-27
scenario-28
scenario-29
scenario-30
scenario-31
scenario-32
scenario-33
scenario-34
scenario-35
scenario-36
scenario-37
scenario-38
scenario-39
scenario-40
scenario-41
scenario-42
scenario-43
scenario-44
skills
documentation
fastify
init
linting-neostandard-eslint9
node
nodejs-core
rules
oauth
octocat
snipgrapher