smstrap is a simple web application that simulates the sending and receiving of SMS messages. The backend is built with Go, while the frontend uses React.
- Exposes an API to send SMS messages
- Stores SMS messages in a file (no database required)
- Displays incoming SMS messages in a React-based web interface
- Clone the repository:
git clone https://github.com/aliharis/smstrap.git
cd smstrap
- Install frontend dependencies and build the frontend:
cd frontend
npm install
npm run build
cd ..
- Build the Go executable:
go build -o smstrap
- Run the Go server:
./smstrap
- Access the application at
http://localhost:8080
.
To test the SMS sending functionality, use a tool like curl
or Postman to send a POST request to the /sendSMS
endpoint:
curl -X POST -H "Content-Type: application/json" -d '{"phoneNumber": "1234567890", "body": "Hello, World!"}' http://localhost:8080/sendSMS
After sending an SMS, refresh the web interface, and you should see the new message appear in the list.
To build a bundled executable containing both the frontend and backend, run the provided build script:
This script will:
- Install the npm dependencies for the frontend
- Build the React frontend
- Copy the frontend build output to the
static
folder in the project root directory - Build the Go executable, embedding the frontend files
After running the script, you'll have an updated smstrap
executable that includes the latest frontend build.
To run the bundled executable, simply
./smstrap
This project is released under the MIT License.