Integrations

Vue

title: Vue description: Build data-intensive apps with Vue 3.

title: Vue description: Build data-intensive apps with Vue 3.

Set up the Ginjou in your Vue application using the headless context pattern and peripheral integration packages.

Installation

Ginjou relies on @tanstack/vue-query for robust data fetching, caching, and state synchronization.
pnpm add @ginjou/vue @tanstack/vue-query

Setup

Ginjou uses a Context API pattern to provide configuration to your application. Instead of a single monolithic plugin, you use granular define*Context functions within the setup block of your root component.

Available setup functions:

FunctionDescription
defineFetchersContextProvide your data fetchers.
defineQueryClientContextProvide the TanStack Query client.
defineResourceContextProvide resource definitions and patterns.
defineRouterContextProvide the router integration.
defineAuthContextProvide the authentication provider.
defineAuthzContextProvide the authorization provider.
defineI18nContextProvide the internationalization provider.
defineNotificationContextProvide the notification provider.

Import and call your definition functions within the <script setup> block of your root component.

Registering providers in the root component ensures that context is available to all child components and remains consistent during SSR.
App.vue
<script setup lang="ts">
import { defineFetchersContext, defineQueryClientContext, defineRouterContext } from '@ginjou/vue'
import { createRouter } from '@ginjou/with-vue-router'
import { QueryClient } from '@tanstack/vue-query'
import { RouterView } from 'vue-router'

defineQueryClientContext(
    new QueryClient()
)
defineFetchersContext({
    default: {
        getList: async ({ resource }) => ({ data: [], total: 0 }),
        getOne: async ({ resource, id }) => ({ data: {} }),
    },
})
defineRouterContext(
    createRouter()
)
</script>

<template>
    <RouterView />
</template>

Peripheral Services

Use integration packages to bridge your favorite libraries with the framework.

Router

Use @ginjou/with-vue-router to connect your application with vue-router.

import { defineRouterContext } from '@ginjou/vue'
import { createRouter } from '@ginjou/with-vue-router'

// In setup()
defineRouterContext(createRouter())

I18n

Use @ginjou/with-vue-i18n to connect with vue-i18n.

import { defineI18nContext } from '@ginjou/vue'
import { createI18n } from '@ginjou/with-vue-i18n'

// In setup()
defineI18nContext(createI18n())