| Crates.io | tiny_twilio_stripe |
| lib.rs | tiny_twilio_stripe |
| version | 0.1.1 |
| created_at | 2025-04-09 09:38:15.422827+00 |
| updated_at | 2025-04-09 09:42:09.703552+00 |
| description | A simple Actix-Web server providing Twilio Video access tokens and optional Stripe Checkout sessions. |
| homepage | https://github.com/holg/tiny_twilio_stripe |
| repository | https://github.com/holg/tiny_twilio_stripe |
| max_upload_size | |
| id | 1626474 |
| size | 91,717 |
This is a lightweight, production-ready Rust-based Actix Web server that:
.env for configuration and supports feature flags for flexible
builds./api/generate-token)/api/create-checkout-session).envClone this repo
Create .env file:
SERVER_PORT=8888
USE_STRIPE=false
GOVERNOR_BURST=5
GOVERNOR_PER_SECOND=2
# 60*60s = 3,600s => 1h
TOKEN_EXPIRY=3600
# Twilio configuration
TWILIO_ACCOUNT_SID=ACxxx...
TWILIO_API_KEY_SID=SKxxx...
TWILIO_API_KEY_SECRET=your_secret
# Stripe (optional)
USE_STRIPE=true
STRIPE_SECRET_KEY=sk_test_xxx
STRIPE_CURRENCY=EUR
STRIPE_AMOUNT=1000
STRIPE_PRODUCT_NAME=Private Video Session
STRIPE_SUCCESS_URL=https://yourdomain.com/success
STRIPE_CANCEL_URL=https://yourdomain.com/cancel
cargo run
cargo run --features stripe
optional pass the .env file e.g. .env.productioncargo run --features stripe optional pass the .env file e.g. .env.production
Generates a Twilio JWT token for the given identity and room.
Query Parameters: โข identity โ The user name โข roomName โ Room to join
Example: GET /api/generate-token?identity=alice&roomName=room1
POST /api/create-checkout-session (requires Stripe + USE_STRIPE=true)
Creates a Stripe Checkout session.
JSON Body:
{
"identity": "alice",
"room_name": "room1"
}
Returns:
{ "url": "https://checkout.stripe.com/session/..." }
You can test endpoints using Postman or curl:
curl "http://localhost:6666/api/generate-token?identity=test&roomName=myroom"
โข Tokens expire after 1 hour default, but configurable in seconds in .env TOKEN_EXPIRY โข Rate-limiting can be added via actix-governor
tiny_twilio_stripe/
โโโ src/
โ โโโ main.rs # Actix server entry point
โ โโโ twilio/
โ โ โโโ mod.rs
โ โ โโโ twilio_token.rs
โ โโโ stripe/
โ โโโ mod.rs
โ โโโ stripe_checkout.rs
โโโ .env
โโโ Cargo.toml
โโโ README.md