File size: 2,698 Bytes
83a59ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
---
title: httpSMS Bulk Android Gateway
emoji: 📱
colorFrom: blue
colorTo: indigo
sdk: docker
app_port: 7860
pinned: false
---

[![Built with ML Intern](https://huggingface.co/datasets/huggingface/badges/resolve/main/built-with-ml-intern-sm.svg)](https://hf.co/chat?mode=ml-intern)

# httpSMS Gateway — self-hosted on Hugging Face Spaces

Production-hardened, single-origin deployment of the open-source [httpSMS](https://github.com/NdoleStudio/httpsms) Android SMS gateway: Go Fiber REST API + Nuxt 3 web dashboard behind a non-root nginx reverse proxy on a Hugging Face Docker Space.

- **Live dashboard:** https://red-kit-httpsms-gateway.hf.space
- **REST API base URL:** https://red-kit-httpsms-gateway.hf.space/v1
- **Android APK (direct download):** https://red-kit-httpsms-gateway.hf.space/HttpSms.apk

## Bootstrap mode

If the `DATABASE_URL` / `REDIS_URL` Space secrets are **not** set, `entrypoint.sh` starts ephemeral in-container PostgreSQL and Redis so the gateway is live out of the box. Data resets on restart. Set the two secrets to switch to a managed database (Neon/Supabase/Upstash) — no rebuild needed.

## Architecture

- nginx (uid 1000, non-root) listens on `:7860`, proxies `/v1/*` and heartbeat/health routes to the Go Fiber API on `127.0.0.1:8000`, and serves the static Nuxt SPA plus the APK.
- State lives in external managed PostgreSQL and Redis (injected as Space secrets, never committed).
- `entrypoint.sh` starts the API for GORM auto-migration, idempotently seeds the internal CloudEvents queue system user (`ON CONFLICT DO UPDATE`), then supervises the API and runs nginx.
- WebSocket/SSE upgrade headers, `X-Real-IP`, `X-Forwarded-For`, `X-Forwarded-Proto: https` are set by nginx on API routes.

## Quick start — REST API

Get your API key from the web dashboard after login, then:

```bash
export HTTPSMS_API_KEY="<your api key from the dashboard>"

# Send a single SMS
curl -X POST https://red-kit-httpsms-gateway.hf.space/v1/messages/send \
  -H "X-API-Key: ${HTTPSMS_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{"from": "+18005550199", "to": "+18005550100", "content": "Hello from httpSMS"}'

# Bulk-send to many recipients
curl -X POST https://red-kit-httpsms-gateway.hf.space/v1/messages/bulk-send \
  -H "X-API-Key: ${HTTPSMS_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{"from": "+18005550199", "to": ["+18005550100", "+18005550101"], "content": "Hello from httpSMS"}'
```

Messages are delivered through the connected Android phone running the httpSMS app (install the APK above; its default server URL points at this Space).

Upstream source: https://github.com/NdoleStudio/httpsms · Docs: https://docs.httpsms.com