Skip to content

aditya241104/Mock-SMS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“± MockSMS – Fake SMS Testing Platform for Developers

MockSMS is a full-stack developer tool that simulates SMS delivery β€” just like Mailhog or Mailtrap do for emails. No real SMS APIs are used β€” all messages are stored and displayed in a developer dashboard, with support for sending OTPs and verifying them.

🚫 No actual SMS is sent. Use it for development & testing environments.


πŸ”— Live Demo

πŸ‘‰ Open MockSMS Dashboard

⚠️ Hosted on free Render + Vercel tiers. May take a few seconds to wake up on first request.


πŸš€ Quick Walkthrough

  1. Visit the Live Dashboard
  2. Create an account and log in
  3. A default project will be created automatically
  4. Go to "Projects β†’ API Keys" to view your API key
  5. Use that API key to call the public APIs from your apps (see below)
  6. View all messages (SMS + OTPs) in your dashboard for each project

βš™οΈ Features

  • βœ… Simulated SMS inbox per project
  • βœ… JWT-based auth with refresh + access token
  • βœ… REST APIs for sending generic SMS, OTP, and verifying OTP
  • βœ… Messages auto-expire after 24 hours
  • βœ… Manual delete support
  • βœ… Modern developer UI with project & key management

πŸ§ͺ Public API Usage Guide

Use your API key in headers to test SMS flows from your own apps.

πŸ“ Base URL:

https://mock-sms-backend.onrender.com/api

1️⃣ Send Generic SMS

POST /message/send

Headers:

x-api-key: your_project_api_key
Content-Type: application/json

Body:

{
  "from": "sender_phone_number",
  "to": "recipient_phone_number",
  "body": "Message content here",
  "metadata": {
    "custom": "optional fields"
  }
}

2️⃣ Send OTP

POST /message/send-otp

Headers:

x-api-key: your_project_api_key
Content-Type: application/json

Body:

{
  "phone": "recipient_phone_number",
  "purpose": "login_verification" // optional
}

πŸ’¬ The OTP will be saved as a message in your MockSMS inbox.


3️⃣ Verify OTP

POST /message/verify-otp

Headers:

x-api-key: your_project_api_key
Content-Type: application/json

Body:

{
  "phone": "recipient_phone_number",
  "code": "812704"
}

🧾 Authentication (For Dashboard Routes)

  • User login gives access token (used for API calls) and refresh token (stored in httpOnly cookie).
  • APIs like /projects and /message/:id require login.
  • External SMS APIs use only the API key, no login required.

πŸ“‚ Folder Structure

mocksms/
β”œβ”€β”€ client/       # Vite + React frontend
└── server/       # Node.js + Express backend

πŸ› οΈ Installation Guide

πŸ“¦ Clone the Repo

git clone [https://github.com/your-username/mocksms.git](https://github.com/aditya241104/Mock-SMS/tree/main)
cd mocksms

πŸ–₯️ Frontend Setup (client)

cd client

🧩 Add .env:

VITE_BASE_URL=https://mock-sms-backend.onrender.com/api

πŸ“¦ Install Dependencies:

npm install

▢️ Start Dev Server:

npm run dev

πŸ”§ Backend Setup (server)

cd server

🧩 Add .env (only the variables):

PORT=
MONGO_URI=
JWT_ACCESS_SECRET=
JWT_REFRESH_SECRET=
JWT_ACCESS_EXPIRE=
JWT_REFRESH_EXPIRE=

πŸ“¦ Install Dependencies:

npm install

▢️ Start Server:

# Using nodemon
nodemon index.js

# Or plain node
node index.js

πŸ“š API Summary

Function Method Route Auth Required Notes
Register/Login POST /auth ❌ Auth via JWT
Get Projects GET /project βœ… Shows your projects
Create Project POST /project βœ… Creates project + API key
Delete Project DELETE /project/:id βœ… Deletes project & messages
Send Message POST /message/send ❌ (API key) External SMS API
Send OTP POST /message/send-otp ❌ (API key) External OTP API
Verify OTP POST /message/verify-otp ❌ (API key) External OTP verification
Delete Message DELETE /message/:id βœ… Manual deletion

πŸ—‘οΈ Message Expiry

  • ⏳ Auto-deleted after 24 hours
  • πŸ—‘οΈ Manual deletion supported from the dashboard

πŸ’‘ Future Ideas (V2)

  • Real-time updates via WebSocket
  • OTP attempt rate limiting
  • Project-based webhooks
  • OTP delivery simulation timeline
  • Multi-user collaboration per project

πŸ‘¨β€πŸ’» Built With

  • Frontend: React + Vite + TailwindCSS
  • Backend: Node.js + Express
  • DB: MongoDB (Mongoose)
  • Auth: JWT (access + refresh token)
  • Deployment: Render (backend) + Vercel (frontend)

About

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages