A modern, privacy-first messaging and crypto wallet application built with end-to-end encryption, 2FA authentication, and integrated blockchain wallet support.
- End-to-End Encryption: All messages encrypted with libsodium before transmission
- Two-Factor Authentication (2FA): TOTP-based authentication with recovery codes
- Password Hashing: Argon2 for secure password storage
- JWT Authentication: Stateless session management with secure tokens
- Real-time messaging with WebSocket support
- Message reactions and threaded replies
- Read receipts
- Friend system with request management
- Message editing and deletion
- Integrated blockchain wallet (Base network support)
- USDC token transfers
- Transaction history
- Wallet import/creation
- Balance tracking
- Premium subscriptions with multiple tiers (Monthly, Yearly, Early Adopter)
- Custom usernames for premium members
- Premium badges and status
- Crypto payments via USDC (Base network)
- Flexible pricing configuration
- Modern React 19 frontend with TypeScript
- Vite build tool for fast development
- Tailwind CSS for responsive design
- Radix UI components for accessibility
- Dark mode support with next-themes
- Smooth animations with Framer Motion
- Runtime: Node.js 22+
- Framework: Fastify 5.0
- Database: PostgreSQL with Prisma ORM
- Security:
- Argon2 (password hashing)
- libsodium-wrappers (E2E encryption)
- JWT (authentication)
- Blockchain: ethers.js, viem (Base network)
- Additional: WebSocket support, CORS, 2FA with OTP
- Framework: React 19 + Vite 7
- UI Library: Radix UI + Tailwind CSS
- HTTP Client: Axios
- Routing: Wouter
- Form Management: React Hook Form + Zod validation
- Charts: Recharts
- Notifications: Sonner
Veil/
├── frontend/ # React + Vite frontend
│ ├── client/ # React components and pages
│ ├── server/ # Express server for production
│ ├── shared/ # Shared utilities and types
│ ├── public/ # Static assets
│ ├── package.json
│ └── vite.config.ts
├── backend/ # Fastify backend server
│ ├── src/
│ │ ├── index.ts # Server entry point
│ │ ├── routes/ # API endpoints
│ │ │ ├── auth.ts # Authentication endpoints
│ │ │ ├── chat.ts # Messaging endpoints
│ │ │ ├── user.ts # User management
│ │ │ ├── wallet.ts # Wallet operations
│ │ │ └── premium.ts # Premium/subscription handling
│ │ ├── services/ # Business logic
│ │ └── plugins/ # Fastify plugins
│ ├── prisma/
│ │ └── schema.prisma # Database schema
│ └── package.json
├── .env.example # Environment variables template
└── DEPLOYMENT_GUIDE.md # Detailed deployment instructions
- Node.js 18+ (22+ recommended)
- PostgreSQL 12+
- pnpm 10+
-
Clone the repository
git clone https://github.com/basetrackxyz/Veil.git cd Veil -
Install dependencies
# Backend cd backend pnpm install # Frontend (in new terminal) cd frontend pnpm install
-
Setup environment variables
# Copy .env.example and configure cp .env.example .envBackend
.envessentials:DATABASE_URL=postgresql://user:password@localhost:5432/veil PORT=4000 JWT_SECRET=generate-a-strong-secret-key CORS_ORIGIN=http://localhost:3000 ENCRYPTION_KEY=generate-a-strong-encryption-key
Frontend
.envessentials:VITE_API_URL=http://localhost:4000 VITE_APP_NAME=Veil VITE_APP_TITLE=Veil - Your Messages, Your Privacy
-
Setup database
cd backend npx prisma migrate deploy npx prisma generate -
Start development servers
# Terminal 1: Backend cd backend pnpm dev # Runs on http://localhost:4000 # Terminal 2: Frontend cd frontend pnpm dev # Runs on http://localhost:3000
POST /api/auth/register- Create accountPOST /api/auth/login- LoginPOST /api/auth/logout- LogoutPOST /api/auth/2fa/setup- Setup 2FAPOST /api/auth/2fa/verify- Verify 2FA code
GET /api/users/search?q=query- Search usersGET /api/users/:id- Get user profilePUT /api/users/:id- Update profile
GET /api/chat- Get chat listGET /api/chat/:chatId/messages- Get messages (encrypted)POST /api/chat/:chatId/messages- Send messagePUT /api/chat/messages/:messageId- Edit messageDELETE /api/chat/messages/:messageId- Delete message
POST /api/wallet/create- Create new walletPOST /api/wallet/import- Import existing walletGET /api/wallet/balance- Get wallet balance (USDC)POST /api/wallet/send- Send USDC to another userGET /api/wallet/transactions- Get transaction history
GET /api/premium/config- Get pricing configurationPOST /api/premium/subscribe- Start premium subscriptionGET /api/premium/status- Get premium statusPOST /api/premium/cancel- Cancel subscription
- User: User accounts with authentication and crypto wallet integration
- Session: Secure session tokens for authentication
- Message: Encrypted messages with E2E support
- Friend: Friend relationships between users
- FriendRequest: Pending friend requests
- PremiumSubscription: Subscription records with payment tracking
- PremiumConfig: Configuration for pricing and premium features
- ReservedUsername: Reserved usernames for system/admin use
✅ Encryption: End-to-end encryption using libsodium
✅ Authentication: JWT tokens with secure secrets
✅ Password Security: Argon2 hashing with configurable parameters
✅ 2FA: TOTP with recovery codes
✅ CORS: Configurable cross-origin policies
✅ Rate Limiting: API rate limiting (configurable)
✅ Input Validation: Zod schema validation on all inputs
✅ SQL Injection Prevention: Prisma ORM parameterized queries
-
Railway.app (Recommended for both frontend & backend)
- Connect GitHub repo
- Set environment variables
- Auto-deploys on push
- See DEPLOYMENT_GUIDE.md for details
-
Vercel (Frontend only)
cd frontend npm i -g vercel vercel -
Docker (Self-hosted)
- Dockerfiles provided in DEPLOYMENT_GUIDE.md
- Docker Compose for local deployment
See DEPLOYMENT_GUIDE.md for:
- Database setup (Neon PostgreSQL)
- Environment variables
- Security checklist
- SSL/HTTPS configuration
- Monitoring and logging
- Caching: Browser caching for static assets
- Compression: gzip compression on responses
- Database: Connection pooling with Prisma
- Frontend: Code splitting and lazy loading with Vite
- CDN Ready: Static assets optimized for CDN delivery
- Fastify built-in request logging
- Error tracking ready for Sentry integration
- Database query monitoring
- WebSocket connection tracking
- Premium subscription lifecycle logging
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
If you discover a security vulnerability, please email security@basetrack.xyz instead of using the issue tracker. All security vulnerabilities will be promptly addressed.
- Ensure backend is running on port 4000
- Check
VITE_API_URLmatches backend URL - Verify
CORS_ORIGINin backend.env
- Verify
DATABASE_URLformat - Check PostgreSQL is running
- Ensure database exists and user has permissions
# Clear and reinstall
rm -rf node_modules pnpm-lock.yaml
pnpm install
# Regenerate Prisma client
npx prisma generateMIT License — see LICENSE file for details
- 📚 Check DEPLOYMENT_GUIDE.md for detailed setup
- 🐛 Open an issue on GitHub
- 💬 Join our community discussions
- 📧 Contact the development team
Veil — Your Messages, Your Privacy. Built with security and user privacy as first-class concerns.