Skip to content

[FEATURE] Refactor API Structure Using useApiService + Introduce Consistent Feature Modules #873

Description

@sanaderi

Standardize all frontend API calls using the existing useApiService as the single base layer, and introduce a scalable feature-based API structure.

This issue establishes the foundation pattern for all future API integrations, starting with /api/v1/boards.


Current State

  • A base API layer already exists: useApiService
  • Some API calls are still directly using $fetch or inline logic in components
  • No consistent feature-based API module structure yet

Scope of this Issue

1. Standardize API Usage

All API calls must go through:
useApiService

No direct $fetch usage in components or pages.


2. Introduce Feature-Based API Modules

Create modular API files per domain (feature-based structure):

/composables/api/
boards.ts
users.ts
posts.ts

Each module should wrap useApiService calls.


3. First Migration: Boards API

Migrate and standardize:
/api/v1/boards

Requirements:

  • Create useBoardsApi
  • All board requests must use useApiService
  • No direct API calls in components

Example API methods:

  • getBoards()
  • getBoard(id)
  • createBoard(payload)
  • updateBoard(id, payload)
  • deleteBoard(id)

Important Notes

  • This endpoint is public (no authentication required)
  • Do not attach auth headers for this module
  • Must remain compatible with future authenticated APIs
  • Must fully rely on useApiService

Expected Outcome

After implementation:

  • All board-related API calls are centralized
  • Components only interact with useBoardsApi
  • useApiService becomes the single HTTP abstraction layer
  • Clear structure for scaling to all other endpoints

Future Scope (Not part of this issue)

  • Migrate all remaining APIs to feature modules
  • Add TypeScript strict typing for API responses
  • Add caching strategy (Nuxt / Cloudflare)
  • Introduce advanced repository/service pattern if needed

Acceptance Criteria

  • All API calls use useApiService
  • useBoardsApi is created and used
  • /api/v1/boards migrated successfully
  • No direct $fetch usage remains for boards
  • Boards Endpoint works without auth headers
  • Structure is reusable for future APIs

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

Status
Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions