How saurabh-sde/otp-authentication-go works
Project type and purpose
• This is a Go-based backend microservices system combining two Connect RPC services—an Auth Service and an OTP Service—plus messaging and persistence layers.
• Purpose: Let clients sign up/login with phone numbers, generate and verify OTPs via Twilio, persist user data and events in PostgreSQL, and coordinate between services over RabbitMQ.
File structure
• Top-level files:
• main.go: entry point running both services (or one per configuration)
• go.mod/sum, buf.*.yaml: Go modules and Connect RPC code generation
• README.md: project overview and instructions
• Directories:
• auth, client: client stubs and helpers for calling services
• internal/proto + internal/gen: .proto definitions and generated Connect RPC code for auth_service and otp_service
• service: business-logic layers (auth.go, otp.go, twilio.go)
• messagingQueue: RabbitMQ publisher (“publish”) and consumer (“receive”) implementations
• model: ORM models (User, LogEvent)
• utility: helper functions
• query.sql: initial DB schema
Readme insights
• Two Connect RPC services: Auth Service (signup, verify, login, get profile) and OTP Service (generate OTP).
• Uses Beego ORM for PostgreSQL persistence.
• Uses RabbitMQ topics (“verification”) to publish “SendOTP” events.
• OTP Service listens on that topic and invokes Twilio’s Verify API.