Vite Edge Side Rendering (ESR) framework for Vue and React, or bring your own view library.
What's ESR? Think of SSR (Server Side Rendering) in CDN nodes instead of actual servers. This is possible today thanks to Cloudflare Workers (and maybe some other platforms in the near future).
Vitedge is just a Vite app ™ that prerenders the first view in an edge worker and runs the rest as an SPA. That means it will lead to good SEO while keeping the snappy routing and DX of an SPA.
It can replace static site generators in some situations since it builds on the fly and caches at the edge. Therefore, instead of getting a static index.html
from the CDN, the CDN itself will create it on the fly or provide it from cache if it was already accessed (with configurable cache age + stale-while-revalidate).
Even though running it at the edge is ideal, it is actually compatible with any Node environment such as Vercel or Netlify.
See live demo, and Vue or React starter templates. If you want to bring your own view library, have a look at the Vanilla JS example as a guide.
- ⚡ Ultrafast development and HMR powered by Vite and ES Modules.
- ⚔️ Renders and caches at the edge for maximum performance in production. Cache is configurable.
- 💁♂️ Each page gets its server data as props by default but can be set in a store instead.
- 🔽 HTTP/2 server push for your assets to speed up the loading time without waterfall requests.
- 🧱 Automatically creates endpoints for your API based on filesystem routes.
See docs.
To talk about Vitedge, join ViteLand Discord and check #vitedge
channel or use GitHub's Discussions.
- Support TypeScript projects.
- Custom Vite dev-server that serves API/Props during development.
- Docs website.
- Extract CF worker boilerplate as utilities.
- Cache props/html in worker and make it configurable.
- i18n compatible.
- Starter template.
- Auth utilities/guide (passing JWT in requests as cookies).
- Compatibility with Node runtime for other providers (Vercel/Netlify...).
- Add example using Vercel's edge cache.
- Detect imported files in HTML and push them with HTTP/2.
- Add an SSR mode for local development (web worker?).
- Support GraphQL, sitemap and other dynamic endpoints.
- React compatibility.
- Provide React starter template.
- Support Vite 2.
- HMR for API side.
- Page props HMR in browser on file save.
- Preload assets using Vite's manifest.
- Support self-requests to API endpoints during SSR.
- Support parameters and wildcards in API file routes (
api/path/[param].js
). - Stale-while-revalidate cache for pages.
- CORS defaults.
- Throw errors from API/Props endpoints.
- Redirects with 3xx HTTP codes.
- Mockup KV and cache in development.
- Mockup DO in development.
- Rewrite in TypeScript.
- Guide to bring your own view framework.
- Preview mode to simulate Worker environment in development.
- Support Wrangler v2.
- Deploy to fullstack Cloudflare Pages.
- Streaming mode.
- Support React 18
See contributing guide.