Voice-to-text is everywhere, but making it work seamlessly on Linux—so that your spoken words appear as keystrokes in any app—turns out to be a surprisingly deep rabbit hole. This post documents my journey building a robust, real-time voice-to-text “virtual keyboard” script, the pitfalls I hit, and the lessons learned along the way. If you want to skip the story and grab the final script, jump to the end. The Goal I wanted a Python script that would: ...
End-to-End TypeScript API Contracts: From Backend Schema to Frontend Usage
⬇️ Download this article as Markdown Background: This article builds on the foundation described in Automatic TypeScript Generation from Backend Schema. If you haven’t read that, start there for the rationale and initial setup. End-to-End TypeScript API Contracts: From Backend Schema to Frontend Usage Overview This article documents the complete, automated workflow that keeps our frontend TypeScript types in perfect sync with our backend API contract. We cover every step: from backend schema exposure, through Makefile automation and type generation, to ergonomic, type-safe API usage in React components. ...
Automatic TypeScript Generation from Backend Schema
Automatic TypeScript Generation from Backend Schema Purpose Ensure our frontend TypeScript types always match our backend API contract by automatically generating types from the backend’s OpenAPI schema, with correct required/optional fields, and type fidelity for Go primitives, pointers, and time.Time. Pattern Steps Backend exposes OpenAPI schema Our backend provides an endpoint (e.g., / or /openapi.json) that returns the OpenAPI schema. The schema generator: Adds all unique request/response types as named schemas in components.schemas. Handles Go time.Time and *time.Time as string. Handles pointers to primitives (e.g., *int, *string) as their base type. Correctly sets the required array for struct fields: non-pointer, non-omitempty fields are required; pointer and omitempty fields are optional. Frontend Makefile automation ...