Skip to content

Commit 56902c4

Browse files
authored
Merge pull request #5 from get-convex/rename-to-static-hosting
Rename @convex-dev/self-hosting to @convex-dev/static-hosting
2 parents 807b080 + 4f6ff15 commit 56902c4

38 files changed

Lines changed: 187 additions & 187 deletions

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ node_modules
1818
next-example/
1919

2020
# Note: dist/ is NOT ignored - it's committed for GitHub installs
21-
# (npm install github:get-convex/self-hosting#main)
21+
# (npm install github:get-convex/static-hosting#main)

CLAUDE.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
44

55
## Project Overview
66

7-
A Convex component that enables self-hosting static React/Vite apps using Convex HTTP actions and file storage. Published as `@convex-dev/self-hosting` on npm.
7+
A Convex component that enables hosting static React/Vite apps using Convex HTTP actions and file storage. Published as `@convex-dev/static-hosting` on npm.
88

99
## Commands
1010

@@ -47,9 +47,9 @@ src/
4747

4848
### Package Exports
4949

50-
- `@convex-dev/self-hosting` - Client APIs (registerStaticRoutes, exposeUploadApi, etc.)
51-
- `@convex-dev/self-hosting/react` - React components (UpdateBanner, useDeploymentUpdates)
52-
- `@convex-dev/self-hosting/convex.config` - Component config for app.use()
50+
- `@convex-dev/static-hosting` - Client APIs (registerStaticRoutes, exposeUploadApi, etc.)
51+
- `@convex-dev/static-hosting/react` - React components (UpdateBanner, useDeploymentUpdates)
52+
- `@convex-dev/static-hosting/convex.config` - Component config for app.use()
5353

5454
### Deployment Mode
5555

CONVEX_STATIC_HOSTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Overview
44

5-
This implementation allows self-hosting static React/Vite apps using Convex HTTP actions and file storage, eliminating the need for Vercel or other hosting providers.
5+
This implementation allows hosting static React/Vite apps using Convex HTTP actions and file storage, eliminating the need for Vercel or other hosting providers.
66

77
## Architecture
88

