A modern cryptocurrency trading platform case study project. Developed using Next.js 15, React 19, TypeScript, and Tailwind CSS.
This project is a case study for developing the frontend of a cryptocurrency trading platform using modern web development technologies. It includes real-time data streaming, user management, and responsive design features.
- Real-Time Data: Live price tracking with Binance WebSocket API integration
- User Management: State management with Zustand and persistent authentication
- Responsive Design: UI optimized for mobile and desktop
- Modern UI Components: Professional appearance with Shadcn/ui
- Form Management: React Hook Form and Zod validation
- Portfolio Tracking: User investment portfolio and profit/loss calculation
- Theme Support: Dark/Light mode support
src/
βββ app/ # Next.js App Router
β βββ layout.tsx # Main layout
β βββ page.tsx # Landing page
β βββ market/ # Market page
β β βββ page.tsx
β β βββ components/ # Market-specific components
β β βββ market-dashboard/
β β βββ market-table/
β βββ dashboard/ # Dashboard page
β β βββ page.tsx
β β βββ components/ # Dashboard-specific components
β β β βββ portfolio-dashboard/
β β β βββ portfolio-table/
β β βββ hooks/ # Dashboard-specific hooks
β βββ login/ # Login page
β β βββ page.tsx
β β βββ components/ # Login-specific components
β βββ types/ # Type definitions
β βββ constants/ # Constants
βββ components/ # Shared UI components
β βββ ui/ # Shadcn/ui components
β βββ auth-guard.tsx # Route protection
β βββ header.tsx # Main header
β βββ ...
βββ hooks/ # Custom hooks
βββ lib/ # Utility functions
βββ providers/ # Context providers
βββ services/ # API services
βββ stores/ # Zustand stores
This project adopts a page-based component structure:
-
Page-Specific Components: Each page has its own
components/folderapp/market/components/- Components used only on the market pageapp/dashboard/components/- Components used only on the dashboard pageapp/login/components/- Components used only on the login page
-
Shared Components: In the general
src/components/folder- Header, AuthGuard, UI components and other components used in multiple places
- Modular Structure: Each page manages its own components
- Easy Maintenance: Page-specific changes don't affect other areas
- Performance: Optimized loading with Next.js code splitting
- Developer Experience: Related files are located close together
- Zustand: Simple and performant global state management
- Persist Middleware: Stores authentication state in localStorage
- Local State: Component-based useState usage
- Next.js 15: Modern React framework with App Router
- React 19: Latest React version
- TypeScript: Type safety and developer experience
- Tailwind CSS v4: Utility-first CSS framework
- Shadcn/ui: Radix UI-based component library
- React Hook Form: Performant form management
- Zod: Schema validation
- @hookform/resolvers: React Hook Form integration
- Zustand: Global state management
- JSON Server: Mock backend API
- WebSocket: Real-time data streaming
- Biome: Linting and code formatting
- TypeScript: Static type checking
- Bun: Fast package manager and runtime
- Node.js 18+ or Bun
- Modern web browser
- Clone the repository
git clone https://github.com/raelsei/crypto-x.git
cd crypto-x- Install dependencies
# With Bun (recommended)
bun install
# or with npm
npm install- Start the mock backend
# Terminal 1 - JSON Server
bun run start:server
# Will run at http://localhost:3001- Start the development server
# Terminal 2 - Next.js App
bun dev
# Will run at http://localhost:3000bun run build
bun start- Landing Page (
/): Platform introduction and quick access - Market (
/market): Crypto prices - public access - Login (
/login): User login - Dashboard (
/dashboard): Portfolio management - logged in users only
Demo account you can use for testing:
Email: admin
Password: admin123
The application supports the following cryptocurrency pairs:
- BTC/USDT - Bitcoin
- ETH/USDT - Ethereum
- XRP/USDT - Ripple
- BNB/USDT - Binance Coin
- SOL/USDT - Solana
- DOGE/USDT - Dogecoin
- TRX/USDT - Tron
- ADA/USDT - Cardano
- LINK/USDT - Chainlink
- AVAX/USDT - Avalanche
GET /users # User list
POST /users # New user registration
GET /orders # User orders
POST /orders # Create new order- Binance WebSocket API: Real-time crypto prices
- Stream Format:
{pair}@trade(e.g.,btcusdt@trade) - Connection Status: Visible in header
- Responsive Design: Mobile-first approach
- Dark/Light Theme: System preference or manual selection
- Modern Component Library: Consistent design with Shadcn/ui
- Loading States: Skeleton loaders and progress indicators
- Toast Notifications: User notifications with Sonner
- Form Validation: Real-time validation and error handling
- Real-time price updates
- Automatic connection renewal
- Connection status indicator
- Zustand-based state management
- LocalStorage persistence
- Route protection with AuthGuard
- Automatic redirect operations
- Real-time profit/loss calculation
- Investment amount vs current value comparison
- Trend analysis and visualization