Skip to content

teasec4/flutter-crypto-app

Repository files navigation

πŸ’° Flutter Crypto App

A modern cryptocurrency and NFT tracking application built with Flutter, demonstrating Clean Architecture principles and best practices in modern mobile development.

Flutter Dart Architecture State Management


πŸ“Έ Screenshots

Market NFT
Market NFT

✨ Features

  • πŸ’° Cryptocurrency Tracking – Real-time crypto market data from CoinGecko
  • 🎨 NFT Marketplace – Browse NFT collections via Reservoir API
  • ⭐ Favorites System – Save and manage your favorite coins and NFTs
  • πŸ” Authentication – Secure user authentication with Supabase
  • πŸ“Š Detailed Analytics – View comprehensive coin and NFT details
  • πŸŒ™ Theme Support – Light and dark mode
  • πŸ“± Responsive Design – Optimized for all screen sizes

πŸ—οΈ Architecture

This project follows Clean Architecture principles with clear separation of concerns across three layers:

lib/
β”œβ”€β”€ core/                          # Shared utilities and base classes
β”‚   β”œβ”€β”€ constants/                 # App-wide constants
β”‚   β”œβ”€β”€ errors/                    # Error handling
β”‚   β”œβ”€β”€ network/                   # HTTP client configuration
β”‚   β”œβ”€β”€ theme/                     # App theming
β”‚   └── utils/                     # Helper functions
β”œβ”€β”€ features/                      # Feature modules
β”‚   β”œβ”€β”€ coin/                      # Cryptocurrency feature
β”‚   β”‚   β”œβ”€β”€ data/                  # Data layer
β”‚   β”‚   β”‚   β”œβ”€β”€ coin_service.dart  # API service
β”‚   β”‚   β”‚   β”œβ”€β”€ models/            # Data models
β”‚   β”‚   β”‚   └── coin_repository_impl.dart
β”‚   β”‚   β”œβ”€β”€ domain/                # Business logic layer
β”‚   β”‚   β”‚   β”œβ”€β”€ entities/          # Domain entities
β”‚   β”‚   β”‚   └── coin_repository.dart
β”‚   β”‚   └── presentation/          # UI layer
β”‚   β”‚       β”œβ”€β”€ pages/             # Screens
β”‚   β”‚       β”œβ”€β”€ widgets/           # Reusable widgets
β”‚   β”‚       └── providers/         # Riverpod providers

🧩 Architecture Layers

Data Layer

  • API services for external data sources
  • Data models with JSON serialization
  • Repository implementations
  • Local storage management

Domain Layer

  • Business entities
  • Repository interfaces
  • Use cases (business logic)

Presentation Layer

  • UI screens and widgets
  • Riverpod providers for state management
  • View models

πŸ› οΈ Tech Stack

Core

  • Flutter SDK: 3.9+
  • Dart: 3.9.2+
  • Architecture: Clean Architecture
  • State Management: Riverpod 2.6.1

Key Dependencies

Package Purpose
riverpod / flutter_riverpod State management & dependency injection
go_router Declarative routing & navigation
dio HTTP client for API requests
fpdart Functional programming (Either for error handling)
supabase_flutter Backend-as-a-Service (Auth + Database)
shared_preferences Local data persistence
cached_network_image Image caching and loading
flutter_svg SVG rendering
intl Internationalization and formatting

πŸ“¦ API Integrations

πŸͺ™ CoinGecko API

Free cryptocurrency data API providing:

  • Market data for 10,000+ cryptocurrencies
  • Price charts and historical data
  • Market statistics and trends
  • No API key required

Base URL: https://api.coingecko.com/api/v3/


🎨 Reservoir API

NFT marketplace aggregator providing:

  • NFT collection data
  • Floor prices and sales
  • Collection metadata

Base URL: https://api.reservoir.tools/
(May require API key for production)


🧰 Supabase

Used for:

  • User authentication (email/password)
  • Session management
  • Database operations

πŸš€ Getting Started

🧱 Prerequisites

  • Flutter SDK 3.9 or higher
  • Dart 3.9.2 or higher
  • iOS Simulator / Android Emulator or physical device
  • Supabase account (for authentication features)

πŸ”§ Installation

1️⃣ Clone the repository

