How alt-f6/edtech-billing-core works
This is a framework-free TypeScript core for EdTech billing, payment webhooks, and enumeration-resistant login. Staff attendance changes drive race-safe lesson charges and reversals; payment notifications are rate-limited, authenticated, re-verified with the provider, checked against payment intent data, then credited idempotently. Login reserves atomic limits before an enumeration-safe password check. The graph reflects README-documented capabilities where source was not sampled; those links cite the README, and the database schema is represented by the migration.
Main entry points: webhook.handler.ts Webhook pipeline · login-rate-limit.ts Login flow and limits · billing.service.ts Attendance billing · db.ts Pool and transactions
Components 18
Lesson billing
- Attendance billing
src/billing/billing.service.ts - Billing schema
migrations/001_init.sql
Payment webhooks
- Webhook pipeline
src/payments/webhook.handler.ts - Webhook authentication
src/payments/webhook-auth.ts - Provider client and validation
src/payments/provider.ts - Idempotent payment credit
src/payments/webhook.handler.ts
Login security
- Login flow and limits
src/auth/login-rate-limit.ts - Email normalization
src/auth/email.ts - Enumeration-safe password check
src/auth/password.ts
Shared infrastructure
- Exact money parsing
src/money.ts - Postgres rate limiter
src/rate-limit/rate-limit.ts - Pool and transactions
src/db.ts - Typed billing errors
src/errors.ts
Other components
- School staff
- PostgreSQL
- Payment provider webhook
- YooKassa API
- Login user
Connections 22
- School staff → Attendance billing: marks lessons
README.md - Attendance billing → PostgreSQL: locks and writes
src/billing/billing.service.ts - Billing schema → PostgreSQL: defines constraints
README.md - Payment provider webhook → Webhook pipeline: submits notification
README.md - Webhook pipeline → Postgres rate limiter: checks request limit
src/payments/webhook.handler.ts - Webhook pipeline → Webhook authentication: checks secret and IP
src/payments/webhook.handler.ts - Webhook pipeline → Provider client and validation: fetches and parses payment
src/payments/webhook.handler.ts - Provider client and validation → YooKassa API: fetches payment
README.md - Webhook pipeline → PostgreSQL: reads payment intent
src/payments/webhook.handler.ts - Webhook pipeline → Exact money parsing: parses provider amount
src/payments/webhook.handler.ts - Webhook pipeline → Idempotent payment credit: credits verified payment
src/payments/webhook.handler.ts - Idempotent payment credit → PostgreSQL: writes idempotent ledger row
src/payments/webhook.handler.ts - Login user → Login flow and limits: submits credentials
README.md - Login flow and limits → Email normalization: normalizes email
src/auth/login-rate-limit.ts - Login flow and limits → Enumeration-safe password check: checks password
README.md - Login flow and limits → PostgreSQL: reserves and clears attempts
src/auth/login-rate-limit.ts - Postgres rate limiter → PostgreSQL: updates limit buckets
src/rate-limit/rate-limit.ts - Attendance billing → Pool and transactions: uses transactions
src/billing/billing.service.ts - Webhook pipeline → Pool and transactions: uses transactions and IP hash
src/payments/webhook.handler.ts - Login flow and limits → Pool and transactions: uses transactions and IP hash
src/auth/login-rate-limit.ts - Pool and transactions → PostgreSQL: connects and transacts
README.md - Attendance billing → Typed billing errors: raises typed errors
src/billing/billing.service.ts