convex-nuxt

Convex integration for Nuxt
147,493 41
Install
npm install convex-nuxt
Latest Version:0.1.5
Vue:3
License:MIT
Last Updated:Jul 16, 2025
Links: GitHub  ·  npm
Maintainer: cvisser

Convex Nuxt Module

npm version npm downloads License Nuxt

Convex integration for Nuxt 3. Uses convex-vue under the hood.

Features

  • Supports Convex realtime queries
  • SSR and SSG support via suspense

Quick Setup

Install the module to your Nuxt application with one command:

npx nuxi module add convex-nuxt

Add the Convex URL to your nuxt.config.ts:

export default defineNuxtConfig({
  modules: ['convex-nuxt'],
  convex: {
    url: 'https://your-convex-url.convex.dev', // Ideally from an env variable
  },
})

That's it! You can now use Convex Nuxt in your Nuxt app ✨

Authentication

Authentication providers can be connected to the module by creating a small plugin. The main purpose of this plugin is to pass a method that returns a token to Convex. This will allow Convex functions like queries and mutations to be aware of the user.

Clerk

Create a plugin in the plugins directory, e.g. plugins/convexClerk.ts and add the following code:

export default defineNuxtPlugin(() => {
  const convex = useConvexClient() // from convex-nuxt
  const auth = useAuth() // from @clerk/nuxt

  // Whenever Convex needs a token, it will call this function
  const getToken = async () => {
    return auth.getToken.value({
      template: 'convex',
      skipCache: false,
    })
  }

  convex.setAuth(getToken)
})

From this point on, you can implement the Clerk module as you would normally do. Also, the Convex functions will have access to the logged in user like below:

export const get = query({
  args: {},
  handler: async (ctx) => {
      const identity = await ctx.auth.getUserIdentity() // The logged in user from Clerk
  },
})

Contribution

# Install dependencies
bun install

# Generate type stubs
bun run dev:prepare

# Develop with the playground
bun run dev

# Build the playground
bun run dev:build

# Run ESLint
bun run lint

# Run Vitest
bun run test
bun run test:watch

# Release new version
bun run release

Related Packages

@scayle/storefront-nuxt

Nuxt integration for the SCAYLE Commerce Engine and Storefront API

152,903
nuxt-tsconfig-stub

Stub Nuxt's generated tsconfig.json at installation

70,835 24
kuranuxt

Look at the Nuxt 3 documentation to learn more.

871 0
nuxt-define

One utility function for module authors to define compiler constants for all bui...

13,412,511
dayjs-nuxt

Day.JS Module for Nuxt

1,986,864 126

Version History

Version Released License
0.1.5 MIT
0.1.4 MIT
0.1.3 MIT
0.1.2 MIT
0.1.0 MIT