Skip to content

Generate TypeScript types from your PocketBase collections in seconds.

Notifications You must be signed in to change notification settings

thisuxhq/pockettypes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PocketTypes

Generate TypeScript types from your PocketBase collections in seconds.

Install

bun add pockettypes

Usage

  1. Create a .pocketbase.config.ts file:
export default {
  url: 'https://your-pb-instance.com',
  username: '[email protected]', 
  password: 'your-password'
}
  1. Generate types:
bun generate

This creates pb.types.ts with interfaces for all your collections:

interface Base {
  id: string;
  created: string;
  updated: string;
}

interface User extends Base {
  name: string;
  avatar: string;
  post_id: string; 
}

interface Post extends Base {
  title: string;
  content: string;
  author_id: string
}

Features

  • Generates TypeScript interfaces from PocketBase collections
  • Handles relations with proper typing
  • Supports all PocketBase field types
  • Generates expand interfaces for relations
  • Excludes views by default
  • Adds proper nullability
  • Supports custom fields

License

MIT © thisuxhq

About

Generate TypeScript types from your PocketBase collections in seconds.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published