Validation
ELI5 — The Vibe Check
Validation is your backend's bouncer. Before any data gets into the database, the bouncer checks it: 'Is this email actually an email? Is this password long enough? Is this required field actually filled in?' If anything fails, the bouncer blocks it with an error.
Real Talk
Validation is the process of verifying that input data meets defined rules and constraints before processing or storing it. Backend validation is essential for data integrity and security, even when frontend validation exists, since API requests can bypass the frontend.
Show Me The Code
const schema = z.object({
email: z.string().email(),
age: z.number().min(18),
name: z.string().min(2).max(50),
});
const result = schema.safeParse(req.body);
When You'll Hear This
"Add server-side validation for the form fields." / "Validation failed — the email format is wrong."
Related Terms
Controller
A controller is the manager who actually handles your request after it passes through security.
Middleware
Middleware is like a security checkpoint at an airport.
Schema
A database schema is the blueprint of your database — which tables exist, what columns they have, what types they are, and how they relate to each other.
Status Code
An HTTP status code is the server's one-line verdict on your request. 200 means 'perfect, here's what you asked for.' 404 means 'can't find it.