Skip to content

Emmy123222/PaymentBridge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

PayBridge - Cross-Border Payment Gateway

A sophisticated, production-ready cross-border payment gateway that enables users to send and receive payments globally through multiple payment providers with AI-powered routing optimization.

๐Ÿš€ Features

Core Functionality

  • Multi-Platform Payment Integration: PayPal, Wise, Stripe, M-Pesa, and Payoneer support
  • AI-Powered Payment Routing: Automatically selects optimal payment routes based on cost, speed, and reliability
  • Real-Time Currency Conversion: Live exchange rates with transparent fee breakdown
  • Smart Fallback Logic: Automatic rerouting when primary payment methods fail
  • Offline Payment Queuing: Queue payments during network outages with automatic retry
  • Real-Time Notifications: SMS and email updates via Twilio integration

User Experience

  • Responsive Design: Optimized for mobile, tablet, and desktop
  • Interactive Dashboard: Transaction analytics with visual charts
  • Payment Tracking: Real-time status updates and delivery confirmations
  • Multi-Currency Support: 10+ major currencies with live conversion rates
  • Secure Authentication: JWT-based authentication with bcrypt password hashing

Technical Features

  • PostgreSQL Database: Robust data persistence with proper indexing
  • RESTful API: Well-structured endpoints with validation and error handling
  • Background Processing: Automated payment processing with cron jobs
  • Rate Limiting: API protection against abuse
  • Security Headers: Helmet.js for enhanced security
  • Input Validation: Comprehensive validation using express-validator

๐Ÿ›  Tech Stack

Frontend

  • React 18 with TypeScript
  • Tailwind CSS for styling
  • Framer Motion for animations
  • React Router for navigation
  • Axios for API communication
  • Recharts for data visualization
  • React Hook Form for form management
  • React Hot Toast for notifications

Backend

  • Node.js with Express.js
  • PostgreSQL database
  • JWT for authentication
  • bcryptjs for password hashing
  • Helmet for security headers
  • Express Rate Limit for API protection
  • Node Cron for scheduled tasks
  • Express Validator for input validation

External APIs

  • Stripe for card payments and bank transfers
  • PayPal for digital wallet transactions
  • Wise for international transfers
  • Currency Layer for exchange rates
  • Twilio for SMS notifications

๐Ÿ“‹ Prerequisites

  • Node.js (v16 or higher)
  • PostgreSQL (v12 or higher)
  • npm or yarn package manager

๐Ÿš€ Installation & Setup

1. Clone the Repository

git clone https://github.com/your-username/paybridge.git
cd paybridge

2. Install Dependencies

# Install frontend dependencies
npm install

# Install backend dependencies
npm run server:install

3. Database Setup

# Create PostgreSQL database
createdb paybridge

# The application will automatically create tables on first run

4. Environment Configuration

Create a .env file in the server directory:

# Database Configuration
DATABASE_URL=postgresql://username:password@localhost:5432/paybridge

# JWT Secret (generate a secure random string)
JWT_SECRET=your-super-secret-jwt-key-here

# Payment API Keys (use sandbox/test keys for development)
STRIPE_SECRET_KEY=sk_test_your_stripe_secret_key
STRIPE_PUBLISHABLE_KEY=pk_test_your_stripe_publishable_key

PAYPAL_CLIENT_ID=your_paypal_sandbox_client_id
PAYPAL_CLIENT_SECRET=your_paypal_sandbox_client_secret
PAYPAL_MODE=sandbox

# Currency Exchange API
CURRENCY_LAYER_API_KEY=your_currency_layer_api_key

# Twilio Configuration (for SMS notifications)
TWILIO_ACCOUNT_SID=your_twilio_account_sid
TWILIO_AUTH_TOKEN=your_twilio_auth_token
TWILIO_PHONE_NUMBER=your_twilio_phone_number

# Wise API (sandbox)
WISE_API_TOKEN=your_wise_sandbox_api_token
WISE_PROFILE_ID=your_wise_profile_id

# Server Configuration
PORT=5000
NODE_ENV=development

5. Start the Application

# Start both frontend and backend concurrently
npm run dev

# Or start them separately:
# Frontend (port 5173)
npm run dev:client

# Backend (port 5000)
npm run dev:server

๐Ÿ— Project Structure

