Subscription management platform for tracking, analyzing, and optimizing recurring payments. Built with Supabase Auth, Supabase Database, and Stripe integration.
Create a .env file in the root directory with the following variables:
SUPABASE_URL=your_supabase_project_url
SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key
STRIPE_SECRET_KEY=your_stripe_secret_key
STRIPE_WEBHOOK_SECRET=your_stripe_webhook_signing_secret
VITE_STRIPE_PREMIUM_PRICE_ID=price_1T3jhIJpTYwzr88x8pGboTSU
VITE_STRIPE_FAMILY_PRICE_ID=price_1T3jikJpTYwzr88xIxkKHkKu
STRIPE_CHECKOUT_SUCCESS_URL=https://your-domain.com/pricing?checkout=success
STRIPE_CHECKOUT_CANCEL_URL=https://your-domain.com/pricing?checkout=cancel
NODE_ENV=development # or production
Use .env.example as the template and do not commit .env to source control.
npm install
npm run dev
price_1T3jhIJpTYwzr88x8pGboTSUprice_1T3jikJpTYwzr88xIxkKHkKu.env filehttps://<your-domain>/api/stripe/webhookcheckout.session.completedinvoice.payment_succeededinvoice.payment_failedcustomer.subscription.updatedcustomer.subscription.deletedsupabase/functions/api.supabase/functions/stripe-webhook.STRIPE_CHECKOUT_SUCCESS_URL and STRIPE_CHECKOUT_CANCEL_URL are optionalAll endpoints require authentication via Bearer token in the Authorization header.
Creates a Stripe customer and subscription using the deployed Supabase Edge Function.
POST /api/subscribe
Headers:
Authorization: Bearer <supabase_jwt_token>
Content-Type: application/json
Body:
{
"paymentMethodId": "pm_1234567890",
"priceId": "price_1234567890"
}
Example curl:
curl -X POST http://localhost:5000/api/subscribe \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"paymentMethodId": "pm_1234567890", "priceId": "price_1234567890"}'
Retrieves the current user’s subscription information.
GET /api/subscription
Headers:
Authorization: Bearer <supabase_jwt_token>
Example curl:
curl -X GET http://localhost:5000/api/subscription \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
Cancels the current user’s subscription.
POST /api/subscription/cancel
Headers:
Authorization: Bearer <supabase_jwt_token>
Example curl:
curl -X POST http://localhost:5000/api/subscription/cancel \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
These routes allow users to create and manage family groups, share subscriptions, and split costs between family members. Only the group owner (or the member themselves where noted) may perform certain actions.
| Method | Path | Description |
|---|---|---|
| POST | /api/family-groups |
create a new family group (owner becomes current user) |
| GET | /api/family-groups/me/membership |
check which group the current user belongs to |
| GET | /api/family-groups/:id/members |
list all members of a group |
| POST | /api/family-groups/:id/members |
add a user to the group by email |
| DELETE | /api/family-groups/:id/members/:memberId |
remove a member (owner or self) |
| PUT | /api/family-groups/:id/settings |
update group settings such as show_family_data flag |
| POST | /api/family-groups/:id/share-subscription |
share one of your subscriptions with the group |
| DELETE | /api/family-groups/:id/shared-subscriptions/:sharedId |
stop sharing a subscription |
| GET | /api/family-groups/:id/shared-subscriptions |
list all subscriptions shared in the group |
| POST | /api/family-groups/:id/shared-subscriptions/:sharedId/cost-splits |
assign a percentage share for a user on a shared subscription |
| GET | /api/family-groups/:id/shared-subscriptions/:sharedId/cost-splits |
retrieve cost splits for a shared subscription |
Authentication is required for all family-sharing routes; include a
standard Authorization: Bearer header with a valid Supabase JWT.
Example: share a subscription via curl
curl -X POST http://localhost:5000/api/family-groups/$(GROUP_ID)/share-subscription \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"subscriptionId":"sub_123"}'
Keep these endpoints covered by the E2E tests (tests/e2e/familyShare.test.ts) so
that any change in group logic will be caught.
POST /api/family-groups — Create a new family groupGET /api/family-groups/:id/family-data — Get group data (role-based)POST /api/family-groups/:id/share-subscription — Share a subscriptionDELETE /api/family-groups/:id/shared-subscriptions/:sharedId — Unshare a subscriptionGET /api/family-groups/:id/shared-subscriptions — List shared subscriptionsPOST /api/family-groups/:id/shared-subscriptions/:sharedId/cost-splits — Assign cost splitGET /api/family-groups/:id/shared-subscriptions/:sharedId/cost-splits — Get cost splitsGET /metrics — Prometheus metricsGET /healthz — Liveness probeGET /readyz — Readiness probenpm installdocker-compose up (for local dev)npm run test (run all tests)npm run loadtest (run load test).env.example for required environment variablesREADME.md for details)/api/ limiter in server/index.ts/metrics and add to Prometheusnpm test and check tests/a11y.test.tsxuser_subscriptions table.The application automatically manages subscription statuses based on monthly usage:
To set up automatic monthly status updates, add this to your crontab (run crontab -e):
# Run subscription status updates at 11:59 PM on the last day of every month
59 23 L * * /path/to/subveris-2/cron-update-statuses.sh
Or run manually:
npm run update-statuses
A minimal GitHub Actions workflow lives in .github/workflows/ci.yml. It runs on every push and pull request against main/master:
npm ci)npm run check)npm run test:coverage)A second workflow (see .github/workflows/deploy.yml) builds and pushes Docker images to GitHub Container Registry; you can extend it to deploy to your hosting provider.
To run tests locally:
npm run test # quick run
npm run test:coverage # include coverage report
npm run test:ui # interactive UI
The repo now includes Dockerfiles for both server and client plus a
docker-compose.yml that brings up the API, frontend dev server, and
Redis. Example:
docker-compose up --build
Environment variables are read from the root .env file as usual. In
production you can build images with docker build . and push them to a
registry; the deploy workflow handles this automatically to ghcr.io/….
The runtime image uses a multi‑stage build so only production deps and the
compiled dist directory are included.
Monitoring is already wired through Sentry (see server/sentry.ts and
client/src/sentry.ts). The deployment workflow also creates a Sentry
release using the git SHA if you provide a SENTRY_AUTH_TOKEN secret and
set SENTRY_ORG/SENTRY_PROJECT in .github/workflows/deploy.yml.
The CI pipeline will lint, test, and build on every commit. Add further jobs (security audit, vulnerability scanning, container scans) as needed.
/healthz and /readyz endpoints for automated checks..github/workflows/deploy.yml for Slack integration example.