DevLog #4
I’ve built x (@thexjs), a single-process, full-stack React framework which runs native on Bun.
Project’s on StarDance: https://stardance.hackclub.com/home
Why
Next.js and the other tools come with Webpack or Vite, together with a development server and a lot of additional abstractions. Bun has already incorporated transpiling, bundling, package management, and native HTTP support , it even includes support for SQLite and Postgres. Which is why, rather than wrapping React around another bundler, I have built it to work directly with what Bun already provides.
What it does
The system is based on files just place a .tsx file in the src/pages/ directory and it becomes a route. Each route individually chooses whether to use SSR or static pre-rendering (by using the statement export const mode = “static”). The API routes are located in src/api/ and share their memory and database context with the rest of the application. Server functions enable you to call type-safe backend logic directly from within a component.
Regarding security, there is build-time leak detection based on AST so that secrets won’t end up in the client bundles, together with CSRF protection and rate limiting built in. For use in production, /healthz and /readyz are provided, along with JSON logging and support for OpenTelemetry and Sentry. The application can be deployed to a VPS, using Docker, or on Vercel via @thexjs/adapter-vercel.
Quickstart
bash
bun create thexjs-app@latest my-app
cd my-app
bun run dev
You get a working app in less than a minute.
Link: https://github.com/abdelkabirouadoukou/x
If you look around and happen upon anything that’s broken, then open an issue I’ll look into it.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.