- This is an OTP (One Time Password) service built using Spring Boot.
- It leverages Twilio for sending OTPs via SMS and Redis for storing OTPs with an expiration time.
- This service is designed to be simple, and easy to configure.
- Twilio Integration: Send OTPs via SMS to users.
- Redis Cache: Securely store OTPs with a predefined expiration time.
- Swagger UI: Interactive API documentation for easy testing and interaction.
- The following video demonstrates how to interact with the application:
- Left window: Using Swagger UI to send and verify OTP.
- Right window: PhoneLink app to show recieved OTP on phone.
Demo.mp4
- Java 21.0.3: Required to build and run the Spring Boot applications.
- Apache Maven 3.9.8: Used for dependency management and building the project.
- Spring Boot 3.3.1: Framework for building the Kafka producer and consumer demos.
- Redis Account (along with a created database).
- Twilio Account (along with your verified number).
-
Clone the repository:
git clone https://github.com/ittovate/otp-service.git
-
Navigate to the project directory:
cd demo-otp-service
-
Configure environment variables:
- Duplicate
src/main/resources/keys.env
file and rename the copy to.env
. - Fill fields with values from your Twilio account and Redis account:
TWILIO_API_KEY
is "Accound SID" under "Account Info" section in https://console.twilio.com/.TWILIO_API_TOKEN
is "Auth Token" under "Account Info" section in https://console.twilio.com/.TWILIO_SENDER_NUMBER
is "My Twilio phone number" under "Account Info" section in https://console.twilio.com/.TWILIO_VERIFIED_NUMBER
is your verified number used in your Twilio account.REDIS_HOST
&REDIS_PORT
are "Public endpoint" under "General" section (in the database settings).REDIS_PASSWORD
is under "Security" section (in the database settings).
- Duplicate
-
Build and run the project:
mvn clean install spring-boot:run
-
Stop the project: After testing, stop demo by pressing
CTRL + C
in terminal.