# SQL & Search

Use Ferrite-native SQL and search services where relational queries or ranked retrieval are the right application shape.

Ferrite provides SQL and search services for workloads that need relational
schemas or ranked retrieval. They run on Ferrite application
contracts rather than an external PostgreSQL, Elasticsearch, or hosted database
dependency.

## SQL

`ferrite-sql-app` provides the SQL path. Use it when your domain is best
expressed through tables, constraints, and relational queries. Keep the service
private to the application stack and grant only the calling app’s capability.

## Search

`ferrite-search` builds a search index from declared documents and query
configuration. The support, content, compliance, and calendar samples include
search material you can adapt.

## Choose the smallest primitive

- Use Store for direct durable records and bounded prefix scans.
- Use Transactions for cross-record invariants.
- Use Streams for ordered history.
- Use SQL for relational access patterns that would otherwise become manual
  secondary indexes.
- Use Search for relevance-ranked text retrieval.

See [Samples](/developers/samples/) for working shapes and validation commands.
