How nuxt-modules/medusa works
Main Components
a. Client-Side Components:
• Nuxt Application Layer
• useMedusaClient Composable
• Client-side API Handlers
b. Server-Side Components:
• Server Middleware Layer
• serverMedusaClient Service
• API Routes (/server/api)
c. External Systems:
• Medusa E-commerce Backend
• @medusajs/js-sdk Integration
┌─────────────────────────────────────────────┐
• Nuxt Application │
• ┌─────────────────┐ ┌────────────────┐ │
• Components │ │ Composables │ │
• Vue Templates │ │- useMedusaClient│ │
• ┘ └────────────────┘ │
• ┤
• Server Middleware │
• ┌─────────────────┐ ┌────────────────┐ │
• API Routes │ │ServerMedusaClient│
• /products │ │ Service │ │
• /customer │ │ │ │
• /regions │ │ │ │
• ┘ └────────────────┘ │
• ┤
• External Services │
• ┌─────────────────────────────────────────┐│
• Medusa E-commerce Backend ││
• ┘│
• ┘
Key Relationships to Highlight
• How useMedusaClient composable communicates with Medusa backend
• Server middleware's role in handling API requests
• Demonstrate the connection between serverMedusaClient and Medusa backend
• Relationship between the module's components and the host Nuxt application
Important Implementation Details
• Configuration flow from .env (MEDUSA_URL)
• TypeScript integration points
• Module's plugin system
• Test coverage areas