# Gigafibre FSM — Design Guidelines This document outlines the standard design principles and conventions for adding new features and modules to the Gigafibre FSM (Field Service Management) application. Adhering to these guidelines ensures scalability, maintainability, and highly efficient AI-assisted development (by keeping context windows small and token usage low). ## 1. Modular Architecture (Feature-Sliced Design) To avoid a monolithic `src/` folder that overwhelms both developers and AI tools, organize code by **feature** rather than strictly by technical type. **Do Not Do This (Technical Grouping):** ```text src/ components/ (contains dispatch, inventory, and customer components all mixed together) store/ (one massive pinia store for everything) api/ (one 2000-line api.js file) ``` **Do This (Feature Grouping):** ```text src/ features/ dispatch/ components/ store.ts api.ts types.ts equipment/ components/ store.ts api.ts types.ts shared/ ui/ (generic buttons, dialogs) utils/ ``` *Why?* When you need AI to build a new dispatch feature, you only need to feed it the `features/dispatch/` folder, drastically reducing token usage and hallucination. ## 2. API & ERPNext Abstraction Never make raw API calls (`axios.get`) directly inside a Vue component. * All ERPNext interactions must go through a dedicated API service file (`features/{module}/api.ts`). * **Rule:** Vue components should only dispatch actions (via Pinia) or call cleanly abstracted service functions. They should not care about Frappe endpoints or REST wrappers. ## 3. UI Component Standardization (Quasar) * **Composition API:** Use Vue 3 `