basefyio + Vue: Database Backend for Vue Apps
Pair Vue's reactivity with a basefyio backend. The basefyio-js SDK fits naturally into composables for data, auth, and storage.
Install
npm install basefyio-jsCreate the client
// src/basefyio.ts
import { createClient } from "basefyio-js";
export const bf =createClient({
projectId: import.meta.env.VITE_BASEFYIO_PROJECT_ID,
apiKey: import.meta.env.VITE_BASEFYIO_ANON_KEY,
});Use the anon key in the browser; row-level security enforces access at the database.
A data composable
// composables/usePosts.ts
import { ref, onMounted } from "vue";
import { bf } from "../basefyio";
export function usePosts() {
const posts = ref([]);
onMounted(async () => {
const { data } = await bf.from("posts").select("id, title");
posts.value = data ?? [];
});
return { posts };
}Composition-API friendly
Wrap queries in composables and return reactive refs your components consume.
Full backend included
Database, auth, and storage in one SDK — no separate services to wire.
Standard SQL
Real SQL and row-level security, fully portable with pg_dump.
Frequently asked questions
- Does basefyio work with Nuxt?
- Yes. Nuxt is built on Vue, and basefyio-js runs in both server and client contexts. Use the anon key on the client and a service key only in server routes.
- How do I track the logged-in user in Vue?
- Create a composable around bf.auth.getUser and bf.auth.onAuthStateChange and provide it app-wide.
Other integrations
Build your Vue backend on basefyio
database, auth, storage, and a REST API — running in minutes.