Skip to content

Standardize Base Response Schema for Success and Error Responses #49

Description

@omk-66

Currently, the project does not have a consistent base response structure for API success and error outputs. This leads to inconsistency across endpoints and makes it harder for frontend integration, debugging, and documentation.

We should introduce a unified base response schema that all APIs must follow for both success and error cases.

type ApiResponse = SuccessResponse | ErrorResponse;

type SuccessResponse = {
success: true;
data: T; // object, array, or null
message?: string; // human-readable, present on every endpoint
meta?: { pagination?: { page; limit; total }; unreadCount?; metrics? };
};

type ErrorResponse = {
success: false;
error: { code: string; message: string; details?: unknown };
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions