Build a Mini SMS Platform: Architecture, Code Walkthrough, and Deployment
This article introduces a lightweight, open‑source SMS platform built with SpringBoot and Vue, explains its server‑side architecture, provides step‑by‑step deployment instructions, and demonstrates how to send templated messages using a simple Java SDK.
1 Purpose
After three months of development, a mini version of an SMS platform service ( platform-sms) was open‑sourced as a Beta release. The project aims to help junior engineers quickly grasp architecture design and improve their technical awareness.
In 2018, the author participated in a large‑scale SMS platform refactor where multiple teams used disparate client‑side SDKs (Alibaba Cloud, Yimei, Lucheng, and an internal SMS4J style SDK). The client‑side approach caused high maintenance costs and limited advanced features such as fallback channels, leading to the recommendation of a server‑side mode.
2 Architecture
The platform is deliberately simple to serve as a learning project. It is implemented as a monolithic SpringBoot application that can be split into independent services if needed.
Frontend (admin‑ui) : a Vue project providing a console for managing applications, channels, SMS messages, and templates.
Backend (admin‑web) : divided into five layers – request controller, business service, command handler, third‑party channel adapters, and data access.
3 Demo
3.1 Environment Setup
Create the database tech_platform and execute the SQL script doc/sql/tech_platform.sql.
Download the release package platform-sms-admin.tar.gz, extract it, and edit conf/application.yml to configure the service.
Start the service:
bin/startup.sh3.2 Operation Flow
1. Login : Access http://localhost:8089 and log in with the default credentials admin/admin1984.
2. Create Application : Provide an application name, appKey, appSecret, and remarks.
3. Add Third‑Party Channel : Configure channel credentials (e.g., Alibaba Cloud, Tencent Cloud). Note: Tencent Cloud requires an appId stored as an attachment attribute.
4. Create Template : In the template management module, click “New Template”, ensure the signature name matches the channel’s signature, and bind the template to the chosen channel.
3.3 Send SMS
Add the Maven dependency:
<dependency>
<groupId>com.courage</groupId>
<artifactId>platform-sms-client</artifactId>
<version>${parent.version}</version>
</dependency>Configure application.yml with the server URL, appKey, and appSecret:
sms:
smsServerUrl: http://localhost:8089
appKey: qQjEiFzn80v8VM4h
appSecret: 9c465ece754bd26a9be77f3d0e2606bdDefine a Spring bean to create the SmsSenderClient:
@Configuration
public class SmsConfiguration {
@Value("${sms.smsServerUrl}")
private String smsServerUrl;
@Value("${sms.appKey}")
private String appKey;
@Value("${sms.appSecret}")
private String appSecret;
@Bean
public SmsSenderClient createClient() {
SmsConfig smsConfig = new SmsConfig();
smsConfig.setAppKey(appKey);
smsConfig.setSmsServerUrl(smsServerUrl);
smsConfig.setAppSecret(appSecret);
return new SmsSenderClient(smsConfig);
}
}Use the client to send a templated SMS:
@Autowired
private SmsSenderClient smsSenderClient;
@GetMapping("/test")
public String test() {
String mobile = "15011319235";
String templateId = "555829270636703745";
Map<String, String> param = new HashMap<>();
param.put("code", "1234");
param.put("time", "10");
SmsSenderResult senderResult = smsSenderClient.sendSmsByTemplateId(mobile, templateId, param);
System.out.println("senderResult:" + JSON.toJSONString(senderResult));
return "hello, first short message!";
}After invoking the endpoint, the recipient receives the SMS as shown below.
4 Open Source
The complete source code is available at:
https://github.com/makemyownlife/platform-sms
By studying this project, readers can learn how to design a lightweight client SDK, understand the SPI mechanism and adapter pattern, and configure an appropriate thread model for a production‑grade SMS service.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
macrozheng
Dedicated to Java tech sharing and dissecting top open-source projects. Topics include Spring Boot, Spring Cloud, Docker, Kubernetes and more. Author’s GitHub project “mall” has 50K+ stars.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
