A complete Telegram Mini App that allows users to buy cryptocurrency (BTC, ETH, USDC, STRK) with Nigerian Naira. Built with React, Express, and integrated with Starknet blockchain for secure token transactions.
- No Account Required: Anonymous crypto purchases with just wallet address
- Multiple Tokens: Support for BTC, ETH, USDC, and STRK tokens
- Real-time Rates: Live cryptocurrency rates from CoinGecko API
- Mobile-First: Optimized for Telegram's mobile interface
- Secure Payments: Integration with Flutterwave/Paystack payment gateways
- Blockchain Integration: Direct token transfers via Starknet
- Transaction History: Local storage of transaction records
- Multi-language: Responsive design with Telegram theme integration
- React 18 with TypeScript
- Tailwind CSS for styling
- Radix UI components with shadcn/ui
- TanStack Query for data fetching
- Wouter for routing
- Vite for build tooling
- Node.js with Express
- TypeScript for type safety
- Drizzle ORM with PostgreSQL
- Starknet.js for blockchain interactions
- Rate limiting and security middleware
- Starknet mainnet integration
- Token contracts for BTC, ETH, USDC, STRK
- Wallet validation and transaction monitoring
Before running this project locally, ensure you have:
- Node.js 20+ installed
- npm or yarn package manager
- PostgreSQL database (local or cloud)
- Git for version control
git clone <your-repo-url>
cd cryptoease-telegram-appnpm installCreate a .env file in the root directory:
cp .env.example .envEdit the .env file with your configuration:
# Database Configuration
DATABASE_URL=postgresql://username:password@localhost:5432/cryptoease
PGHOST=localhost
PGPORT=5432
PGDATABASE=cryptoease
PGUSER=postgres
PGPASSWORD=your_password
# Development Mode
NODE_ENV=development
PORT=5000
# Payment Gateway (Development Keys)
PAYMENT_PROVIDER=flutterwave
FLUTTERWAVE_PUBLIC_KEY=FLWPUBK_TEST-your-test-key
FLUTTERWAVE_SECRET_KEY=FLWSECK_TEST-your-test-key
# External APIs
COINGECKO_API_KEY=CG-demo-api-key
# Telegram (Optional for local development)
TELEGRAM_BOT_TOKEN=your-bot-token
TELEGRAM_BOT_USERNAME=your-bot-username# Install PostgreSQL (Ubuntu/Debian)
sudo apt update
sudo apt install postgresql postgresql-contrib
# Create database and user
sudo -u postgres createdb cryptoease
sudo -u postgres createuser cryptoease_user -P
sudo -u postgres psql
# In PostgreSQL shell:
GRANT ALL PRIVILEGES ON DATABASE cryptoease TO cryptoease_user;
\\q- Sign up for Neon or Supabase
- Create a new PostgreSQL database
- Copy the connection string to your
.envfile
# Push schema to database
npm run db:push# Start the full-stack application
npm run devThis will start:
- Backend API on
http://localhost:5000 - Frontend accessible through the same port
- Hot reload for both frontend and backend changes
Open your browser and navigate to:
http://localhost:5000
You should see the CryptoEase interface with:
- Token selection dropdown (BTC, ETH, USDC, STRK)
- Amount input field
- Wallet address input
- Real-time rate display
- Select a token (e.g., USDC)
- Enter amount (e.g., 50000 for β¦500)
- Enter any wallet address for testing
- Click "GET QUOTE" to see transaction summary
- Proceed through the mock payment flow
# Test rates endpoint
curl http://localhost:5000/api/rates
# Test quote endpoint
curl -X POST http://localhost:5000/api/quote \\
-H "Content-Type: application/json" \\
-d '{"tokenSymbol":"USDC","amountNgn":50000}'# Open Drizzle Studio to inspect data
npm run db:studioβββ frontend/ # Frontend React application
β βββ src/
β β βββ components/ # Reusable UI components
β β βββ pages/ # Application pages
β β βββ hooks/ # Custom React hooks
β β βββ lib/ # Utility functions
β β βββ index.css # Global styles
β βββ index.html
βββ backend/ # Backend Express application
β βββ db.ts # Database connection
β βββ storage.ts # Data access layer
β βββ routes.ts # API routes
β βββ payments.ts # Payment gateway integration
β βββ blockchain.ts # Starknet integration
β βββ middleware.ts # Security and validation
β βββ cache.ts # Caching system
β βββ vite.ts # Development server setup
β βββ index.ts # Server entry point
βββ contracts/ # Smart contract interfaces
β βββ README.md # Contract documentation
βββ shared/ # Shared types and schemas
β βββ schema.ts # Database schemas
βββ docs/ # Documentation
β βββ DEPLOYMENT_GUIDE.md
β βββ TELEGRAM_SETUP.md
β βββ LEGAL_COMPLIANCE.md
βββ client -> frontend # Symlink for compatibility
βββ server -> backend # Symlink for compatibility
βββ config files # Configuration files
# Development
npm run dev # Start development server
npm run db:push # Push schema changes to database
npm run db:studio # Open Drizzle Studio
# Building
npm run build # Build for production
npm run build:client # Build frontend only
npm run build:server # Build backend only
# Production
npm start # Start production server
# Database
npm run db:migrate # Run database migrations
npm run db:studio # Database management interface
# Utility
npm run check # Type checking
npm test # Run tests
npm run lint # Code linting- Connect your GitHub repository to Vercel
- Set environment variables in Vercel dashboard
- Deploy with automatic builds on push
- Connect repository to Railway
- Configure environment variables
- Deploy with automatic scaling
- Use Neon, Supabase, or AWS RDS for PostgreSQL
- Run
npm run db:pushto set up tables
Detailed deployment instructions are available in DEPLOYMENT_GUIDE.md.
- Rate Limiting: API endpoints protected against abuse
- Input Validation: All user inputs sanitized and validated
- Security Headers: Helmet.js for security headers
- Webhook Verification: Payment gateway webhook signatures verified
- Environment Isolation: Separate development and production configurations
To use as a Telegram Mini App:
- Create a Telegram bot via @BotFather
- Configure web app URL
- Set up webhooks for production
- Follow TELEGRAM_SETUP.md for detailed instructions
This application includes compliance features for Nigerian regulations:
- KYC/AML: Know Your Customer and Anti-Money Laundering checks
- Transaction Limits: Configurable limits based on user verification
- NDPR Compliance: Nigeria Data Protection Regulation compliance
- Audit Logging: Comprehensive transaction and activity logging
See LEGAL_COMPLIANCE.md for detailed information.
1. Database Connection Error
# Check if PostgreSQL is running
sudo systemctl status postgresql
# Test connection
psql -h localhost -U cryptoease_user -d cryptoease2. Port Already in Use
# Find process using port 5000
lsof -i :5000
# Kill the process
kill -9 <PID>3. Module Not Found Errors
# Clear node modules and reinstall
rm -rf node_modules package-lock.json
npm install4. TypeScript Errors
# Check TypeScript compilation
npm run check
# Clear TypeScript cache
npx tsc --build --clean- Use
npm run db:studioto inspect database tables - Check browser console for frontend errors
- Monitor server logs for backend issues
- Use environment variables for all configuration
- Test payment flows with test API keys first
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- π§ Email: support@cryptoease.com
- π¬ Telegram: @cryptoease_support
- π Issues: GitHub Issues
- Initial release
- Support for BTC, ETH, USDC, STRK tokens
- Flutterwave/Paystack payment integration
- Starknet blockchain integration
- Telegram Mini App functionality
- Nigerian Naira support
- Production-ready security features