A full-stack cryptocurrency wallet application featuring multi-currency support, wallet management, token swapping, and real-time portfolio tracking.
- π Create Wallets: Generate new wallets with BIP39 12-word seed phrases
- π₯ Multi-Currency Support: BTC, ETH, USDT, USDC, BNB, SOL, XRP, ADA, DOGE, DOT
- πΌ Multiple Wallets: Manage multiple wallets per account
- π Portfolio Overview: Real-time total portfolio value across all assets
- πΈ Send Crypto: Send transactions to any address
- π Token Swapping: Exchange between cryptocurrencies with 0.5% fee
- π Transaction History: View complete transaction history per wallet
- β±οΈ Real-time Updates: Live transaction status tracking
- π± Live Price Data: Real-time cryptocurrency prices with 24h changes
- π¨ Modern UI: Clean, responsive interface with reusable components
- π Secure Authentication: JWT-based auth with HttpOnly cookies
- π± Mobile-Friendly: Responsive design for all screen sizes
- π Toast Notifications: User-friendly feedback for all actions
- β‘ Loading States: Skeleton loaders and spinners for better UX
- π‘οΈ Error Boundaries: Graceful error handling with recovery options
- π Localization Ready: Centralized string management for i18n support
- Node.js (v18+)
- PostgreSQL (v12+)
- npm or yarn
# 1. Clone and install
git clone <repository-url>
cd crypto-wallet-mvp
npm install
# 2. Setup environment
cp src/config/.env.example .env
# Edit .env with your PostgreSQL credentials
# 3. Setup database with test data (one command!)
npm run setup:db
# 4. Start the application
npm run devThat's it!
Open http://localhost:3000 and login with:
- Email:
admin@test.com - Password:
admin123
| Script | Command | Description |
|---|---|---|
dev |
npm run dev |
Starts both client and server in development mode concurrently |
dev:client |
npm run dev:client |
Starts the webpack dev server for the React frontend (port 3000) |
dev:server |
npm run dev:server |
Starts the Express server with nodemon for hot reloading (port 5000) |
| Script | Command | Description |
|---|---|---|
build |
npm run build |
Builds the client for production using webpack |
build:client |
npm run build:client |
Alias for build - builds the React frontend |
start |
npm start |
Starts the production server |
start:server |
npm run start:server |
Alias for start - runs the Express server |
| Script | Command | Description |
|---|---|---|
setup:db |
npm run setup:db |
All-in-one database setup (drop, recreate, migrate, seed) |
init:db |
npm run init:db |
Initializes the database schema |
reset:db |
npm run reset:db |
Drops and recreates all database tables (destructive) |
seed |
npm run seed |
Seeds the database with a test user |
test:db |
npm run test:db |
Tests the database connection |
| Script | Command | Description |
|---|---|---|
migrate |
npm run migrate |
Runs pending database migrations |
migrate:up |
npm run migrate:up |
Applies all pending migrations |
migrate:down |
npm run migrate:down |
Reverts the last migration |
migrate:status |
npm run migrate:status |
Shows the status of all migrations |
migrate:dry |
npm run migrate:dry |
Dry run - shows what migrations would be applied |
migrate:create |
npm run migrate:create |
Creates a new migration file |
migrate:mark |
npm run migrate:mark |
Marks a migration as complete without running it |
| Script | Command | Description |
|---|---|---|
test |
npm test |
Runs all tests using Jest |
test:watch |
npm run test:watch |
Runs tests in watch mode (re-runs on file changes) |
test:coverage |
npm run test:coverage |
Runs tests and generates a coverage report |
test:unit |
npm run test:unit |
Runs only unit tests (tests/unit directory) |
test:api |
npm run test:api |
Runs only API integration tests (tests/api directory) |
| Script | Command | Description |
|---|---|---|
lint |
npm run lint |
Runs ESLint on the src directory |
lint:fix |
npm run lint:fix |
Runs ESLint and automatically fixes fixable issues |
format |
npm run format |
Formats code using Prettier |
format:check |
npm run format:check |
Checks if code is properly formatted |
type-check |
npm run type-check |
Runs TypeScript type checking without emitting files |
- React 19 - UI library
- Redux Toolkit - State management
- TypeScript - Type safety
- Webpack 5 - Module bundler
- Axios - HTTP client
- Node.js - Runtime
- Express 5 - Web framework
- PostgreSQL - Database
- JWT - Authentication (HttpOnly cookies)
- bcryptjs - Password hashing
- Joi - Schema validation
- express-rate-limit - API rate limiting
- morgan - HTTP request logging
- Jest - Test framework
- Supertest - HTTP assertions
- ts-jest - TypeScript support
- ethers.js - Ethereum wallet operations
- bitcoinjs-lib - Bitcoin wallet operations
- bip39 - Mnemonic generation
- bip32 - HD wallet derivation
crypto-wallet-mvp/
βββ api/ # Vercel Serverless Functions
β βββ _lib/ # Shared utilities (auth, db, rate-limit)
β βββ auth/ # Authentication endpoints
β βββ wallets/ # Wallet endpoints
β βββ transactions/ # Transaction endpoints
β βββ prices/ # Price endpoints
β βββ health.js # Health check
β
βββ src/
β βββ client/ # Frontend React application
β β βββ components/ # React components
β β β βββ ui/ # Reusable UI (Button, Card, Modal, Toast, etc.)
β β β βββ ErrorBoundary.tsx
β β β βββ ...
β β βββ context/ # React context providers
β β βββ redux/ # Redux store & slices
β β βββ hooks/ # Custom React hooks
β β βββ services/ # API services
β β βββ utils/ # Client utilities
β β βββ locales/ # Localization strings
β β βββ index.tsx # App entry point
β β
β βββ common/ # Shared code
β β βββ types/ # TypeScript interfaces
β β βββ constants/ # Shared constants
β β
β βββ config/ # Configuration files
β β βββ environments/ # Environment-specific configs
β β βββ .env.example # Environment template
β β βββ jest.config.js # Jest configuration
β β βββ webpack.config.js # Webpack configuration
β β βββ migrate.config.js # Migration configuration
β β
β βββ server/ # Backend Express API (local dev)
β βββ controllers/ # Route handlers
β βββ middleware/ # Auth, validation, rate limiting
β βββ schemas/ # Joi validation schemas
β βββ services/ # Business logic
β βββ utils/ # Server utilities
β βββ queries/ # SQL queries
β βββ scripts/ # Database scripts
β βββ locales/ # Server-side strings
β βββ config/ # Server config
β βββ index.js # Server entry point
β
βββ tests/ # Test suite
β βββ api/ # API integration tests
β βββ unit/ # Unit tests
β βββ mocks/ # Test mocks
β βββ setup.js # Test configuration
β βββ helpers.js # Test utilities
βββ migrations/ # Database migrations
βββ docs/ # Documentation
βββ public/ # Static assets
- users - User accounts with authentication
- wallets - User wallets with encrypted mnemonics
- wallet_addresses - Multi-currency addresses per wallet
- transactions - Transaction history
- price_cache - Cryptocurrency price data
- β Password Hashing: bcrypt with salt rounds
- β HttpOnly Cookies: JWT stored in secure HttpOnly cookies (not localStorage)
- β Rate Limiting: Upstash Redis-based rate limiting (5 req/min auth, 30 req/min API)
- β Input Validation: Joi schemas for all API endpoints + client-side validation
- β SQL Injection Prevention: Parameterized queries throughout
- β Environment Variables: Sensitive data in .env (JWT_SECRET required)
- β Error Boundaries: Graceful error handling without exposing internals
- β CORS Configuration: Proper cross-origin resource sharing setup
- β Security Headers: X-Frame-Options, X-Content-Type-Options via Vercel
- Add 2FA authentication
- Use hardware security modules for key storage
- Implement proper key encryption at rest
- Add request logging and monitoring
The application is deployed on:
# Create account at https://neon.tech
# Create a new project
# Copy the connection string from dashboard# Install Vercel CLI
npm i -g vercel
# Deploy
vercel
# Set environment variables in Vercel dashboard:
# - DATABASE_URL (from Neon)
# - JWT_SECRET (generate secure key)
# - UPSTASH_REDIS_REST_URL (optional, for rate limiting)
# - UPSTASH_REDIS_REST_TOKEN (optional, for rate limiting)# Create account at https://upstash.com
# Create a Redis database
# Add UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN to Vercel| Variable | Required | Description |
|---|---|---|
DATABASE_URL |
Yes | Neon PostgreSQL connection string |
JWT_SECRET |
Yes | Secret key for JWT signing |
UPSTASH_REDIS_REST_URL |
No | Upstash Redis URL for rate limiting |
UPSTASH_REDIS_REST_TOKEN |
No | Upstash Redis token |
- β 78 Tests: Comprehensive test suite covering unit and API tests
- β API Tests: Wallet creation, transactions, authentication
- β Unit Tests: Calculations, crypto utilities, validation
- β Mock Database: Isolated testing without PostgreSQL dependency
- β Barrel Exports: Clean imports via index files
- β Localization: Centralized strings for easy i18n
- β Error Boundaries: React error handling with recovery
- β Toast System: Context-based notification system
- β Form Validation: Reusable validation hook
- β Database Migrations: Version-controlled schema changes
- β Configuration: Centralized constants and config
- β API Responses: Reusable error/success handlers
- β Storage Service: Centralized localStorage operations
- β Calculations: Safe number parsing and asset value calculations
- β Business Logic: Extracted swap service from controllers
- π Reduced code duplication
- π¦ Better separation of concerns
- π§ͺ Fully testable codebase
- π‘οΈ Safer number handling (prevents NaN errors)
- π Consistent patterns across codebase
- π Ready for internationalization
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run with coverage report
npm run test:coverage
# Run only unit tests
npm run test:unit
# Run only API tests
npm run test:apiContributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Run tests to ensure everything works (
npm test) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
After running npm run setup:db, use these credentials:
- Email: admin@test.com
- Password: admin123
Sample Data Includes:
- 2 wallets (Main Wallet & Trading Wallet)
- Multiple cryptocurrencies with balances
- Sample transaction history
- Live price data for 10 tokens
MIT License - This is a demonstration project for educational purposes.