Skip to content

API Conventions

This page documents the conventions and patterns used across the Envia Admin backend API.

Route Organization

Routes are defined in the routes/ directory, grouped by domain or feature module. Each route file exports an array of Hapi route configurations.

Request Validation

Every endpoint uses Joi schemas for input validation:

  • Params — URL path parameters
  • Query — Query string parameters
  • Payload — Request body

Schemas are defined in the schemas/ directory, keeping validation logic separate from controllers.

Response Format

TODO

Document the standard response format, error handling patterns, and HTTP status code conventions.

Error Handling

The API uses @hapi/boom for consistent HTTP error responses.

Authentication

Most endpoints require authentication via JWT tokens. See Backend Architecture for details on supported auth strategies.

Envia Admin