OTP System Architecture
Overview
The OTP System consists of several interconnected components that work together to provide a complete solution for sending one-time passwords.
Architecture Diagram
Component Details
User Web Interface
The user-facing website built with Next.js where users can register, login, manage API keys, send OTPs, and view their history.
Next.js Frontend
The React-based frontend that provides a responsive user interface with multi-language support.
Next.js API Routes
Serverless functions that handle API requests for sending OTPs, user authentication, and other backend operations.
WebSocket Server
A Node.js WebSocket server that enables real-time communication between the web application and Android app for instant OTP delivery.
Database
(To be implemented) Storage for user accounts, API keys, OTP history, and other application data.
SMS Gateway
External service for sending SMS messages to Turkmenistan phone numbers.
Android App
Mobile application that connects to the WebSocket server to receive OTP requests and send SMS messages directly from the device.
Data Flow
- User registers and logs into the web interface
- User creates API keys for their projects
- User sends OTP requests either through the web interface or API
- API validates the request and sends it to the WebSocket server
- WebSocket server broadcasts the OTP request to connected Android devices
- Android app receives the request and sends the SMS using device capabilities
- Delivery status is reported back through the WebSocket connection