How het-t/xdoc-front works
Project Type and Purpose
• This is a Single-Page Application (SPA) built with Vue.js and TypeScript.
• The codebase contains no backend server; instead it interacts with external HTTP APIs (e.g., signIn, getSpaces, queryCollection).
• The purpose is to render and manipulate “collections,” “pages,” “blocks,” and user/team data in a Notion-style interface, handling transactions and syncing state with a remote service.
File Structure
• Top-Level Directories & Files
– public/: static assets and index.html
– src/: application source
– dist/: built output (CSS, JS bundles, index.html for deployment)
– Configuration: vue.config.js, tsconfig.json, jsconfig.json, ESLint, Prettier and GitHub Actions workflow
• src/ Substructure
– src/main.ts: app bootstrap, Vue instance, router and store registration
– src/ui/: view layer (views/, components/, router/, composables/, helpers/)
– src/entities/: domain model classes (Block, Page, Collection, etc.)
– src/services/
· api/: HTTP client wrappers and endpoint definitions
· transactions/: factories and types to build transaction payloads
– src/stores/: application state (collections, transactionsQueue, teams, recordValues, etc.)
– src/usecases/: pure functions for UI use-cases (listBefore, set, update, etc.)
README
• Uses standard Vue CLI setup (webpack, hot-reload, linting).
a. Main Components
• Browser / Client
– Vue.js SPA (App.vue → router → views → components)
– State Management (stores/*)
– Domain Layer (entities/*)
– UI Use-Cases (usecases/* & ui/composables)
• API Layer
– services/api: HTTP calls to external backend
– services/transactions: builds operations and transaction payloads
• External Services
– Remote REST or GraphQL service (authentication, data fetch/update)
b. Relationships & Interactions
• User Events → UI Components → Composables/UseCases → Store Actions
• Store Actions → Transaction Factories → API Calls → Remote Service
• API Response → services/api → stores → UI re-render
• Domain Entities mediate JSON ↔ JavaScript objects
c. Architectural Patterns & Principles
• Layered Architecture (UI → Application Logic → Domain → Infrastructure)
• Separation of Concerns (entities vs. services vs. stores vs. components)
• Transactional Command Pattern (services/transactions factories create operations)
• Modular Folder Structure supporting feature isolation
d. Key Technologies & Frameworks
• Vue.js (components, views, router)
• TypeScript (strong typing for entities, stores, API types)
• Vuex-style stores or Pinia (state management)
• Axios or fetch wrappers in services/api
• Webpack/Vue CLI (build pipeline, hot-reload)
Detailed Elements to Capture
– Entry point (main.ts) and routing (vue-router)
– UI composition: views vs. reusable components
– Composables vs. traditional usecases modules
– Entities folder as domain model layer
– services/api vs. services/transactions distinction
– stores covering collections, teams, transactionsQueue, recordValues
– Data flow: how a user action leads to an API call and state update