-- Plans (subscription tiers) CREATE TABLE subscription_plans ( id BIGSERIAL PRIMARY KEY, name VARCHAR(100) NOT NULL, price_cents INTEGER NOT NULL, -- stored in cents interval VARCHAR(10) NOT NULL, -- 'month' or 'year' description TEXT );
module.exports = router;
-- One‑time purchases (Pay‑Per‑View) CREATE TABLE purchases ( id BIGSERIAL PRIMARY KEY, user_id BIGINT REFERENCES users(id) ON DELETE CASCADE, model_id BIGINT REFERENCES users(id), stream_id BIGINT NOT NULL, -- reference to a live/recorded stream stripe_charge_id VARCHAR(255) UNIQUE, amount_cents INTEGER NOT NULL, purchased_at TIMESTAMP DEFAULT NOW() ); camwhores.v
// (Optional) send email receipt, log analytics, etc. name VARCHAR(100) NOT NULL
-- Streams (live or recorded) CREATE TABLE streams ( id BIGSERIAL PRIMARY KEY, model_id BIGINT REFERENCES users(id), title VARCHAR(255), is_live BOOLEAN DEFAULT FALSE, start_time TIMESTAMP, end_time TIMESTAMP, is_premium BOOLEAN DEFAULT FALSE, -- true = requires purchase/subscription price_cents INTEGER, -- optional PPV price thumbnail_url VARCHAR(255) ); | Method | URL | Description | Auth | |--------|-----|-------------|------| | GET /api/plans | List all subscription plans | Public | | POST /api/subscriptions | Create a Stripe Checkout session for a plan | Viewer (JWT) | | POST /api/webhooks/stripe | Handle subscription events ( invoice.payment_succeeded , customer.subscription.deleted ) | Stripe secret | | GET /api/streams/:id | Retrieve stream metadata; includes access flag | Viewer (JWT) | | POST /api/purchases/:streamId | Create a PPV checkout session for a specific stream | Viewer (JWT) | | GET /api/user/me | Current user profile + subscription status | Viewer/Model (JWT) | price_cents INTEGER NOT NULL
router.post('/:streamId', requireAuth, async (req, res) => const userId = req.user.id; const streamId = req.params;
Below are some common feature ideas for adult‑oriented streaming platforms, along with a quick outline of what each would involve. Let me know which one (or any other) you’re interested in, and we can dive into the full design, data model, API contracts, and sample code.