- Node.js 18+
- PostgreSQL
- Telegram Bot Token (from BotFather)
- Plaid API credentials
- dotenvx installed globally or via npm
git clone https://github.com/johnconstant99-dev/telegram-plaid-bot.git
cd telegram-plaid-botnpm installFor Local Development:
cp .env.example .env
# Edit .env with your development values
nano .envFor Production/Staging:
# Generate encryption keys
npm run env:keygen
# Create encrypted production environment
dotenvx set TELEGRAM_BOT_TOKEN "your_token" -f .env.production
dotenvx set PLAID_CLIENT_ID "your_client_id" -f .env.production
dotenvx set PLAID_SECRET "your_secret" -f .env.production
dotenvx set DATABASE_URL "postgresql://user:pass@host:5432/db" -f .env.production
# Store keys in .env.keys (NEVER commit)npm run init-dbnpm run devServer runs on http://localhost:3000
npm run devDOTENV_PRIVATE_KEY_PRODUCTION="your_key" npm run env:run npm start| Variable | Description | Required |
|---|---|---|
TELEGRAM_BOT_TOKEN |
Telegram bot authentication token | ✅ |
PLAID_CLIENT_ID |
Plaid API client ID | ✅ |
PLAID_SECRET |
Plaid API secret | ✅ |
PLAID_ENV |
Plaid environment (sandbox/production) | ✅ |
DATABASE_URL |
PostgreSQL connection string | ✅ |
NODE_ENV |
Environment (development/production) | ✅ |
PORT |
Server port (default: 3000) | ❌ |
STRIPE_SECRET_KEY |
Stripe API key (if using payments) | ❌ |
src/
├── index.js # Entry point
├── bot/ # Telegram bot implementation
├── api/ # Express REST API
├── services/ # Business logic
├── models/ # Database models
├── database/ # DB setup
├── config/ # Configuration
└── utils/ # Utilities
npm start # Start production server
npm run dev # Start with auto-reload
npm run init-db # Initialize database
npm run env:keygen # Generate encryption keys
npm run env:set # Set encrypted variables
npm run env:list # List environment variables
npm run env:run # Run commands with decrypted vars- Environment Setup - Detailed encryption setup
- Copilot Instructions - Development guidelines
- Check
TELEGRAM_BOT_TOKENis correct - Verify bot is running:
npm run dev - Check logs:
tail logs/app.log
- Verify PostgreSQL is running
- Check
DATABASE_URLformat - Run
npm run init-dbto initialize schema
- Verify
PLAID_CLIENT_IDandPLAID_SECRETare correct - Check if using sandbox vs production environment
- Review Plaid API error codes in logs
For issues, check the GitHub Issues