A decentralized debit card platform built on Polkadot EVM, featuring smart contract vaults, Lithic card processing, and seamless crypto-to-fiat transactions.
- Frontend: React + TypeScript + Vite + Tailwind CSS + RainbowKit + Wagmi
- Backend: Node.js + Express + TypeScript + Supabase + Lithic API
- Smart Contracts: Solidity + Foundry (Vault for token management)
- Database: Supabase (PostgreSQL)
- Card Processing: Lithic (sandbox for testing)
- Node.js 18+
- Foundry (for smart contracts)
- Supabase account
- Lithic sandbox account
- Clone and install dependencies:
git clone <repository-url>
cd polkapay
npm run install:all-
Set up Supabase:
- Create a new project at supabase.com
- Get your project URL and anon key
- Run the SQL setup in
backend/README.md
-
Set up Lithic:
- Create a sandbox account at lithic.com
- Get your API key
-
Configure environment variables:
- Copy
backend/.env.exampletobackend/.env - Fill in your Supabase and Lithic credentials
- The frontend
.envis already configured
- Copy
-
Deploy smart contracts:
cd contracts
forge install
forge build
# Deploy to testnet (update RPC in foundry.toml)
forge script script/DeployVault.s.sol --rpc-url <your-rpc> --broadcast- Start development servers:
# Option 1: Basic concurrent run (no auto-restart)
npm run dev
# Option 2: Auto-restart on file changes (recommended)
npm run dev:watchThe dev:watch command will automatically restart frontend/backend when you save files in either frontend/src/ or backend/src/.
polkapay/
├── frontend/ # React frontend
│ ├── src/
│ │ ├── components/ # UI components
│ │ ├── pages/ # Route pages
│ │ └── hooks/ # Custom hooks
│ └── .env # Frontend env vars
├── backend/ # Express backend
│ ├── src/
│ │ ├── routes/ # API routes
│ │ └── services/ # External integrations
│ └── .env # Backend env vars
├── contracts/ # Foundry smart contracts
│ ├── src/ # Contract source
│ └── script/ # Deployment scripts
└── package.json # Root scripts
- Connect Wallet: User connects their wallet via RainbowKit
- Create Card: User provides name to create virtual debit card via Lithic
- Get Test Tokens: User claims mock USDC from faucet
- Deposit to Vault: Tokens are deposited into the smart contract vault
- Make Transactions: Simulate card transactions via Lithic sandbox
- View Balance: Real-time balance updates from vault contract
- Transfer: Transfer stablecoins to other address in Vault contract
- Withdraw: Withdraw stablecoins from Vault smart contract
cd frontend
npm run devcd backend
npm run devcd contracts
forge test
forge buildPOST /api/cards/create- Create new cardGET /api/cards/:walletAddress- Get card infoGET /api/cards/:walletAddress/reveal- Reveal Card Details
POST /api/transactions/simulate- Simulate transactionGET /api/transactions/:walletAddress- Get transaction history
GET /api/users/:walletAddress/balance- Get vault balance
CREATE TABLE users (
id SERIAL PRIMARY KEY,
wallet_address VARCHAR(42) UNIQUE NOT NULL,
name VARCHAR(255) NOT NULL,
lithic_card_token VARCHAR(255) UNIQUE,
card_last_four VARCHAR(4),
card_pan VARCHAR(32),
card_cvv VARCHAR(4),
card_exp_month VARCHAR(2),
card_exp_year VARCHAR(4),
cardholder_name VARCHAR(255),
card_status VARCHAR(50) DEFAULT 'active',
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);SUPABASE_URL=your_supabase_url
SUPABASE_ANON_KEY=your_supabase_key
LITHIC_API_KEY=your_lithic_key
VAULT_CONTRACT_ADDRESS=deployed_vault_address
USDC_CONTRACT_ADDRESS=usdc_address
RPC_URL=testnet_rpc_url
VITE_API_URL=http://localhost:3001
VITE_WALLETCONNECT_PROJECT_ID=your_walletconnect_id
cd backend
npm run build
npm startcd frontend
npm run build
# Deploy dist/ to your hosting servicecd contracts
forge script script/DeployVault.s.sol --rpc-url <mainnet-rpc> --broadcast --verifycd frontend
npm testcd contracts
forge testMIT License - see LICENSE file for details.