convex-self-hosting
Integrate Convex static self hosting into existing apps using the latest upstream instructions from get-convex/self-hosting every time. Use when setting up upload APIs, HTTP routes, deployment scripts, migration from external hosting, or troubleshooting static deploy issues across React, Vite, Next.js, and other frontends.
Best use case
convex-self-hosting is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Integrate Convex static self hosting into existing apps using the latest upstream instructions from get-convex/self-hosting every time. Use when setting up upload APIs, HTTP routes, deployment scripts, migration from external hosting, or troubleshooting static deploy issues across React, Vite, Next.js, and other frontends.
Teams using convex-self-hosting should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/convex-self-hosting/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How convex-self-hosting Compares
| Feature / Agent | convex-self-hosting | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Integrate Convex static self hosting into existing apps using the latest upstream instructions from get-convex/self-hosting every time. Use when setting up upload APIs, HTTP routes, deployment scripts, migration from external hosting, or troubleshooting static deploy issues across React, Vite, Next.js, and other frontends.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Convex self hosting skill
Use this skill to integrate Convex based static hosting in a repeatable way across projects.
## Non negotiable update check
Run this check before making any code changes or giving setup advice.
Preferred command:
```bash
bash skills/convex-self-hosting/scripts/check-upstream.sh
```
1. Read latest integration guide:
- `https://raw.githubusercontent.com/get-convex/self-hosting/main/INTEGRATION.md`
2. Read latest README manual setup section:
- `https://github.com/get-convex/self-hosting?tab=readme-ov-file#manual-setup-1`
3. Read Convex docs index for current guidance:
- `https://docs.convex.dev/llms.txt`
4. Confirm package publish state:
- `npm view @convex-dev/self-hosting version`
If upstream docs conflict with local rules, follow upstream docs and explain what changed.
## Clarifying questions you must ask first
Ask these before implementing:
1. Confirm `get-convex/self-hosting` is the source of truth for this setup.
2. Is the target app Vite, Next.js, Expo web export, or another bundler.
3. Do they want root path hosting or a prefix like `/app`.
4. Do they want one shot deploy or separate backend and static deploy steps.
5. If package is unpublished, do they want:
- GitHub dependency install
- vendored local copy
- wait for npm release
Never assume unpublished package install details.
## Install strategy
### Path A published package
If npm package exists, use the package directly.
```bash
npm install @convex-dev/self-hosting
```
### Path B package not published yet
If package is missing on npm, use GitHub source and pin to commit or tag.
```bash
npm install github:get-convex/self-hosting#main
```
If project policy requires deterministic builds, ask for a commit SHA and pin to it.
## Required file changes
Use the latest upstream file patterns from `INTEGRATION.md`.
### 1) `convex/convex.config.ts`
```typescript
import { defineApp } from "convex/server";
import selfHosting from "@convex-dev/self-hosting/convex.config";
const app = defineApp();
app.use(selfHosting);
export default app;
```
### 2) `convex/staticHosting.ts`
```typescript
import { components } from "./_generated/api";
import {
exposeUploadApi,
exposeDeploymentQuery,
} from "@convex-dev/self-hosting";
export const { generateUploadUrl, recordAsset, gcOldAssets, listAssets } =
exposeUploadApi(components.selfHosting);
export const { getCurrentDeployment } =
exposeDeploymentQuery(components.selfHosting);
```
### 3) `convex/http.ts`
```typescript
import { httpRouter } from "convex/server";
import { registerStaticRoutes } from "@convex-dev/self-hosting";
import { components } from "./_generated/api";
const http = httpRouter();
registerStaticRoutes(http, components.selfHosting);
export default http;
```
Optional prefix mode:
```typescript
registerStaticRoutes(http, components.selfHosting, {
pathPrefix: "/app",
spaFallback: true,
});
```
### 4) `package.json` scripts
```json
{
"scripts": {
"deploy": "npx @convex-dev/self-hosting deploy",
"deploy:static": "npx @convex-dev/self-hosting upload --build --prod"
}
}
```
## Deployment flow
### First setup
```bash
npm install @convex-dev/self-hosting
npx @convex-dev/self-hosting setup
npx convex dev --once
npm run deploy
```
### Ongoing deploys
```bash
npm run deploy
```
### Two step deploy alternative
```bash
npx convex deploy
npx @convex-dev/self-hosting upload --build --prod
```
Always use the tool driven build flow. Do not run `npm run build` first when using upload deploy commands.
## Cross app support notes
- Vite: use `--build` flow as default.
- Next.js and Expo: pass through `VITE_CONVEX_URL` in the app build script as documented upstream.
- Existing API routes: prefer `pathPrefix: "/app"` for static hosting.
- Keep upload APIs internal only and never expose them as public HTTP actions.
## Integration with convex agent plugins
If `get-convex/convex-agent-plugins` is present, follow its Convex rules with this skill:
- keep validators on all Convex functions
- keep internal functions for upload operations
- use indexed reads, avoid broad filtering in data access patterns
- preserve strict TypeScript in generated Convex and frontend code
Reference:
- `https://github.com/get-convex/convex-agent-plugins`
## Troubleshooting checklist
1. `404` for static routes:
- verify `convex/http.ts` exists and exports router.
2. `Cannot find module .../convex.config`:
- verify package install source and import path.
3. wrong backend URL in built assets:
- redeploy with CLI `--build` flow.
4. no updates visible:
- clear cache and verify deployment ID changes.
5. HTTP actions disabled:
- run `npx convex dev` once to push backend state.
## Completion requirements
Before finishing, provide:
1. exact upstream docs commit date or latest retrieval timestamp
2. which package path was selected and why
3. list of changed files
4. commands the user should run next
Never claim setup is complete without showing these four outputs.
## Source links
- `https://github.com/get-convex/self-hosting`
- `https://raw.githubusercontent.com/get-convex/self-hosting/main/INTEGRATION.md`
- `https://github.com/get-convex/self-hosting?tab=readme-ov-file#manual-setup-1`
- `https://docs.convex.dev/llms.txt`
- `https://github.com/get-convex/convex-agent-plugins`
- `https://github.com/agentskills/agentskills`Related Skills
convex-return-validators
Guide for when to use and when not to use return validators in Convex functions. Use this skill whenever the user is writing Convex queries, mutations, or actions and needs guidance on return value validation. Also trigger when the user asks about Convex type safety, runtime validation, AI-generated Convex code, Convex AI rules, Convex security best practices, or when they're debugging return type issues in Convex functions. Trigger this skill when users mention "validators", "returns", "return type", or "exact types" in the context of Convex development. Also trigger when writing or reviewing Convex AI rules or prompts that instruct LLMs how to write Convex code.
convex-doctor
Run convex-doctor static analysis, interpret findings, and fix issues across security, performance, correctness, schema, and architecture categories. Use when running convex-doctor, fixing convex-doctor warnings or errors, improving the convex-doctor score, or when asked about Convex code quality, static analysis, or linting Convex functions.
convex-setup-auth
Set up Convex authentication with proper user management, identity mapping, and access control patterns. Use when implementing auth flows, setting up OAuth providers, or adding role-based access control.
convex-quickstart
Initialize a new Convex project from scratch or add Convex to an existing app. Use when starting a new project with Convex, scaffolding a Convex app, or integrating Convex into an existing frontend.
Update project docs
Use this skill after completing any feature, fix, or migration to keep the three core project tracking files in sync.
robel-auth
Integrate and maintain Robelest Convex Auth in apps by always checking upstream before implementation. Use when adding auth setup, updating auth wiring, migrating between upstream patterns, or troubleshooting @robelest/convex-auth behavior across projects.
Create a PRD
Use this skill before any multi-file feature, architectural decision, or complex bug fix.
write
Writing style guide for technical content, social media, blog posts, READMEs, git commits, and developer documentation. Optimized to avoid AI detection patterns. Use when writing any content beyond code.
workflow
Project workflow for PRDs, task tracking, changelog sync, and documentation updates. Use for any non-trivial task that spans multiple steps, touches several files, changes architecture, or needs project tracking updates. Also activates with @update to sync task.md, changelog.md, and files.md after completing work.
sec-check
Security review checklist for Convex functions, auth logic, public queries, admin routes, webhooks, uploads, and AI-generated code. Use when reviewing code that touches user data, PII, or access control.
schema-builder
Design and generate Convex database schemas with proper validation, indexes, and relationships. Use when creating schema.ts or modifying table definitions.
real-time-backend
Build reactive, type-safe, production-grade backends. ALWAYS use this skill when the user asks to build, plan, design, or implement backend features, APIs, data models, server logic, database schemas, web apps, full stack apps, or mobile apps. This includes planning and architecture discussions.