beiryu
  • Projects
  • Blog
  • About

© 2026 Khanh Dinh. I build software and write about the journey.

  • GitHub
  • LinkedIn
  • X
January 1, 2024 · 0 views

How to build a Portfolio Tracking like CoinMarketCap from Zero (Part 1)

The MVP will focus on essential features required to track and manage portfolios of various assets, including cryptocurrencies. It will serve as a foundation for future feature enhancements adding later: NFTs, stocks, re

  • Tutorials
  • Crypto
  • Backend

Requirements#

Define Minimum Viable Product#

The MVP will focus on essential features required to track and manage portfolios of various assets, including cryptocurrencies. It will serve as a foundation for future feature enhancements adding later: NFTs, stocks, real estate, and custom assets.

  1. User Registration and Authentication
    • User registration with email and password.
    • User registration with phone number.
    • User registration with socials: tiktok, snapchat, facebook, Instagram, google, apple.
    • Basic user profile management.
  2. Portfolio Management
    • Ability to add, edit, and delete assets in the portfolio.
    • Support for cryptocurrencies first.
    • Basic input fields for asset details (e.g., name, quantity, purchase price).
    • Multiple portfolios per user.
  3. Real-time Asset Valuation
    • Integration with a single market data source to fetch and display real-time asset valuations. Integration with (Coinmarketcap.com API).
    • Basic chart or graph to visualize portfolio value over time. Integration with (Trading View API).
  4. Marketplace
    • Coin monitoring with filtering options.
    • Integration with additional market data sources.
  5. Alerts and Notifications
    • Ability to set price change alerts for individual assets.
    • Basic push notifications for alerts.
  6. Data Storage
    • Secure storage of user portfolio data.
  7. User Interface
    • A simple and intuitive user interface adhering to platform-specific design guidelines for iOS and Android.
    • Vertically place assets under category headers on main portfolio screens).
    • Multilingual support (English, Spanish, French, Arabic, Chinese, - Hebrew, German, Indonesian, Tagalog)
  8. Advanced Features:
    • Advanced portfolio analytics and performance metrics.
    • NFTs, stocks, real estate, and custom assets.
    • Data import/export functionality (export .csv, .xlsx, .pdf).
    • Tax calculation and reporting.
    • User customization options (e.g., custom asset categories).

Technical Requirements#

This Technical Requirements Document outlines the technical aspects of the portfolio tracking mobile application project, specifying the technologies, APIs, data storage, security, performance, testing, documentation, and deployment requirements. Following these technical requirements will lead to the successful development and deployment of the application, meeting the needs of investors and asset managers.

  1. System Architecture
    • Mobile Application: The mobile application will be developed using Flutter, ensuring a responsive and consistent user experience across iOS and Android platforms.
    • Backend System: The backend system will be built using Node.js, providing a robust and scalable infrastructure to handle user data, asset data, and real-time market data.
    • Frontend Web: The website will be implemented using Next.js, supporting for SSR and SSG, helping to speed up page loading and SEO.
  2. APIs and Integrations
    • The features are accessible via secure REST API endpoints.
    • Integration with market data providers for real-time asset valuations. (Coinmarketcap.com, coingecko.com, coinbase.com, binance.com).
    • Integration with Apple and Google for social login
    • Using Firebase for push notification services in alerts
  3. Technology Stack

    3.1. Node.js

    • NestJs framework for the backend server.
    • PostgreSQL for data storage.
    • SendGrid for sending emails.
    • Twilio for sending SMS verification codes.
    • AWS S3 to store asset files.
    • Websocket for streaming real-time data.

    3.2. Next.js

    • Next.js for server-side rendering (SSR) and static site generation (SSG).
    • Integration with various APIs for dynamic content.

    3.3. Flutter

    • Flutter for cross-platform mobile application development.
    • Dart programming language for Flutter development.
    • State management libraries like Provider or Riverpod for efficient data management.

  4. API Requirements

    4.1. Authentication

    • Implement user registration, login, and session management.
    • Use token-based authentication for API access.
    • Secure password hashing and storage.

    4.2. Portfolio Management

    • Create API endpoints for adding, updating, and deleting assets in the user's portfolio.
    • Support various asset types including cryptocurrencies, stocks, real estate, and custom assets.

    4.3. Transaction Management

    • Create API endpoints for adding , updating and deleting transactions in user’s coin holdings.
    • Calculate profit or loss, net cost, value change, etc.

    4.4. Real-time Data Integration

    • Implement APIs for real-time asset valuations.
    • Integrate with market data providers to fetch and update asset values.
    • Implement data caching and synchronization for offline access.

    4.5. Notifications

    • Implement push notification services for price change alerts.
    • Allow users to configure notification preferences.

    4.6. Marketplace

    • Implement APIs to get the price performance statistics of the market coin.
    • Implement APIs to get the list of coins, coin details, coin suggestions, and coin search.
    • Implement APIs to return data for both line charts and OHLC charts.

  5. Scripts
    • Init market chart data
    • Init exchange list data
    • Init network categories data
    • Init currency data
  6. Performance and Scalability

    6.1. Application Performance

    • Optimize application performance for responsiveness.
    • Implement efficient data fetching and rendering.
    • Cache frequently accessed data.

    6.2. Scalability

    • Design the system to handle a growing user base. (Multiple users will be fetching and fetching their portfolios via refresh and re-fetch simultaneously).
    • Implement load balancing and scaling mechanisms for the backend.

