How hsankalp/mvvm-pattern-mobx works
Main Components Identification
a. Client-Side Layer:
• Next.js Pages (Entry Points)
• React Components (with MVVM pattern)
• Global Store (State Management)
• API Integration
b. Server-Side Layer:
• Next.js API Routes
• Server-Side Rendering (SSR) Infrastructure
┌─────────────────────────────────────── Client Browser ───────────────────────────────────────┐
• ┌─────────────────── Next.js Application ───────────────────┐ │
• ┌─────────────┐ ┌───────────────────────────────┐ │ │
• Pages │ │ Components Layer │ │ │
• index.tsx │───▶│ ┌─────────────┐ ┌─────────┐ │ │ │
• _app.js │ │ │ History │ │ Result │ │ │ │
• _document.js│ │ │ (MVVM) │ │ │ │ │ │
• ┘ │ └─────────────┘ └─────────┘ │ │ │
• ▲ └───────────────────────────────┘ │ │
• ▲ │ │
• ┌─────────────┐ ┌─────────────────┐ │ │
• API Routes │ │ Global Store │ │ │
• /api/hello │◀─────▶│ (store.ts) │ │ │
• ┘ └─────────────────┘ │ │
• ┘ │
• ┘
Key Architectural Patterns to Highlight
a. MVVM Pattern (History Component):
• Separation between View.tsx and ViewModel.ts
• Data binding flow
b. State Management:
• Store connection to components
• State update flow
c. Next.js Routing:
• Relationship between pages and components
• API routes integration
Important Details
a. Component Architecture:
• History component with MVVM implementation
• Result component structure
• Pages structure with _app.js and _document.js
b. Data Flow:
• Client-side routing
• API communication
• State management interactions
Technical Stack Indicators
• Next.js framework
• React components
• TypeScript implementation
• API routes
• Global state management