The registration API atDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/moradoadrian/carneroDev/llms.txt
Use this file to discover all available pages before exploring further.
POST /api/register is an Astro server-side route that handles the full registration pipeline: input validation, Supabase database insertion, and confirmation email dispatch via Resend. Because prerender is set to false, the file is never statically generated — every request is executed dynamically on the server, giving the handler access to runtime environment variables and live database connections.
Endpoint Overview
| Property | Value |
|---|---|
| Method | POST |
| Path | /api/register |
| Content-Type | application/json |
| Auth | None (public endpoint) |
| prerender | false (server-rendered, not statically generated) |
Request Body
All four fields are required. The server will return400 Bad Request if any field is missing, if the email does not match the validation regex, or if membersCount falls outside the accepted range.
Team name. Minimum 1 character. Stored in the
team_name column of the registrations table.Full name of the team representative. Stored in the
representative_name column.Valid email address for the representative. Must match
/^[^\s@]+@[^\s@]+\.[^\s@]+$/. Used as the delivery address for the Resend confirmation email.Team size submitted as a string —
'1', '2', '3', or '4'. The server parses this to an integer with parseInt(membersCount, 10) before inserting into the database.Example Request
Success Response (200)
A200 is returned only after both the Supabase insert and the Resend dispatch have been attempted. Note that email_sent may be false even on a 200 — this indicates the registration was saved but the confirmation email encountered an error.
Always
true on a successful 200 response.Human-readable confirmation string. Value:
"¡Registro exitoso!"true if the Resend API accepted the email without error. false if the API key was missing, the key matched the placeholder value, or Resend returned an error.Error message describing why the email was not delivered. Empty string (
"") on success.Error Responses
400 Bad Request — Returned for any of the following validation failures:- One or more required fields (
teamName,repName,repEmail,membersCount) are absent or empty. repEmaildoes not satisfy the server-side regex/^[^\s@]+@[^\s@]+\.[^\s@]+$/.membersCountparses toNaN, or falls outside the range1–4.
500:
- Database failure — The Supabase
insertcall resolves with a non-nulldbError. The body contains the prefix[ERROR_DE_SISTEMA]: No se pudo guardar la información en base de datos:followed by the Supabase error message. - Unexpected runtime exception — An unhandled exception propagates to the outer
catchblock. The body uses the prefix[ERROR_INTERNO_DEL_SERVIDOR]:followed by the thrown error message (or'Error inesperado.'if no message is available).
400 and 500 codes):
Validation Logic
The registration flow uses two independent layers of validation, ensuring that invalid data is never written to the database even if the client-side check is somehow bypassed. Layer 1 — Client-side (RegisterModal.astro)
Before the fetch call is issued, the modal’s submit handler checks:
- All four fields are non-empty and the terms checkbox is checked.
repEmailmatches the regex/^[^\s@]+@[^\s@]+\.[^\s@]+$/.
#registration-error panel and the request is never sent.
Layer 2 — Server-side (register.ts)
The API route re-validates all fields independently of the client:
- Presence check for
teamName,repName,repEmail, andmembersCount— returns400with[ERROR_DE_VALIDACION]: Faltan campos requeridos en el servidor. - Email regex test — returns
400with[ERROR_DE_VALIDACION]: Correo electrónico no válido en el servidor. parseIntrange check (1 ≤ parsedCount ≤ 4) — returns400with[ERROR_DE_VALIDACION]: Tamaño de equipo no permitido.
If the
RESEND_API_KEY environment variable is missing or still holds the placeholder value re_your_resend_api_key_placeholder, the server logs [RESEND_WARNING] and skips email dispatch entirely — the registration is still saved to Supabase. The 200 response will contain email_sent: false and a descriptive email_error message.