Data Storage and Security#

  1. Data Storage
    • Store user and asset data in a secure and scalable database.
    • Implement data backup and recovery mechanisms.
    • Implement data archiving for historical data.
  2. Data Security
    • Encrypt sensitive data at rest and in transit.
    • Implement role-based access control.
    • Regularly audit and monitor system security.
  3. Data Backup and Recovery
    • Set up automated data backup and recovery processes.
    • Ensure the ability to recover data in case of system failures or data corruption.
    • Minimum of two DB Servers (Primary and Secondary) and data replication at specific time intervals.

Deployment#

  1. iOS App Deployment
    • Deploy the iOS app to the Apple App Store.
    • Follow Apple's guidelines for app submission.
  2. Android App Deployment
    • Deploy the Android app to Google Play Store.
    • Adhere to Google's app submission requirements.
  3. Backend Deployment
    • Deploy the backend system to a reliable and scalable cloud hosting provider.
    • Ensure high availability and load balancing (Jenkins, AWS).
  4. Frontend Deployment
    • Ensure the packaging is into lightweight, static files that are system-friendly.

Get started#

🏛 Project Configuration and Deployment Structure#

Project structure and implementation framework

CI/CD enviroment
CI/CD enviroment
  • Use Jenkins-ci, AWS CodeDeploy, AWS S3 to build a CI/CD environment
  • When receiving a push request from Bitbucket, use Jenkins-ci to build and test
  • In case of the main branch, send the build file to AWS S3 and request deployment from AWS CodeDeploy
deployment environment
deployment environment
  • Design data model with Sequelize and PostgreSQL, develop API server with NestJS
  • Build deployment environment with AWS CodeDeploy, AWS EC2, Docker
  • Improve server stability and scalability with Docker
  • Monitor server with Netdata

🚀 Continue …

Enjoyed this? Get the next one by email.

Keep reading

Aug 4, 2023

New features of Next.js

Hey there! Ever heard of Next.js? It's a pretty cool tool for creating single page web apps (SPA) and static web apps (SSG). Built on React, Next.js is packed with handy features that can shave hours off your development time and make your pages load lightning fast. In this piece, we're gonna check out what's new and exciting in the latest version of Next.js. Stay tuned!

Jul 1, 2023

Caching Data from CMS in Next.js

Hey there! This piece will show you how to supercharge your page loading on NextJs with data caching. It's pretty cool, you can use getStaticProps or getServerSideProps to nab data from CMS API and then store it using lru-cache or react-cache - they let you set a lifespan for your data. And that's not all, we're also gonna talk about Redis - a whizz-kid of a global cache solution for your NextJs app.