> How codegen turns your Pylo schema into TypeScript types that shape every query

# Type Safety

The SDKs are typed against your own schema. `pylo generate` reads it through your API token and
writes a `.pylo/` directory:

```
.pylo/
  index.ts     # PyloSchema interface + type re-exports
  entities.ts  # Individual entity interfaces
```

Passing `PyloSchema` to `createPyloServer`, `createPyloHooks`, or `createPyloNode` types every call.
Entity names autocomplete, `select` takes real fields only, and the result type matches your
selection.

```typescript filename="example.ts"
const { data } = await pylo.contact.list({
  select: { name: true, email: true },
});
// data: Array<{ name: string | null; email: string | null }>
```

## Keeping types in sync

The generated types mirror the schema as it stood when you ran the command. Rerun `pylo generate`
after every schema change, and add it as a `prebuild` script so CI fails when the schema and your
code drift apart.

Next: [Data](/data/overview)