@@ -443,7 +443,7 @@ For better performance, non-HTML static assets can be served from a CDN via [con
443443

444444
**Schema change**: The `staticAssets` table now supports both `storageId` (optional) and `blobId` (optional). An asset has either a `storageId` (Convex storage) or a `blobId` (CDN).
445445

446-
**Deploy command**: `npx @convex-dev/self-hosting deploy --cdn`
446+
**Deploy command**: `npx @convex-dev/static-hosting deploy --cdn`
447447

448448
See `INTEGRATION.md` for full CDN setup instructions.
449449

INTEGRATION.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
# Integration Guide: @convex-dev/self-hosting
1+
# Integration Guide: @convex-dev/static-hosting
22

3-
A Convex component that enables self-hosting static React/Vite apps using Convex HTTP actions and file storage. No external hosting provider required.
3+
A Convex component that enables hosting static React/Vite apps using Convex HTTP actions and file storage. No external hosting provider required.
44

55
## Quick Start
66

77
### Step 1: Install
88
```bash
9-
npm install @convex-dev/self-hosting
9+
npm install @convex-dev/static-hosting
1010
```
1111

1212
### Step 2: Setup (Choose One)
1313

1414
#### Option A: Automated Setup (Recommended)
1515
```bash
16-
npx @convex-dev/self-hosting setup
16+
npx @convex-dev/static-hosting setup
1717
```
1818
Interactive wizard that creates all necessary files.
1919

@@ -27,7 +27,7 @@ See Manual Setup section below.
2727
#### 1. convex/convex.config.ts
2828
```typescript
2929
import { defineApp } from "convex/server";
30-
import selfHosting from "@convex-dev/self-hosting/convex.config";
30+
import selfHosting from "@convex-dev/static-hosting/convex.config";
3131

3232
const app = defineApp();
3333
app.use(selfHosting);
@@ -41,7 +41,7 @@ import { components } from "./_generated/api";
4141
import {
4242
exposeUploadApi,
4343
exposeDeploymentQuery,
44-
} from "@convex-dev/self-hosting";
44+
} from "@convex-dev/static-hosting";
4545

4646
// Internal functions for secure uploads (CLI only)
4747
export const { generateUploadUrl, recordAsset, gcOldAssets, listAssets } =
@@ -55,7 +55,7 @@ export const { getCurrentDeployment } =
5555
#### 3. convex/http.ts
5656
```typescript
5757
import { httpRouter } from "convex/server";
58-
import { registerStaticRoutes } from "@convex-dev/self-hosting";
58+
import { registerStaticRoutes } from "@convex-dev/static-hosting";
5959
import { components } from "./_generated/api";
6060

6161
const http = httpRouter();
@@ -78,7 +78,7 @@ Add a deploy script for easy deployments:
7878
```json
7979
{
8080
"scripts": {
81-
"deploy": "npx @convex-dev/self-hosting deploy"
81+
"deploy": "npx @convex-dev/static-hosting deploy"
8282
}
8383
}
8484
```
@@ -87,28 +87,28 @@ Add a deploy script for easy deployments:
8787

8888
```bash
8989
# Interactive setup wizard
90-
npx @convex-dev/self-hosting setup
90+
npx @convex-dev/static-hosting setup
9191

9292
# One-shot deployment (backend + static files)
93-
npx @convex-dev/self-hosting deploy
93+
npx @convex-dev/static-hosting deploy
9494

9595
# Upload static files only (after building)
96-
npx @convex-dev/self-hosting upload --build --prod
96+
npx @convex-dev/static-hosting upload --build --prod
9797

9898
# Traditional two-step deployment
9999
npx convex deploy # Deploy backend
100-
npx @convex-dev/self-hosting upload --build --prod # Deploy static files
100+
npx @convex-dev/static-hosting upload --build --prod # Deploy static files
101101
```
102102

103103
## Deployment Workflow
104104

105105
### First Time Setup
106106
```bash
107107
# 1. Install
108-
npm install @convex-dev/self-hosting
108+
npm install @convex-dev/static-hosting
109109

110110
# 2. Run setup wizard
111-
npx @convex-dev/self-hosting setup
111+
npx @convex-dev/static-hosting setup
112112

113113
# 3. Initialize Convex (if not already done)
114114
npx convex dev --once
@@ -148,7 +148,7 @@ npm install convex-fs
148148
#### 2. convex/convex.config.ts
149149
```typescript
150150
import { defineApp } from "convex/server";
151-
import selfHosting from "@convex-dev/self-hosting/convex.config";
151+
import selfHosting from "@convex-dev/static-hosting/convex.config";
152152
import fs from "convex-fs/convex.config";
153153

154154
const app = defineApp();
@@ -161,7 +161,7 @@ export default app;
161161
#### 3. convex/http.ts
162162
```typescript
163163
import { httpRouter } from "convex/server";
164-
import { registerStaticRoutes } from "@convex-dev/self-hosting";
164+
import { registerStaticRoutes } from "@convex-dev/static-hosting";
165165
import { registerRoutes } from "convex-fs";
166166
import { components } from "./_generated/api";
167167

@@ -187,7 +187,7 @@ import { components } from "./_generated/api";
187187
import {
188188
exposeUploadApi,
189189
exposeDeploymentQuery,
190-
} from "@convex-dev/self-hosting";
190+
} from "@convex-dev/static-hosting";
191191
import { internalAction } from "./_generated/server";
192192
import { v } from "convex/values";
193193
import { del } from "convex-fs";
@@ -214,17 +214,17 @@ export const deleteCdnBlobs = internalAction({
214214
#### 5. Deploy with --cdn flag
215215
```bash
216216
# One-shot deployment with CDN
217-
npx @convex-dev/self-hosting deploy --cdn
217+
npx @convex-dev/static-hosting deploy --cdn
218218

219219
# Or upload only with CDN
220-
npx @convex-dev/self-hosting upload --cdn --prod
220+
npx @convex-dev/static-hosting upload --cdn --prod
221221
```
222222

223223
### CDN Deploy Script
224224
```json
225225
{
226226
"scripts": {
227-
"deploy": "npx @convex-dev/self-hosting deploy --cdn"
227+
"deploy": "npx @convex-dev/static-hosting deploy --cdn"
228228
}
229229
}
230230
```
@@ -235,7 +235,7 @@ Add a banner that notifies users when a new deployment is available:
235235

236236
```typescript
237237
// In your src/App.tsx or main component
238-
import { UpdateBanner } from "@convex-dev/self-hosting/react";
238+
import { UpdateBanner } from "@convex-dev/static-hosting/react";
239239
import { api } from "../convex/_generated/api";
240240

241241
function App() {
@@ -254,7 +254,7 @@ function App() {
254254

255255
Or use the hook for custom UI:
256256
```typescript
257-
import { useDeploymentUpdates } from "@convex-dev/self-hosting/react";
257+
import { useDeploymentUpdates } from "@convex-dev/static-hosting/react";
258258
import { api } from "../convex/_generated/api";
259259

260260
const { updateAvailable, reload, dismiss } = useDeploymentUpdates(
@@ -279,16 +279,16 @@ This means unauthorized users cannot upload files, even if they know your Convex
279279
Always use the `--build` flag when deploying:
280280
```bash
281281
# ✅ Correct - CLI sets VITE_CONVEX_URL for target environment
282-
npx @convex-dev/self-hosting deploy
282+
npx @convex-dev/static-hosting deploy
283283

284284
# ❌ Wrong - uses dev URL from .env.local
285-
npm run build && npx @convex-dev/self-hosting upload --prod
285+
npm run build && npx @convex-dev/static-hosting upload --prod
286286
```
287287

288288
### "Cannot find module convex.config"
289289
Make sure you've installed the package and it's listed in `package.json`:
290290
```bash
291-
npm install @convex-dev/self-hosting
291+
npm install @convex-dev/static-hosting
292292
```
293293

294294
### HTTP routes not working (404s)
@@ -298,7 +298,7 @@ npm install @convex-dev/self-hosting
298298
### Component name mismatch
299299
Default component name is `staticHosting`. If you named your file differently or used a different component name in config, specify it:
300300
```bash
301-
npx @convex-dev/self-hosting upload --component myCustomName
301+
npx @convex-dev/static-hosting upload --component myCustomName
302302
```
303303

304304
## API Reference
@@ -326,7 +326,7 @@ Browser-only function to derive Convex URL from `.convex.site` hostname.
326326

327327
**Usage**:
328328
```typescript
329-
import { getConvexUrl } from "@convex-dev/self-hosting";
329+
import { getConvexUrl } from "@convex-dev/static-hosting";
330330

331331
const convexUrl = import.meta.env.VITE_CONVEX_URL ?? getConvexUrl();
332332
```

README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# Convex Self Hosting
1+
# Convex Static Hosting
22

3-
[![npm version](https://badge.fury.io/js/@get-convex%2Fself-hosting.svg)](https://badge.fury.io/js/@convex-dev/self-hosting)
3+
[![npm version](https://badge.fury.io/js/@convex-dev%2Fstatic-hosting.svg)](https://badge.fury.io/js/@convex-dev/static-hosting)
44

5-
A Convex component that enables self-hosting static React/Vite apps using Convex
5+
A Convex component that enables hosting static React/Vite apps using Convex
66
HTTP actions and file storage. No external hosting provider required!
77

88
## Quick Start
99

1010
### Automated Setup (Recommended)
1111

1212
```bash
13-
npm install @convex-dev/self-hosting
14-
npx @convex-dev/self-hosting setup
13+
npm install @convex-dev/static-hosting
14+
npx @convex-dev/static-hosting setup
1515
```
1616

1717
The interactive wizard will:
@@ -55,14 +55,14 @@ https://github.com/user-attachments/assets/5eaf781f-87da-4292-9f96-38070c86cd39
5555
### 1. Install
5656

5757
```bash
58-
npm install @convex-dev/self-hosting
58+
npm install @convex-dev/static-hosting
5959
```
6060

6161
### 2. Add to your `convex/convex.config.ts`:
6262

6363
```ts
6464
import { defineApp } from "convex/server";
65-
import selfHosting from "@convex-dev/self-hosting/convex.config.js";
65+
import selfHosting from "@convex-dev/static-hosting/convex.config.js";
6666

6767
const app = defineApp();
6868
app.use(selfHosting);
@@ -76,7 +76,7 @@ Create or update `convex/http.ts` to serve static files:
7676

7777
```ts
7878
import { httpRouter } from "convex/server";
79-
import { registerStaticRoutes } from "@convex-dev/self-hosting";
79+
import { registerStaticRoutes } from "@convex-dev/static-hosting";
8080
import { components } from "./_generated/api";
8181

8282
const http = httpRouter();
@@ -92,7 +92,7 @@ export default http;
9292
Create a file like `convex/staticHosting.ts`:
9393

9494
```ts
95-
import { exposeUploadApi } from "@convex-dev/self-hosting";
95+
import { exposeUploadApi } from "@convex-dev/static-hosting";
9696
import { components } from "./_generated/api";
9797

9898
// These are INTERNAL functions - only callable via `npx convex run`
@@ -111,7 +111,7 @@ HTTP actions enabled", it means the Convex backend hasn't been deployed yet.
111111
{
112112
"scripts": {
113113
"build": "vite build",
114-
"deploy:static": "npx @convex-dev/self-hosting upload --build --prod"
114+
"deploy:static": "npx @convex-dev/static-hosting upload --build --prod"
115115
}
116116
}
117117
```
@@ -123,7 +123,7 @@ that would use the dev URL from `.env.local`.
123123
**CLI Options:**
124124

125125
```bash
126-
npx @convex-dev/self-hosting upload [options]
126+
npx @convex-dev/static-hosting upload [options]
127127

128128
Options:
129129
-d, --dist <path> Path to dist directory (default: ./dist)
@@ -138,10 +138,10 @@ Options:
138138

139139
```bash
140140
# Deploy to production with automatic build
141-
npx @convex-dev/self-hosting upload --build --prod
141+
npx @convex-dev/static-hosting upload --build --prod
142142

143143
# Deploy to dev (for testing)
144-
npx @convex-dev/self-hosting upload --build
144+
npx @convex-dev/static-hosting upload --build
145145
```
146146

147147
### Using Non-Vite Bundlers
@@ -186,7 +186,7 @@ Deploy both Convex backend and static files with a single command:
186186
npx convex login
187187

188188
# Deploy everything
189-
npx @convex-dev/self-hosting deploy
189+
npx @convex-dev/static-hosting deploy
190190
```
191191

192192
The `deploy` command:
@@ -199,7 +199,7 @@ This minimizes the inconsistency window between backend and frontend updates.
199199
**Deploy command options:**
200200

201201
```bash
202-
npx @convex-dev/self-hosting deploy [options]
202+
npx @convex-dev/static-hosting deploy [options]
203203

204204
Options:
205205
-d, --dist <path> Path to dist directory (default: ./dist)
@@ -214,7 +214,7 @@ Add to `package.json` for easy deployments:
214214
```json
215215
{
216216
"scripts": {
217-
"deploy": "npx @convex-dev/self-hosting deploy"
217+
"deploy": "npx @convex-dev/static-hosting deploy"
218218
}
219219
}
220220
```
@@ -228,7 +228,7 @@ If you prefer more control, deploy separately:
228228
npx convex deploy
229229

230230
# Deploy static files
231-
npx @convex-dev/self-hosting upload --build --prod
231+
npx @convex-dev/static-hosting upload --build --prod
232232
```
233233

234234
Your app is now live at `https://your-deployment.convex.site`
@@ -250,7 +250,7 @@ Connected clients can be notified when a new deployment is available:
250250
1. **Expose the deployment query**:
251251

252252
```ts
253-
import { exposeDeploymentQuery } from "@convex-dev/self-hosting";
253+
import { exposeDeploymentQuery } from "@convex-dev/static-hosting";
254254
import { components } from "./_generated/api";
255255

256256
export const { getCurrentDeployment } = exposeDeploymentQuery(
@@ -261,7 +261,7 @@ Connected clients can be notified when a new deployment is available:
261261
2. **Add the update banner to your app**:
262262

263263
```tsx
264-
import { UpdateBanner } from "@convex-dev/self-hosting/react";
264+
import { UpdateBanner } from "@convex-dev/static-hosting/react";
265265
import { api } from "../convex/_generated/api";
266266

267267
function App() {
@@ -281,7 +281,7 @@ Connected clients can be notified when a new deployment is available:
281281
Or use the hook for custom UI:
282282

283283
```tsx
284-
import { useDeploymentUpdates } from "@convex-dev/self-hosting/react";
284+
import { useDeploymentUpdates } from "@convex-dev/static-hosting/react";
285285

286286
const { updateAvailable, reload, dismiss } = useDeploymentUpdates(
287287
api.staticHosting.getCurrentDeployment,

0 commit comments

Comments
 (0)