System Architecture
Looping Binary is built on a modern, scalable microservices architecture designed to handle high traffic and ensure reliability across all connected platforms.
Microservices Architecture
The system is divided into two main services: Authentication Service and Coin Service. Each service is independently deployable, scalable, and maintainable.
High-Level Overview
LMS • E-commerce • Tournaments • Community
Port 5000
Port 5001
Centralized data storage
Authentication Service
Handles all user authentication, authorization, and identity management operations.
Core Responsibilities
- User Registration: Create new user accounts with email verification
- Login & Authentication: JWT token generation and validation
- OAuth Integration: LoopingBinary OAuth ("Sign in with LoopingBinary")
- Password Management: Reset, change, and secure password storage (bcrypt)
- Email Verification: Send and verify email confirmation tokens
- Role-Based Access Control: USER, DEVELOPER, ADMIN, SUPERADMIN roles
- Session Management: Token expiration and refresh logic
Technology Stack
Key Endpoints
/api/auth/register/api/auth/login/api/auth/me/api/auth/google/api/auth/forgot-passwordCoin Service
Manages the entire digital currency system including wallets, transactions, and treasuries.
Core Responsibilities
- Wallet Management: Create and manage user coin wallets
- Coin Minting: Admin-controlled coin creation
- Coin Burning: Remove coins from circulation
- P2P Transfers: User-to-user coin transfers
- Treasury Operations: Manage four system treasuries
- Transaction History: Complete audit trail of all coin movements
- API Key Management: Generate and validate API keys
- Balance Tracking: Real-time wallet and treasury balances
Technology Stack
Key Endpoints
/api/coins/balance/api/coins/transfer/api/admin/mint/api/admin/burn/api/coins/historyDatabase Schema
PostgreSQL database with the following key tables:
Users Table
Stores all user account information
Wallets Table
User coin balances (1:1 with Users)
Transactions Table
Complete audit trail of all coin movements
Treasuries Table
Four system treasuries for fund management
ApiKeys Table
API key management for secure access
Security Features
Password Security
- bcrypt hashing (12 rounds)
- Salt per password
- No plaintext storage
Token Security
- JWT with RS256
- 7-day expiration
- Secure secret keys
API Keys
- SHA-256 encryption
- Permission-based access
- Usage tracking
Database Security
- Prepared statements
- SQL injection prevention
- Transaction rollback
Scalability & Performance
Horizontal Scaling
Both services can be horizontally scaled by deploying multiple instances behind a load balancer.
- Stateless service design
- Database connection pooling
- Load balancer distribution
Database Optimization
- Indexed primary and foreign keys
- Query optimization with Prisma
- Connection pooling (max 10 connections per service)
- Transaction batching for bulk operations
Caching Strategy
- JWT tokens cached client-side
- User profile caching (future enhancement)
- Balance queries optimized
Deployment Architecture
Inter-Service Communication
Services communicate via RESTful HTTP APIs. Future enhancements may include:
- Message queues (RabbitMQ/Redis) for async operations
- Event-driven architecture for real-time updates
- Service mesh for advanced routing and observability