What is a server-side validation?
When a submission arrives, the server examines it before acting on it. It can check that expected fields are present, that values are the right type and length, that the request is not too large, and that it does not look like spam. If a check fails, the server answers with an error status, usually in the 400 range.
It is the only validation you can rely on. Checks in the browser help honest visitors, but a bot or a curious person can send any request they like straight to the endpoint. Whatever you do next with the data, whether storing it, emailing it or passing it to another system, should assume only what the server checked.
A form backend does the general checks for you. FormTango refuses a submission with no named fields, an unreadable body, an unsupported content type or more than 100 KB of text. It keeps at most 100 fields per submission, and it filters spam. Rules specific to your form, such as a valid order number, belong in your own code, for example in a function called by a webhook.
function validate(fields) {
const errors = [];
if (!/^[^@\s]+@[^@\s]+$/.test(fields.email ?? '')) errors.push('email');
if (!fields.message || fields.message.length > 5000) errors.push('message');
return errors;
}