git clone https://github.com/teasec4/flutter-crypto-app.git
cd flutter-crypto-app

2️⃣ Install dependencies

flutter pub get

3️⃣ Configure Supabase

Create file lib/core/secrets/app_secrets.dart:

class AppSecrets {
  static const String supabaseUrl = 'YOUR_SUPABASE_URL';
  static const String supabaseAnonKey = 'YOUR_SUPABASE_ANON_KEY';
}

Get your credentials from Supabase:

  • Create a new project
  • Go to Settings β†’ API
  • Copy the Project URL and anon/public key

4️⃣ Run the app

flutter run

5️⃣ Build for production

πŸ“± Android

flutter build apk --release
# or
flutter build appbundle --release

🍎 iOS

flutter build ios --release

🎯 Project Structure Highlights

πŸŒ€ State Management with Riverpod

final coinRepositoryProvider = Provider<CoinRepository>((ref) {
  return CoinRepositoryImpl(CoinService());
});

final coinListProvider = StateNotifierProvider<CoinListNotifier, AsyncValue<List<Coin>>>((ref) {
  return CoinListNotifier(ref.read(coinRepositoryProvider));
});

🧠 Functional Error Handling

Future<Either<Failure, List<Coin>>> getCoins() async {
  try {
    final coins = await _service.fetchCoins();
    return Right(coins);
  } catch (e) {
    return Left(ServerFailure(e.toString()));
  }
}

πŸ—ΊοΈ Navigation with Go Router

final router = GoRouter(
  redirect: (context, state) {
    // Auth guard logic
  },
  routes: [
    StatefulShellRoute(
      builder: (context, state, navigationShell) {
        return ScaffoldWithNavBar(navigationShell: navigationShell);
      },
      branches: [
        // Coins, NFTs, Favorites, Profile tabs
      ],
    ),
  ],
);

πŸ“š What You Can Learn

βœ… Clean Architecture – Proper separation of concerns
βœ… Riverpod – Modern state management & DI
βœ… Go Router – Declarative navigation
βœ… Functional Programming – Robust error handling
βœ… API Integration – REST APIs
βœ… Supabase – Authentication & backend
βœ… Repository Pattern – Data abstraction
βœ… Dependency Injection – Testable code
βœ… Responsive UI – Adaptive layouts
βœ… Local Storage – Favorites persistence


πŸ§ͺ Testing

# Run all tests
flutter test

# Run with coverage
flutter test --coverage

# Run integration tests
flutter test integration_test

πŸ“± Features Breakdown

πŸͺ™ Coin Feature

  • Browse cryptocurrency market
  • Search and filter coins
  • View detailed coin information
  • Price charts and statistics
  • Add to favorites

🎨 NFT Feature

  • Explore NFT collections
  • View collection details
  • Floor prices and volume
  • Metadata display

⭐ Favorites Feature

  • Save favorite coins & NFTs
  • Local persistence
  • Quick access to saved items

πŸ” Auth Feature

  • Email/password authentication
  • Session management
  • Protected routes
  • User profile

βš™οΈ Configuration

Example environment config:

class EnvConfig {
  static const bool isProduction = bool.fromEnvironment('dart.vm.product');
  static const String apiBaseUrl = String.fromEnvironment(
    'API_BASE_URL',
    defaultValue: 'https://api.coingecko.com/api/v3/',
  );
}

Run with:

flutter run --dart-define=API_BASE_URL=https://your-api.com

🀝 Contributing

  1. Fork the project
  2. Create a feature branch:
    git checkout -b feature/AmazingFeature
  3. Commit your changes:
    git commit -m 'Add some AmazingFeature'
  4. Push to the branch:
    git push origin feature/AmazingFeature
  5. Open a Pull Request

πŸ“„ License

This project was created for educational purposes.


πŸ‘€ Author

teasec4


πŸ™ Acknowledgments

  • CoinGecko – for free crypto API
  • Reservoir – for NFT data
  • Supabase – for backend services
  • Flutter & Dart communities for excellent tools

πŸ“– Resources


⭐️ If this project helped you learn Flutter and Clean Architecture, give it a star!

About

Educational crypto & NFT tracking app built with Flutter, Riverpod, and Clean Architecture

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published