Node Quickstart
The Node SDK (@pylo/node) gives you type-safe server-side access to your Pylo data with API key
authentication. Use it for backends, scripts, and internal tools.
Install
$
pnpm add @pylo/nodeGenerate types
Create an API token in Settings > API Tokens in the admin panel (see
API Tokens) and put it in .env.
.env
1
PYLO_API_KEY=your-api-token-herepylo.config.ts
1
2
3
4
5
6
import { defineConfig } from '@pylo/node/codegen';
export default defineConfig({
apiKey: process.env.PYLO_API_KEY!,
folder: '.pylo', // optional, defaults to '.pylo'
});pylo generate loads .env and .env.local before reading the config.
$
pnpm exec pylo generateThis creates a .pylo/ directory with your generated types.
When to regenerate
Rerun pylo generate after changing entities or fields in Pylo.
Create the client
lib/pylo.ts
1
2
3
4
5
6
import { createPyloNode } from '@pylo/node';
import type { PyloSchema } from '../.pylo';
export const pylo = createPyloNode<PyloSchema>({
apiKey: process.env.PYLO_API_KEY!,
});The client has the same query and mutation API as the Next.js server client. All examples in the Data section apply.