Host static React/Vite apps directly on Convex with built-in file storage, SPA routing, smart caching, and secure upload API.
npm install @convex-dev/static-hosting[integration guide](https://github.com/get-convex/static-hosting/blob/main/INTEGRATION.md)
๐ Simple deployment - Upload your built files directly to Convex storage
๐ Secure by default - Upload API uses internal functions (not publicly accessible)
๐ SPA support - Automatic fallback to index.html for client-side routing
โก Smart caching - Hashed assets get long-term caching, HTML is always fresh with ETag support
๐งน Auto cleanup - Old deployment files are automatically garbage collected
๐ฆ Zero config - Works out of the box with Vite, Create React App, and other bundlers
The @convex-dev/static-hosting component lets you upload your built React app directly to Convex storage and serve it through HTTP actions. It handles SPA routing by automatically falling back to index.html for client-side routes.
This component enables you to host your frontend and backend on the same Convex deployment. Upload your built static files to Convex storage and serve them through the component's HTTP actions, eliminating the need for separate hosting services.
The static-hosting component works out of the box with Vite builds. After running vite build, upload the dist folder contents to Convex storage using the component's secure upload API, and your app will be served with proper caching headers.
Yes, @convex-dev/static-hosting automatically handles SPA routing by falling back to index.html when a requested file isn't found in storage. This ensures client-side routes work correctly with React Router, Vue Router, and similar libraries.
The @convex-dev/static-hosting component implements smart caching where hashed assets (like bundle.abc123.js) get long-term cache headers, while HTML files are always served fresh with ETag support. This optimizes performance while ensuring users get the latest app version.
No, the @convex-dev/static-hosting component uses internal Convex functions for uploads, making them secure by default. Only your deployment process can upload files, not external clients or unauthorized users.
The @convex-dev/static-hosting component works with any bundler that generates static files, including Vite, Create React App, Next.js static export, Parcel, and Webpack. It requires zero configuration and handles standard build outputs automatically.