paybridge/
โ”œโ”€โ”€ src/                          # Frontend React application
โ”‚   โ”œโ”€โ”€ components/               # Reusable UI components
โ”‚   โ”‚   โ”œโ”€โ”€ Layout.tsx           # Main layout wrapper
โ”‚   โ”‚   โ””โ”€โ”€ LoadingSpinner.tsx   # Loading indicator
โ”‚   โ”œโ”€โ”€ contexts/                # React contexts
โ”‚   โ”‚   โ””โ”€โ”€ AuthContext.tsx     # Authentication context
โ”‚   โ”œโ”€โ”€ pages/                   # Page components
โ”‚   โ”‚   โ”œโ”€โ”€ LandingPage.tsx     # Marketing landing page
โ”‚   โ”‚   โ”œโ”€โ”€ LoginPage.tsx       # User authentication
โ”‚   โ”‚   โ”œโ”€โ”€ RegisterPage.tsx    # User registration
โ”‚   โ”‚   โ”œโ”€โ”€ Dashboard.tsx       # Main user dashboard
โ”‚   โ”‚   โ”œโ”€โ”€ SendMoney.tsx       # Payment sending flow
โ”‚   โ”‚   โ”œโ”€โ”€ ReceiveMoney.tsx    # Payment receiving setup
โ”‚   โ”‚   โ”œโ”€โ”€ TransactionHistory.tsx # Transaction management
โ”‚   โ”‚   โ””โ”€โ”€ PaymentMethods.tsx  # Payment method management
โ”‚   โ””โ”€โ”€ App.tsx                 # Main application component
โ”œโ”€โ”€ server/                      # Backend Node.js application
โ”‚   โ”œโ”€โ”€ database/               # Database configuration
โ”‚   โ”‚   โ””โ”€โ”€ init.js            # Database initialization
โ”‚   โ”œโ”€โ”€ middleware/             # Express middleware
โ”‚   โ”‚   โ””โ”€โ”€ auth.js            # Authentication middleware
โ”‚   โ”œโ”€โ”€ routes/                 # API route handlers
โ”‚   โ”‚   โ”œโ”€โ”€ auth.js            # Authentication routes
โ”‚   โ”‚   โ”œโ”€โ”€ payments.js        # Payment processing routes
โ”‚   โ”‚   โ”œโ”€โ”€ users.js           # User management routes
โ”‚   โ”‚   โ””โ”€โ”€ exchange.js        # Currency exchange routes
โ”‚   โ”œโ”€โ”€ services/               # Business logic services
โ”‚   โ”‚   โ”œโ”€โ”€ paymentRouter.js   # AI-powered routing engine
โ”‚   โ”‚   โ”œโ”€โ”€ paymentProcessor.js # Payment processing logic
โ”‚   โ”‚   โ”œโ”€โ”€ paymentProviders.js # Payment provider integrations
โ”‚   โ”‚   โ””โ”€โ”€ notificationService.js # SMS/Email notifications
โ”‚   โ””โ”€โ”€ server.js              # Express server entry point
โ””โ”€โ”€ README.md                   # This file

๐Ÿ”ง API Endpoints

Authentication

  • POST /api/auth/register - User registration
  • POST /api/auth/login - User login

Payments

  • GET /api/payments/methods - Get user payment methods
  • POST /api/payments/methods - Add payment method
  • POST /api/payments/send - Send money
  • GET /api/payments/transactions - Get transaction history

Users

  • GET /api/users/profile - Get user profile
  • GET /api/users/analytics - Get user analytics

Exchange

  • GET /api/exchange/rates - Get exchange rates
  • GET /api/exchange/currencies - Get supported currencies

๐Ÿ” Security Features

  • JWT Authentication: Secure token-based authentication
  • Password Hashing: bcrypt with salt rounds for password security
  • Rate Limiting: Protection against brute force attacks
  • Input Validation: Comprehensive validation on all endpoints
  • CORS Configuration: Proper cross-origin resource sharing setup
  • Security Headers: Helmet.js for additional security headers
  • SQL Injection Protection: Parameterized queries with pg library

๐ŸŽจ Design System

Colors

  • Primary: Blue (#3B82F6) - Trust and reliability
  • Secondary: Purple (#8B5CF6) - Innovation and technology
  • Success: Green (#10B981) - Successful transactions
  • Warning: Yellow (#F59E0B) - Pending states
  • Error: Red (#EF4444) - Failed transactions

Typography

  • Headings: Inter font family, bold weights
  • Body: Inter font family, regular weight
  • Code: Monospace for transaction IDs and technical data

Spacing

  • Base Unit: 8px grid system
  • Component Padding: 16px, 24px, 32px
  • Section Margins: 32px, 48px, 64px

๐Ÿงช Testing

Manual Testing Checklist

  • User registration and login
  • Payment method addition
  • Money sending flow (all steps)
  • Transaction history viewing
  • Dashboard analytics
  • Responsive design on mobile/tablet
  • Error handling and validation

API Testing

Use tools like Postman or curl to test API endpoints:

# Register a new user
curl -X POST http://localhost:5000/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{"email":"test@example.com","password":"password123","firstName":"John","lastName":"Doe","country":"US","currency":"USD"}'

# Login
curl -X POST http://localhost:5000/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email":"test@example.com","password":"password123"}'

๐Ÿš€ Deployment

Frontend Deployment (Netlify/Vercel)

# Build the frontend
npm run build

# Deploy the dist/ folder to your hosting provider

Backend Deployment (Heroku/Railway/DigitalOcean)

# Set environment variables on your hosting platform
# Deploy the server/ directory

Database Deployment

  • Use managed PostgreSQL services like:
    • Heroku Postgres
    • Railway PostgreSQL
    • DigitalOcean Managed Databases
    • AWS RDS

๐Ÿ”ง Configuration

Payment Provider Setup

Stripe

  1. Create account at https://stripe.com
  2. Get API keys from Dashboard > Developers > API keys
  3. Add keys to .env file

PayPal

  1. Create developer account at https://developer.paypal.com
  2. Create sandbox application
  3. Get Client ID and Secret from app settings

Wise

  1. Create business account at https://wise.com
  2. Apply for API access
  3. Get API token and profile ID

Twilio

  1. Create account at https://twilio.com
  2. Get Account SID and Auth Token
  3. Purchase phone number for SMS

๐Ÿ“Š Monitoring & Analytics

Application Metrics

  • Transaction success rates
  • Payment processing times
  • User engagement metrics
  • Error rates and types

Database Monitoring

  • Query performance
  • Connection pool usage
  • Storage utilization

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Code Style

  • Use TypeScript for type safety
  • Follow ESLint configuration
  • Use Prettier for code formatting
  • Write descriptive commit messages

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ†˜ Support

For support and questions:

๐Ÿ”ฎ Roadmap

Phase 1 (Current)

  • Core payment functionality
  • Multi-provider integration
  • User dashboard
  • Transaction management

Phase 2 (Next)

  • Mobile app (React Native)
  • Advanced analytics
  • Multi-language support
  • Cryptocurrency support

Phase 3 (Future)

  • Business accounts
  • API for third-party integration
  • Advanced fraud detection
  • White-label solutions

Built with โค๏ธ by the PayBridge Team

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors