Generate TypeScript definitions from your PocketBase schema for type-safe frontend development.
Pocketbase Typegen is a TypeScript type generation tool for PocketBase backends. It automatically creates TypeScript definitions from your PocketBase schema, providing full type safety when interacting with collections, records, and relations in frontend applications. It solves the problem of manually maintaining type definitions that stay in sync with backend schema changes.
Full-stack developers using PocketBase as their backend with TypeScript frontends. Particularly valuable for teams who need to maintain type safety across rapidly evolving schemas.
Developers choose Pocketbase Typegen because it eliminates manual type maintenance, automatically syncs frontend types with backend schema changes, and provides comprehensive type safety for all PocketBase operations including relations, JSON fields, and mutations.
Typescript generation for pocketbase records
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
CLI tool automatically generates TypeScript interfaces from PocketBase schema, eliminating manual type maintenance. Evidence: README shows quickstart command producing types for all collections.
Provides a TypedPocketBase type for seamless type safety with the PocketBase JavaScript SDK. Evidence: Example usage demonstrates type-safe collection accesses with as TypedPocketBase.
Supports multiple input methods like URL, SQLite database, or JSON export, adapting to various deployment setups. Evidence: Options include --url, --db, and --json for schema extraction.
Can be integrated with PocketBase hooks to regenerate types on schema changes, ensuring continuous sync. Evidence: README provides a hook script example for automatic type generation.
Generates types for records, responses, JSON fields, relations, and create/update utilities, covering all common operations. Evidence: Output includes Collections enums, response types, and utility types like Create and Update.
Requires superuser credentials or tokens for URL-based access, posing risks if credentials are mishandled. Evidence: CLI options mandate --email/--password or --token for authenticated schema fetching.
Tightly coupled with specific PocketBase versions, as shown in the support table, potentially breaking with updates. Evidence: README lists version mappings, e.g., v0.23.x requires v1.3.x, indicating fragility.
Automating type generation via hooks requires custom JavaScript files and familiarity with PocketBase's hook system, adding setup effort. Evidence: Hook example involves creating a .pb.js file and using $os.cmd with specific paths.
Introduces an extra dependency and step in the workflow, which might be overkill for simple or infrequently changing projects. Evidence: Need to run CLI commands or maintain hook scripts, adding to build processes.