application/json responses. Protected routes require an authenticated session via an HttpOnly cookie or an Authorization: Bearer header — the API accepts both so the same backend serves browser clients and programmatic integrations equally.
Base URL
The frontend resolves the API origin from theVITE_API_BASE_URL environment variable. All API endpoints are prefixed with /api.
Authentication
Protected routes require a valid JWT supplied in one of two ways:- HttpOnly cookie — the
tokencookie set by the server on login. Sent automatically by the browser whencredentials: 'include'is used. - Bearer token header —
Authorization: Bearer <token>for environments where cookies are unreliable (native apps, server-to-server calls, cross-origin setups).
authMiddleware checks the cookie first, then falls back to the header. See Authentication for the full flow, token lifecycle, and code examples.
Endpoint Summary
Error Format
All errors are serialised by the global error handler into a consistent JSON envelope. Theerror and message fields both contain the human-readable description; status is the string literal "error".
In
development mode the error response also includes a stack field with the full stack trace to aid debugging. This field is never present in production. For non-operational errors (unexpected crashes), the error and message values are always "Something went wrong" regardless of the underlying message, to avoid leaking implementation details.Common Status Codes
Rate Limiting
The login endpoints are protected by a sliding-window rate limiter configured inconstants.ts:
The limiter is applied to:
POST /api/auth/loginPOST /api/auth/google/callback
RateLimit-*) are included in every response from these endpoints (standardHeaders: true).
File Upload Limits
File uploads are handled viamultipart/form-data using Multer in-memory storage. The following limits apply globally to all upload endpoints:
Uploading a file that exceeds 50 MB returns HTTP 400 with the message:
CORS
Allowed origins are driven by theALLOWED_ORIGINS environment variable on the backend — a comma-separated list of fully-qualified frontend URLs:
Content-TypeAuthorizationCache-ControlPragmaExpiresX-Requested-With
credentials: true, which means your frontend requests must include credentials: 'include'.
Authentication
Register, login, Google OAuth PKCE, JWT details, and token storage best practices.
Tender Endpoints
Analyze tender documents, validate proposals, manage your analysis history.