PocketStarter Docs

AI Development with PocketStarter

AI development tools like Cursor, GitHub Copilot, and Claude can significantly accelerate your development workflow. While Next.js is widely adopted and documented, and rarely introduces breaking changes (which is great for AI), PocketBase's architecture and recent version updates require specific considerations for effective AI development.

PocketBase Documentation Sources

Before diving into AI-assisted development, it's important to have reliable documentation sources indexed. These guides are particularly valuable for troubleshooting and reference:

PocketStarter and AI-Assisted development

1. AI rules for PocketBase

PocketBase v0.23.0 introduced significant API changes that affect how AI generates code. AI tools may suggest outdated patterns like:

// ❌ Deprecated (pre-v0.23)
$app.dao().saveRecord(record)
onModelBeforeCreate(() => {})
c.pathParam("id")

// ✅ Current (v0.23+)
$app.save(record)
onRecordCreate((e) => { e.next() })
e.request.pathValue("id")

While indexing the upgrade guide helps, having dedicated AI rules is more effective. I've extracted the most valuable patterns from months of PocketBase development and packaged them into ready-to-use Cursor rules.

Get Cursor AI Rules

Pre-configured AI rules that help Cursor understand PocketBase patterns, avoid deprecated code suggestions, and follow conventions.

Access your download

Enter your purchase details from your confirmation email.

My pre-configured Cursor AI rules include:

  • Current PocketBase v0.23+ API patterns, such as:
    • Use $app.save() instead of $app.dao().saveRecord()
    • Ensure all hooks call e.next()
    • Use new route parameter syntax {param} instead of :param
  • Code organization guidelines
  • Common pattern corrections

Installation instructions

Download the file using the form below

Create a new folder called .cursor in your PocketBase main directory

Extract the contents of the zip file into the .cursor folder

You'll end up with a few files in /pocketbase/.cursor/rules/

2. Type Safety integration

AI tools work much better when they have access to proper type definitions. PocketStarter provides full type safety with automated type generation (see the Type Safety Guide), which helps AI tools understand your database structure and generate more accurate code suggestions.

PocketBase Type Safety

Type Safety helps with AI development for PocketBase

3. Code organization

PocketStarter follows specific patterns that work well with AI tools:

  • Hooks in pb_hooks/ - Keeps server-side logic organized in subfolders
  • TypeScript types - Generated PocketBase types improve AI suggestion accuracy
  • Consistent naming conventions - Follows established collection and field naming patterns

4. Effective prompting

The quality of your prompts directly impacts the usefulness of AI assistance. Here are some best practices:

  • Be specific about what you're trying to achieve
  • Include context about your current setup and requirements
  • Reference existing patterns in your codebase when asking for similar functionality
  • Specify the target environment (JSVM hooks, client-side, etc.)

Example: PocketBase Hook Creation

Poor prompt:

"Create a hook for users"

Better prompt:

"I need to create a PocketBase JSVM hook for the 'users' collection that validates email format and sends a welcome email on record creation. Here's my current hook structure in pb_hooks/activate.pb.js for reference."

The second prompt provides context about the collection, specific requirements, and the target environment, making it much more likely to generate useful code.