8000 GitHub - jeasx/jeasx: The power of server side rendering with the ease of JSX. · GitHub
[go: up one dir, main page]

Skip to content
jeasxPublic

About

The power of server side rendering with the ease of JSX.

Resources

Stars

138 stars

Watchers

3 watching

Forks

Repository files navigation

Jeasx - the ease of JSX with the power of SSR

npm license

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. Routing comes from your file structure.

It is built on Fastify, jsx-async-runtime and either esbuild or Bun as bundler.

This is the Jeasx core repository. For guides, examples and the project template, visit https://www.jeasx.dev. Live examples are at https://expo.jeasx.dev.

Development

npm install

The framework is plain JavaScript, so there is no build step. Types are written by hand: serverless.d.ts declares the default export and the fields Jeasx adds to FastifyRequest and FastifyReply. Keep it in sync when you change serverless.js.

To try out changes in a full app, use jeasx-develop, an ejected version of Jeasx Expo that runs the framework code directly in the project, so it's easy to change and test.

Tests

npm test   # Node.js
bun test   # Bun

The test suite uses the built-in test runners and needs no extra dependencies. Run it with both runtimes: under Bun, the CLI, the Bun bundler and serverless.js all run on Bun, so the same tests cover both platforms. Tests for the Bun bundler are skipped if bun isn't installed; tests for esbuild always run with Node.

Each test writes a small Jeasx project to test/.tmp (inside the repository, so the project resolves fastify and jsx-async-runtime from node_modules), builds it with the CLI and removes it afterwards. As serverless.js reads its configuration at startup, requests are sent from a separate process (test/support/inject.js) with the project as working directory. Most routing tests run twice, against the production build and in development mode.

File Covers
routing.test.js Route resolution, guards, this context, response types, path checks
jsx.test.js JSX rendering, streaming, response handlers, errors while streaming
static.test.js Static files from public and dist, caching headers, ranges, dotfiles
patterns.test.js Common patterns of Jeasx apps
cli.test.js CLI commands and the manifest
bundle-esbuild.test.js esbuild bundling (always with Node)
bundle-bun.test.js Bun bundling (skipped without Bun)
env.test.js Loading of .env files
server.test.js jeasx start and jeasx dev on real ports, use from other servers

License

MIT © Maik Jablonski

About

The power of server side rendering with the ease of JSX.

Resources

Stars

138 stars

Watchers

3 watching

Forks

Releases

Used by

Contributors

Languages

0