aarnâ protocol
visit sitelaunch dApp
  • protocol docs
  • 📖tech doc
    • whitepaper
    • aarnâ AI
    • âtv tokenization
    • dApp architecture
    • $AARNA token design
  • using aarna
    • create and connect DeFi wallet
      • Metamask
      • Coinbase Web3 Wallet
      • Trust Wallet
      • aarnâ wallet (applies to other DeFi wallets too)
    • onramp
      • CEX connections
        • Binance
        • Coinbase
      • onramp services
    • how to deposit in âtv vaults?
  • outreach
    • aarnâ tiered referral program
Powered by GitBook
On this page
  • Design
  • Architecture Overview
  • > DApp Frontend
  • > DApp Backend
  • > Mobile DApp
  1. tech doc

dApp architecture

> tech stack architecture

Previousâtv tokenizationNext$AARNA token design

Last updated 9 months ago

Design

aarnâ’s decentralized application (dApp) is designed to be an comprehensive solution for decentralized finance (DeFi) asset management, addressing higher value users to manage their full digital assets lifecycle. The dApp is not only designed to provide a front end for âfi vaults, but offers a seamless and intuitive interface for users to manage their DeFi positions, invest in various DeFi protocols, and maintain oversight of their entire crypto portfolio through a single, integrated platform.

Architecture Overview

The architecture of the aarnâ dApp leverages Next.js for the frontend, optimizing initial page load times through server-side rendering while enabling dynamic interactions with blockchain components via client-side rendering. The mobile app is built using the React Native framework and TypeScript. Leveraging React Native for cross-platform development and TypeScript for robust type safety, the aarnâ mobile dApp delivers a seamless and secure DeFi experience. The backend is powered by NestJS, selected for its security features and scalability, ensuring high standards of data privacy and security. Aarnâ uses AWS for cloud hosting and services, incorporating Kubernetes for container management and scalability. Data is managed through Amazon RDS for relational storage needs and MongoDB for user-specific data management. AWS services like EC2, S3, KMS, and Secrets Manager are integral for ensuring scalability, secure data storage, and management of encryption keys and sensitive data, all within a framework that supports both horizontal and vertical scaling strategies efficiently.

The DApp is composable with various protocols, notably Uniswap, Compound, Aave, GMX, and Ribbon which helps manage DeFi positions seamlessly. The user can connect any self-custodial wallet to aarnâ which includes Metamask, Coinbase Wallet or even create a social login backed aarnâ wallet which takes the UX to next level.

> DApp Frontend

  • Framework: Next.js with TypeScript

  • State Management: React Context API

  • Design System: Material UI (MUI)

  • Web3 SDK: ethers.js

  • Code Quality Tools: ESLint, SonarQube

  • Error Handling and Logging: Sentry

The frontend framework for the dApp utilizes Next.js for its hybrid rendering capabilities, leveraging Server-Side Rendering (SSR) for faster initial loads and improved SEO, and client-side rendering for dynamic DeFi interactions. TypeScript enhances code quality, while ESLint and SonarQube enforce coding standards and security. Real-time error tracking and monitoring are managed through Sentry. State management is handled by the React Context API, and Material UI (MUI) provides a consistent, responsive design system. This comprehensive approach ensures optimal performance, maintainability, and user experience.

> DApp Backend

Tech Stack:

  • Backend Framework: NestJS with TypeScript for a robust, modular architecture and static type-checking.

  • Databases: MongoDB (user data and configurations) and PostgreSQL (token data) to handle diverse data needs efficiently.

  • AWS Services: Utilizes KMS for encryption, Secret Manager for secure storage of secrets, and S3 for robust data storage.

  • Caching: Redis to enhance performance through effective caching mechanisms.

  • ORM: TypeORM for database management and migrations.

  • CI/CD: Jenkins and Argo CD for continuous integration and continuous deployment.

  • Containerization: Kubernetes and ECS for scalable, reliable container management.

  • Modular Design: The application’s structure is divided into core modules such as User, Token, Config, Cron Jobs, and Cache, promoting organized codebase and ease of management.

  • Security and Authentication: Employs JWT for secure authentication, RBAC for precise access control, and Web3 authentication for decentralized logins. Security practices include HTTPS, CORS setup, data encryption with AWS KMS, and regular security audits.

  • Database Integration: MongoDB’s schema-less design fits dynamic needs, while PostgreSQL manages structured data efficiently. Practices include thorough indexing, regular backups to AWS S3, and robust migration strategies with TypeORM.

Key AWS Implementations

  • Encryption and Security: AWS KMS and Secret Manager safeguard sensitive data, with stringent policies on access control and data encryption. AWS S3 is used extensively for backups and static content storage, ensuring data durability and compliance.

API and Real-Time Features

  • API Design: RESTful APIs are crafted following best practices for scalability and simplicity, with support from tools like Swagger for documentation.

  • Real-Time Interaction: WebSockets facilitate live updates and real-time communication, enhancing user experience.

> Mobile DApp

The aarnâ mobile app, built with React Native, provides a sleek, cross-platform experience by consuming the same robust backend APIs. Utilizing React Native ensures a consistent user interface across both iOS and Android.

  • Framework: React Native

  • Programming Language: TypeScript

  • State Management: Redux Toolkit

  • Design System: React Native Paper

  • Code Quality Tools: ESLint, SonarQube

  • Error Handling and Logging: Sentry, Redux Logger, RN Logs

While leveraging the modular backend architecture for efficient data management. With TypeScript, aarnâ enhances code quality and maintainability, and integrates real-time error tracking with Sentry for seamless performance. The app features secure user authentication, real-time updates, and smooth interactions with DeFi services, delivering a high-quality, responsive user experience.

📖
Figure 1: DApp Frontend
Figure 2: DApp Backend
Figure 3: Mobile DApp