mirror of
https://github.com/Dvorinka/Bookra.git
synced 2026-10-28 07:41:16 +00:00
Tenants paying for the SMS add-on still got email-only reminders — the channel column existed but nothing armed or dispatched sms jobs. Booking creation now adds a second job when SMS is enabled and the customer left a phone; dispatch routes sms jobs through an injected sender adapter wired to the existing sms.Service, so monthly limits, usage metering, and Stripe billing apply unchanged. Lifecycle handling from the previous milestone clears and re-arms both channels together. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Bookra Backend
Go + Gin API for Bookra, designed for Railway deployment with Neon Auth, Neon Postgres, and Stripe billing.
Commands
go run ./cmd/api
go build ./...
go test ./...
npm run db:migrate:status
npm run db:migrate:up
Environment
BOOKRA_FRONTEND_URLallowed browser originBOOKRA_DATABASE_URLNeon pooled connectionBOOKRA_DATABASE_DIRECT_URLNeon direct connection for migrations/admin tasksBOOKRA_NEON_AUTH_URLNeon Auth base URL used for JWKS verificationBOOKRA_AUTH_JWT_SECRETlocal JWT secret for the password-auth endpointsBOOKRA_JOB_RUNNER_KEYshared secret for remote job-runner callsBOOKRA_EMAIL_FROMsender identity for email remindersBOOKRA_SMTP_*optional SMTP transport for email deliveryBOOKRA_STRIPE_API_KEYStripe secret API keyBOOKRA_STRIPE_WEBHOOK_SECRETStripe webhook signing secretBOOKRA_STRIPE_{STARTER,PRO,BUSINESS}_{CZK,USD}_{MONTHLY,YEARLY}_PRICE_IDStripe price IDsBOOKRA_STRIPE_SMS_{CZK,USD,...}_PRICE_IDStripe SMS usage price IDsBOOKRA_SMSMANAGER_API_KEYoptional SMS Manager.cz keyBOOKRA_UMAMI_API_URLandBOOKRA_UMAMI_API_KEYoptional analytics integrationBOOKRA_ADMIN_EMAILandBOOKRA_ADMIN_KEYoptional platform admin API credentialsBOOKRA_SENTRY_DSNoptional error monitoring
See .env.example for the full list.
Notes
- Auth verification is isolated in
internal/auth. - OpenAPI lives in
openapi/bookra.openapi.yaml. - SQL migrations live in
migrations/(goose). - Repositories are handwritten pgx in
internal/db/; there is no generated query layer. - Goose migrations are wired through
npm run db:migrate:*and use the Neon direct connection URL. - Reminder dispatch runs through
POST /v1/internal/jobs/reminders/dispatchwithX-Bookra-Job-Key. BOOKRA_DEMO_MODE=trueswaps the repository for deterministic in-memory demo data and authenticates all requests asdemo-owner.
Production Auth
Bookra production auth uses Neon Auth directly:
- frontend uses
VITE_NEON_AUTH_URL - backend verifies Neon JWTs with
BOOKRA_NEON_AUTH_URL
Trusted redirect domains in Neon Auth should include your frontend origin such as https://bookra.eu, plus local dev origins when needed.
Stripe Setup
Get these values from the Stripe dashboard:
BOOKRA_STRIPE_API_KEY: Developers -> API keys -> secret keyBOOKRA_STRIPE_WEBHOOK_SECRET: Developers -> Webhooks -> destination signing secretBOOKRA_STRIPE_*_PRICE_ID: Product catalog -> recurring price IDs
Create one recurring price per plan/currency/interval you support:
starter/pro/business×czk/usd×monthly/yearly
Set the webhook destination to:
POST /v1/webhooks/stripe
Subscribe to at least: checkout.session.completed, customer.subscription.created,
customer.subscription.updated, customer.subscription.deleted,
invoice.payment_succeeded, invoice.payment_failed.
For local testing:
stripe listen --forward-to http://localhost:8080/v1/webhooks/stripe