serverpod

Serverpod

Specific best practices and architectural patterns when working with Serverpod.

Details

Language / Topic
dartDart
Category
framework

Rules

balanced
- Define models in YAML protocol files and run `serverpod generate` to produce type-safe endpoints and serialization.
- Use Serverpod's built-in ORM for database queries — avoid raw SQL except for complex joins or migrations.
- Define models in `lib/src/protocol/*.yaml` and run `serverpod generate` after every change.
- Use the built-in ORM (`find`, `findById`, `insert`, `update`, `delete`) for database operations.
- Implement endpoints by extending `Endpoint` and using `Session` for database access, authentication, and logging.
- Use Serverpod's streaming support for real-time features instead of polling.
- Configure `config/` YAML files per environment (development, staging, production) — never hardcode connection strings.