Kolaybase + Nuxt: PostgreSQL Backend for Nuxt Apps

Nuxt handles rendering and routing on top of Vue; Kolaybase provides the backend — PostgreSQL, auth, and storage — through the kolaybase-js SDK on both server and client.

Install

npm install kolaybase-js

Create the client

// utils/kolaybase.ts
import { createClient } from "kolaybase-js";

const config = useRuntimeConfig();
export const kb = createClient({
  projectId: config.public.kolaybaseProjectId,
  apiKey: config.public.kolaybaseAnonKey,
});

Expose the anon key via runtimeConfig.public for client use. For server routes that need elevated access, read a service key from the private runtimeConfig instead.

Fetch data in a component

<script setup lang="ts">
import { kb } from "~/utils/kolaybase";

const { data: posts } = await useAsyncData("posts", async () => {
  const { data } = await kb.from("posts").select("id, title");
  return data ?? [];
});
</script>

Server and client

Use the SDK in composables, server routes (/server/api), and plugins with one setup.

No backend boilerplate

Query PostgreSQL directly instead of writing server routes for basic CRUD.

Auth and storage included

kb.auth and kb.storage cover sign-in and uploads out of the box.

Frequently asked questions

Does Kolaybase work with Nuxt 3 server routes?
Yes. Create a server-side client with a service key in /server/api routes for trusted operations, and a public client for the browser.
Where do Kolaybase keys go in Nuxt?
Public anon keys go in runtimeConfig.public; service keys go in the private runtimeConfig, accessed only in server routes.

Other integrations

Build your Nuxt backend on Kolaybase

PostgreSQL, auth, storage, and a REST API — running in minutes.

Get started