A short introduction to Jeasx: what it is, how routes and components work, and how to get started.
What is Jeasx?
Jeasx is a server-side rendering framework for Node.js and Bun. You write pages and API endpoints as async JSX functions, and Jeasx renders them on the server and streams the HTML to the browser. It is built on Fastify, jsx-async-runtime, and esbuild or Bun as bundler.
Routes
Routing comes from your file structure: every file in src whose name is in brackets is a route.
Pages and endpoints
src/blog/[index].jsx answers /blog, and src/blog/[feed].jsx answers /blog/feed. A route returns JSX for an HTML page, or any other payload, like JSON for an API.
Guards
A [...guard].js runs before all routes in its folder and below. It can check a login, load data for the routes, or answer the request itself, like with a redirect.
Components
Components are plain functions that return JSX, with a few extras on the server.
Async components
A component can be async and simply await its data: a database query, an API call or a file. No hooks or loaders needed.
The this context
All components of a request share one this object. Put the request, the current user or settings on it, and every component can read them without passing props down.
Streaming
The HTML is sent while it renders. The browser shows the top of the page while slow parts further down are still loading.
In the browser
Most pages need little JavaScript. When they do, use what you like: plain scripts, HTMX, Alpine, or islands built with React, Vue or Svelte.
Scripts and styles
An index.js or index.css next to your routes is bundled for the browser, so each page loads only the code it needs.
Getting started
npm run devstarts the development server, which rebuilds on every change.npm run buildbundles the app for production.npm startruns the built app.