How besimgurbuz/mfloww works
Main Components
• Frontend Client: Represented by the Next.js “app” directory. Distinguish primary pages (e.g., landing page, sign-in, beta, dashboard, settings) along with shared layout and contextual providers for themes, authentication, and user context.
• Server/API Endpoints: Group the API routes found under src/app/api. These endpoints handle various resources and processes:
• Beta access and validation (src/app/api/beta)
• Cron tasks (src/app/api/cron)
• Exchange rates (src/app/api/rates)
• User authentication and token verification (src/app/api/sign-in, verify-token)
• Data synchronization (src/app/api/sync) and its status
• User management (src/app/api/user)
• Business Logic & Integrations: Located in src/lib, these modules contain:
• Firebase integration (src/lib/firebase.ts)
• Local DB handling (src/lib/local-db)
• External service clients for exchange rates (src/lib/server/exchange-rates/*)
• Other utility functions (src/lib/utils.ts, src/lib/transaction)
• Shared UI Components & Design System: Found under the src/components directory. These provide reusable widgets (buttons, dialogs, tables, etc.), dashboard-specific components (charts, cards, transaction menus), and layout elements.
Relationships & Interactions
• The Frontend Client interacts with the API endpoints through HTTP requests (Next.js server-side functions are used to manage these interactions, often powered by server components).
• UI components (such as sign-in forms or dashboard widgets) are composed to create pages that in turn invoke API endpoints or use local libraries to fetch and display data.
• Shared libraries within src/lib are called by both client and server code to perform tasks like retrieving exchange rates (by invoking external services), processing local data, and applying authentication and cryptographic functionality.
• There is a clear separation between UI/presentation, API routes (serverless functions on Vercel), and backend logic (in src/lib), representing a clean full-stack architecture.
Architectural Patterns & Design Principles
• Separation of Concerns: The clear division into UI, API, and domain logic ensures each layer maintains its responsibility.
• Modular Design: Components, hooks, and utility libraries are implemented as separate modules that can be reused across pages.
• Serverless/API Routes: The use of Next.js API routes for business logic encapsulates server-side functions, making the architecture scalable (suitable for deployment on Vercel’s serverless architecture).