Skip to content

huseyindeniz/vite-react-dapp-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

71 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

React dApp Template (Vite)

version GitHub stars GitHub forks GitHub repo size GitHub language count GitHub top language GitHub last commit

A sophisticated, production-ready React template specifically designed for decentralized application (dApp) frontend development with modern Web3 integration.

πŸš€ Live Demo | πŸ“š Documentation

Quick Start

npx degit huseyindeniz/vite-react-dapp-template my-dapp
cd my-dapp
npm install
npm run dev

⚠️ UI Library Migration Notice:
Starting from v0.7.0, this template uses Mantine as the UI library. Previous versions used Chakra UI.

Why Choose This Template?

🎯 Built for Web3

  • Multi-Wallet Support: MetaMask, Core, Coinbase, Rabby with extensible architecture
  • Multi-Chain Ready: Ethereum, Polygon, Avalanche, BSC + all major testnets
  • Advanced Web3 State Management: Sophisticated three-model wallet system (Provider, Network, Account)

⚑ Modern Development Experience

  • Latest React 19: Concurrent features, improved Suspense, optimized rendering
  • Vite 7: Lightning-fast development and optimized production builds
  • TypeScript 5: Full type safety with advanced features
  • Feature-Based Architecture: Scalable organization by business domains

🧠 Advanced State Management

  • Redux Toolkit + Redux Saga: Predictable state with complex async workflows
  • Slice Lifecycle Management: Automatic cleanup strategies for optimal memory usage
  • Feature-Based Slices: Organized by business domains rather than technical layers

🎨 Modern UI/UX

  • Mantine v8: Comprehensive component library with excellent TypeScript support
  • Responsive Design: Mobile-first approach with flexible layouts
  • Dark/Light Mode: Built-in theme switching capabilities
  • Accessibility: ARIA compliant components out of the box

Core Features

πŸ” Web3 Wallet Integration

🌍 Internationalization (i18n)

  • Multi-Language Support: English, Turkish (easily extensible)
  • Browser Detection: Automatic language detection
  • Namespace Organization: Feature-based translation keys

🚦 Routing & Navigation

  • React Router v7: Latest routing with improved performance
  • Protected Routes: Wallet-based authentication guards
  • Lazy Loading: Route-based code splitting for optimal performance
  • SEO Optimization: Server-side rendering ready

πŸ§ͺ Comprehensive Testing

  • Unit Tests: Vitest with 30% coverage threshold
  • Component Tests: React Testing Library integration
  • Visual Testing: Storybook with multiple addons
  • E2E Testing: Cypress + Synpress setup (ready to implement)

Technology Stack

Core Technologies

Technology Version Purpose
React ^19.1.1 UI framework with latest features
TypeScript ^5.9.2 Type safety and developer experience
Vite ^7.1.3 Build tool and development server
Mantine ^8.2.7 UI component library
Redux Toolkit ^2.8.2 State management
Redux Saga ^1.3.0 Async side effects
React Router ^7.8.2 Client-side routing
Ethers.js ^6.15.0 Web3/blockchain integration
i18next ^25.4.2 Internationalization
Vitest ^3.2.4 Testing framework
Storybook ^8.6.14 Component documentation

Advanced Features

Slice Lifecycle Manager

Automatic Redux slice cleanup with multiple strategies:

  • Component: Cleanup when components unmount
  • Route: Cleanup when leaving routes
  • Cached: Time-based cleanup with configurable timeout
  • Persistent: Never cleanup automatically
  • Manual: Only cleanup when explicitly triggered

Web3 State Machine

Sophisticated three-model architecture:

  • Provider Model: Wallet detection and connection
  • Network Model: Chain switching and validation
  • Account Model: User authentication and signing

Service Layer Abstraction

Interface-driven architecture for external integrations:

  • Ethers.js Service: Blockchain interaction abstraction
  • JSONPlaceholder Demo: REST API integration example
  • Extensible Design: Easy to add new services

