REST API security checklist for small products
Ten practical security checks for a Node.js REST API — authentication, validation, rate limiting, secrets and more — that protect your users without slowing you down.
By Ahmed HebilaPublished 3 min read
Small products are attacked too — often by automated bots that try the same tricks on every API they find. These checks cover the problems I see most often. You can use them to review your own backend or a developer's work.
1. Hash passwords properly
Never store passwords as plain text. Use a slow hashing algorithm such as bcrypt or argon2, so a leaked database does not reveal real passwords.
2. Use short-lived tokens
Sign users in with tokens (for example JWT) that expire. For websites, keep the session in an httpOnly, secure cookie so scripts on the page cannot read it.
3. Check permissions on every request
Being logged in is not enough. Every endpoint must check that this user may read or change this record — a customer must never open another customer's order by changing an ID in the URL.
4. Validate every input
Check type, length and format on the server for every field, even if the app already checks it. Libraries such as zod or Joi make this simple and also block unexpected fields.
5. Rate-limit sensitive endpoints
Limit how often login, sign-up, password reset and contact forms can be called. On serverless hosting, store the counters in the database or a cache, not in memory, because instances restart.
6. Keep secrets out of the code
API keys, database passwords and token secrets belong in environment variables, never in the repository or the mobile app.
7. Return safe errors
Users should see a short message; detailed errors and stack traces belong in your logs only.
8. Use HTTPS and security headers
Serve everything over HTTPS. For web dashboards add headers such as Content-Security-Policy, X-Frame-Options and Strict-Transport-Security.
9. Handle uploads carefully
Limit file size and type, store files on a dedicated service (such as Cloudinary or S3) and never execute uploaded files.
10. Keep dependencies updated
Run npm audit regularly and update packages with known vulnerabilities. Many real attacks use old, already-fixed bugs.
Bonus: logs and backups
Log logins and admin actions, and back up the database automatically. When something goes wrong, these two save the day.
Need a review?
Security is part of every backend I build: hashed passwords, validated inputs, rate limits and protected admin routes. If you already have an API, I can review it by the hour. See the Node.js backend development service.
Want this built for you?
Tell me about your project — I reply within one business day with questions or a fixed quote.


