Skip to content

Architecture Overview

The docs/ARCHITECTURE.md in your project is the source of truth that all agents follow. This page summarizes the key patterns.

Modular Structure

Every feature is a self-contained module:

text
src/modules/[feature]/
├── components/     ← UI
├── composables/    ← Logic (service → adapter → query)
├── services/       ← Pure HTTP (no try/catch)
├── adapters/       ← Parsers (API ↔ App)
├── stores/         ← Client state only (Pinia)
├── types/          ← .types.ts (API) + .contracts.ts (App)
├── views/          ← Pages
├── __tests__/      ← Tests
└── index.ts        ← Barrel export (public API)

Import Rules

  • Modules → Shared: ✅ Allowed
  • Modules → Modules: ❌ Never (move shared code to shared/)
  • App → Modules: ✅ Router and registration only

Four-Layer Architecture

LayerDoesDoes NOT
ServiceHTTP callstry/catch, transformation, logic
AdapterParse API ↔ App (snake_case → camelCase)HTTP, side effects
ComposableOrchestrate service + adapter + Vue QueryRender UI
Pinia StoreClient state (UI, filters, preferences)Server state, HTTP
ComponentUI + compositionHeavy business logic

Data Flow Example

Here's what happens when a user visits the Products page:

State Management Split

Pinia = Client state (UI, filters, preferences) Vue Query = Server state (API data, caching, background refresh)

Naming Conventions

Files

TypePatternExample
Directorieskebab-caseuser-settings/
ComponentsPascalCase.vueUserSettingsForm.vue
ViewsPascalCase + View.vueMarketplaceView.vue
Composablesuse + PascalCase.tsuseMarketplaceList.ts
Serviceskebab-case-service.tsmarketplace-service.ts
Adapterskebab-case-adapter.tsmarketplace-adapter.ts
Storeskebab-case-store.tsmarketplace-store.ts
Typeskebab-case.types.tsmarketplace.types.ts
Contractskebab-case.contracts.tsmarketplace.contracts.ts

Code

TypePatternExample
Variables / functionscamelCasegetUserById, isLoading
Types / InterfacesPascalCaseUserProfile, MarketplaceItem
ConstantsUPPER_SNAKE_CASEAPI_BASE_URL, MAX_RETRIES
Composablesuse + PascalCaseuseAuth, useMarketplaceList
Booleansis/has/can/shouldisLoading, hasPermission
Event handlershandle + actionhandleSubmit, handleDelete

Key Patterns

  • Stop Prop Drilling: Use slots + provide/inject + direct composables
  • Utils vs Helpers: Utils = pure functions, Helpers = functions with side effects
  • Error Handling: Centralized in composables (Vue Query onError)
  • SOLID in Vue: Each file = 1 responsibility

Deep Dive

  • Layers — Detailed examples of each layer
  • Components — Component patterns and composition
  • Full reference: docs/ARCHITECTURE.md in your project

Released under the MIT License.