Skip to content

Add .cursorrules files for examples #30

@zpg6

Description

@zpg6

If anyone has taken the time to maintain one for Next.js and/or Hono examples please consider contributing it

Next.js (maybe some applies to Hono)

Here's some starter content I've been using with moderate success:

  • If you need to modify the schema, do not modify the auth.schema.ts file directly! You must modify the plugins schema (use context7 to look into better-auth plugins, schema, adapters, endpoints, and more if you're at all unsure.) If no schema applies, you need to create a new plugin.

  • After modifying schema, run pnpm run auth:update. if that passes run pnpm run db:generate and then check drizzle/. If it looks okay run pnpm run db:migrate:prod. Lastly, add to seed data and run pnpm run db:seed.

  • When making front end components that need data, do not make direct fetch calls, use the auto-inferred type-safe authClient calls. See other components for examples of this.

  • When making better-auth plugin endpoints, we do not permit query or path params. Must be POST requests with zod for body schema declaration/validation. If you have no params at all, then use GET requests and call authClient.something.list() instead of authClient.something.list({}).

  • New schemas and endpoints must be added as better-auth plugins. Do research on existing plugins we have and with context7 so you get it just right (type system of it is a bit delicate). If there are no related schema or endpoints yet, you need to create a new plugin.

  • The Better Auth type inference system automatically removes certain prefixes and converts the endpoint names. So getDatasheetTypes becomes types, and the HTTP method and other details are inferred. Please study the existing plugins and corresponding authClient calls in other files and frontend components to understand this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions