How frak-id/wallet works
Overall System Components
• Frontend Clients:
• Wallet Frontend: The wallet application (found under packages/wallet and parts of the SDK) that handles user authentication (e.g., SIWE, WebAuthn), onboarding, and wallet-specific interactions.
• Dashboard/Admin Interface: The Next.js–based dashboard (under packages/dashboard) that lets administrators manage campaigns, monitor referral data, and review metrics.
• SDK Integration (React/Vanilla): The SDK components (found in sdk/react, sdk/core, sdk/legacy, and sdk/components) available to client applications for seamless integration into web2 sites.
• Backend Services:
• API & Service Layer: The backend server is largely located in packages/backend-elysia (powered by Elysia.js) that serves as the interface for business logic, routing, and data processing.
• App Essentials & Shared Modules: The common core business and blockchain logic is bundled into packages like app-essentials and packages/shared to serve as the re-usable foundation for business rules (referral tracking, reward distribution, blockchain session management).
• Blockchain and On-Chain Interaction:
• Blockchain Interaction Layer: Integration components (using wagmi and viem) that manage on-chain activities such as gasless transactions, referral events, and reward distribution.
• Smart Wallet and Account Abstraction: Modules under the wallet package and backend handle smart wallet logic, including delegated sessions and WebAuthn based authentication.
• Infrastructure & Deployment:
• Microservices & IaC: Infrastructure scripts (in infra/) and configuration files (sst.config.ts, docker files) signal deployment via AWS and integrations with third-party services such as SST, OpenNext, Pimlico, ZeroDev, ERPC, and Ponder.
Architectural Patterns and Design Principles
• Modularity and separation of concerns: Each package in the monorepo (such as dashboard, wallet, backend-elysia, shared, app-essentials, and SDK libraries) represents a clearly decoupled component.
• Patterns like Account Abstraction (for gasless transactions), microservice separations between frontend and backend, and a dedicated blockchain integration layer.
• Extensibility of the SDK, with separate entry points for legacy vanilla JS, React hooks, and bundled core functionalities.