"The Core Backbone for YA Holdings Microservices."
📋 Basic Information
- Package:
@ya-accelerators/web-backend-framework (npm)
- License: MIT
- Consumers: every backend package (Service / BFF / gateway) of
web-development-base and its forks, delivered by the Sync workflow
🎯 What it provides
A consumer service gets the following without writing it itself:
- HTTP server: an Express server hosting the service's tRPC router, with CORS restricted to the origins the service configures, security headers, a request ID on every request (an inbound one is kept, otherwise one is issued), and an optional reverse proxy with an aggregated health check.
- tRPC: type-safe procedures with Zod-validated input, SuperJSON serialisation, and a fixed error vocabulary. Every procedure declares its authentication and its record-of-processing entry before it can be served; an undeclared procedure does not compile.
- Request context: request-scoped context carried through the call, with the request ID and trace headers propagated to outbound calls to other services.
- Database access (Prisma / MySQL): a connection managed by the framework, automatic routing of reads to the replica and writes to the primary, transactions that nested calls join, row locking, pagination, and an audit event written in the same transaction as each business write.
- Cache and coordination (Valkey / Redis): key–value operations plus distributed locks, rate limiting and throttling.
- Object storage (S3): object read / write / delete, write-once (WORM) storage, and lifecycle rules.
- File uploads: a single-use, actor-bound upload flow a frontend reaches through the generated client.
- Error log intake: a procedure a BFF enables for the frontend to report browser errors to the server log, rate-limited per caller.
- Logging: levelled, structured logging with personal and secret values masked before output.
- Environment configuration: Zod-validated environment access that fails at start-up on an invalid value.
- Validation: Zod schemas and predicates for email, password, phone (E.164), currency (ISO 4217) and country (ISO 3166-1 alpha-2), plus Japan-specific identifiers.
- Compliance policy: the shared vocabulary for personal-data markers, retention and data-subject-request deadlines that the compliance runtime enforces.
- Google Cloud connectors: workload-identity authentication and ID-token issue / verification.