Expense Analyser API Builder
Add API-backed capabilities by following the existing frontend architecture:
- •DTOs in
src/models - •axios wrappers in
src/services - •business flow and UI state in
src/stores - •component/view integration in
src/componentsorsrc/views
Read references/project-api-conventions.md before implementing changes.
Workflow
- •Identify where the new API belongs.
- •Extend an existing service/store pair when the feature matches a current domain (
Expense,Auth,Friends,Notification,Document,Extract). - •Create a new
src/services/<Domain>Service.tsandsrc/stores/<Domain>/index.tswhen introducing a new domain.
- •Define request/response models first.
- •Add or update DTO/type files in
src/models. - •Use explicit TypeScript types for service signatures and store state/action return values.
- •Implement service method(s) in
src/services.
- •Reuse
const BASE_URL = import.meta.env.VITE_APP_API_URL. - •Keep domain-scoped
API_URL = BASE_URL + '/<ControllerName>'. - •Call axios with
withCredentials: trueto match current auth/cookie flow. - •Set headers only when needed (for example multipart uploads).
- •Throw meaningful errors via
axios.isAxiosError.
- •Expose feature in Pinia store.
- •Add loading/success/error flags to state when UI feedback is needed.
- •Add an action that validates required inputs before calling the service.
- •Normalize response handling for component use.
- •Wire to UI.
- •Call the store action from target component/view.
- •Bind loading and error state to existing Vuetify UX patterns.
- •Update routing only if this feature introduces a new page.
- •Validate.
- •Run
npm run type-check. - •Run
npm run lintfor changed files. - •Confirm no broken imports and that new actions are reachable from UI flow.
Guardrails
- •Preserve existing path aliases (
@/models,@/services). - •Match existing naming in touched files. Do not mass-rename legacy PascalCase methods unless requested.
- •Keep API URL construction centralized inside service files.
- •Do not call axios directly in components when a store already owns that domain.
- •Keep
SKILL.mdconcise; put project details inreferences/project-api-conventions.md.