Vextro Get Started

Get Started

Add Vextro to a Convex + Astro project. You'll have a working, type-safe admin panel in about five minutes.

1

Install Vextro

Add Vextro to your Convex + Astro project.

npm install vextro
2

Configure your collections

Define collections using defineVextroCollection and the f.* field builders. Every field automatically produces a Convex validator and an admin UI widget.

import { defineVextroCollection, f } from 'vextro'

export const posts = defineVextroCollection({
  label: 'Posts',
  tableName: 'posts',
  fields: {
    title:  f.text({ required: true }),
    slug:   f.slug({ sourceField: 'title' }),
    body:   f.richText(),
    status: f.select({
      options: ['draft', 'published'],
      defaultValue: 'draft',
    }),
  },
})
3

Mount the admin routes

Add a catchall page at src/pages/admin/[...vextro].astro. Vextro handles all routing and UI internally — no layout code to write.

// src/pages/admin/[...vextro].astro
---
import VextroCatchallPage from 'vextro/astro/VextroCatchallPage.astro'
import { handleVextroCatchallRequest } from 'vextro/astro/catchall'
import { api } from '../../../convex/_generated/api'
import { adminConfig } from '@/config/admin'
import { getConvexClient } from '@/lib/convex'

const convex = getConvexClient(Astro.locals?.convexAuthToken)

const earlyResponse = await handleVextroCatchallRequest({
  request: Astro.request,
  params: Astro.params,
  basePath: adminConfig.basePath,
  locals: Astro.locals as Record<string, unknown>,
  cookies: Astro.cookies,
  redirect: Astro.redirect,
  convex,
  api,
})

if (earlyResponse) return earlyResponse
---

<VextroCatchallPage convex={convex} api={api} config={adminConfig} title="Admin" />
4

Register Convex functions

Wire up the Vextro admin module in your Convex directory. createVextroAdminModule registers all the mutations and queries Vextro needs.

// convex/admin.ts
import { query, mutation } from './_generated/server'
import { components } from './_generated/api'
import { createVextroAdminModule } from 'vextro/convex/admin'
import { vextro } from './schema'

const admin = createVextroAdminModule({
  query,
  mutation,
  components,
  collectionDefinitions: vextro.collectionDefinitions,
  globalDefinitions: vextro.globalDefinitions,
})

export const { listCollections, listGlobals, getShellData } = admin
// export all remaining admin handlers...
5

You're ready

Start your dev server. Navigate to /admin to see the auto-generated panel. All collections, fields, and validation are live from your config.

npx astro dev

Everything is in the docs

API reference, field type guide, authentication setup, and more.

Read the Docs