Neon Client
neon-ui/neon-clientFreeUtility
Shared Neon API client factory used by neon-ui data hooks.
Install it
npx shadcn@latest add https://ui.neon.com/r/neon-client.jsonSource
1import { createNeonClient as createSdkClient } from "@neon/sdk";23/**4 * Shared Neon API client factory for neon-ui data hooks.5 *6 * Wraps `@neon/sdk`, the official TypeScript SDK for the Neon API. Methods are7 * grouped into resource namespaces (`neon.branches`, `neon.postgres.endpoints`,8 * `neon.consumption`, ...) and resolve to `{ data, error }` rather than9 * throwing, so a failed call is handled where it happens.10 *11 * The API key must come from the server side (route handler, server12 * component, or server function). Never expose NEON_API_KEY to the browser;13 * browser-facing components should receive data as props or go through the14 * Data API, which is designed for untrusted clients.15 */16export const createNeonClient = (apiKey: string) => {17 if (!apiKey) {18 throw new Error(19 "neon-ui: missing Neon API key. Pass process.env.NEON_API_KEY from server-side code."20 );21 }2223 return createSdkClient({ apiKey });24};2526export type NeonClient = ReturnType<typeof createNeonClient>;
What it pulls in
npm packages
Files it writes
More from neon-ui
All 77 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Consumption metricsconsumption | neon-ui | Utilities | Free | no deps | |
| cn utilityutils | neon-ui | Utilities | Free | 2 deps |