Architecture Overview

System Architecture

The template follows a feature-based architecture with clear separation of concerns:

πŸ“ Project Structure

src/
β”œβ”€β”€ features/           # Feature-based organization
β”‚   β”œβ”€β”€ app/           # Application bootstrap & providers
β”‚   β”œβ”€β”€ wallet/        # Web3 wallet integration
β”‚   β”œβ”€β”€ ui/            # Mantine-based design system
β”‚   β”œβ”€β”€ router/        # Routing configuration
β”‚   β”œβ”€β”€ i18n/          # Internationalization
β”‚   β”œβ”€β”€ slice-manager/ # Redux lifecycle management
β”‚   └── blog-demo/     # Complete feature example
β”œβ”€β”€ pages/             # Application pages
β”œβ”€β”€ services/          # External API integrations
β”œβ”€β”€ store/             # Redux store configuration
└── hooks/             # Custom React hooks

πŸ”„ Data Flow

Data Flow

  1. UI Layer: React components with Mantine design system
  2. State Layer: Redux Toolkit with automatic slice management
  3. Service Layer: Ethers.js and REST API abstractions
  4. External: Blockchain networks and REST APIs

Development Commands

Core Commands

npm run dev          # Development server with HMR
npm run build        # Production build (TypeScript + Vite)
npm run test         # Unit tests with Vitest
npm run lint         # ESLint with zero warnings tolerance
npm run coverage     # Test coverage report
npm run preview      # Preview production build

Storybook

npm run storybook         # Component development environment
npm run build-storybook   # Build static Storybook

Internationalization

npm run extract             # Extract translation keys
npm run check-translations  # Validate translations

Release

npm run release      # Version bump and release
npm run prepare      # Setup git hooks

Configuration

Environment Variables

# Wallet Configuration
VITE_WALLET_SIGN_TIMEOUT_IN_SEC=60
VITE_WALLET_DISABLE_SIGN=false
VITE_WALLET_POST_LOGIN_REDIRECT_PATH=/dashboard

# Router Configuration
VITE_ROUTER_USE_HASH=false

# Performance
VITE_WALLET_SLOW_DOWN_IN_MS=500

Supported Networks

// Pre-configured networks
SUPPORTED_NETWORKS = [
  AvalancheChain,
  BinanceSmartChain,
  PolygonChain,
  EthereumMainnetChain,
  // + All major testnets
];

TypeScript Path Aliases

"paths": {
  "@/features/*": ["./src/features/*"],
  "@/services/*": ["./src/services/*"],
  "@/pages/*": ["./src/pages/*"],
  "@/hooks/*": ["./src/hooks/*"],
  "@/store/*": ["./src/store/*"]
}

Performance & Optimization

Bundle Optimization

  • βœ… Manual Chunking: Strategic code splitting
  • βœ… Tree Shaking: Dead code elimination
  • βœ… Lazy Loading: Route-based dynamic imports
  • βœ… Memory Management: Automatic Redux cleanup

Build Output

πŸ“¦ Optimized Chunks:
β”œβ”€β”€ ethers.js      (~255KB) - Web3 functionality
β”œβ”€β”€ mantine.js     (~250KB) - UI components
β”œβ”€β”€ router.js      (~200KB) - Routing logic
β”œβ”€β”€ rtk.js         (~23KB)  - State management
└── app.js         (~166KB) - Application code

Documentation

πŸ“š Comprehensive Documentation

🎨 Visual Documentation

Alternative Versions

Contributing

We welcome contributions from the community!

How to Contribute

Development Setup

git clone https://github.com/huseyindeniz/vite-react-dapp-template.git
cd vite-react-dapp-template
npm install
npm run dev

License

This project is licensed under the MIT License.


πŸš€ Ready to build the next generation of decentralized applications?

Get Started Now | View Live Demo | Star on GitHub ⭐