๐ A Fast and Lightweight React Server Components Framework for Bun
This project is still in very early development, and is currently meant to serve as a proof of concept. It is not recommended to use this in production.
Marz is built on top of Bun, so before you begin, make sure to follow Bun's installation guide.
Install Bun by following their installation guide, which can be found here.
Use the following command to create a Marz project using the interactive create-marz
CLI:
bun create marz
To start the Marz server, execute the following command:
bun dev
This command bundles all your pages and components and starts a server on port 3000.
Routing in Marz is determined by the file structure of your pages
directory. For example:
- A file at
pages/index.tsx
will be served at/
. - A file at
pages/about.tsx
will be served at/about
.
Each file is expected to export a named Page
component. Currently, all Page
components must be server components, but they can import and use client components. Parameters are supported (e.g., pages/[id].tsx
or pages/[id]/about.tsx
) and can be accessed via the params
prop on the Page
component.
If you encounter a "Duplicate export of ..."
error, run Marz with the MINIFY=true
environment variable set. This is caused by an issue in Bun.
Currently, the page may render twice. This behavior occurs because the server does not include RSC (React Server Components) hydration with the initial HTML response, so the browser also has to call out to /__marz
to re-render the page with RSC. This issue will be addressed in a future release.
Contributions are very welcome! This project is still in its early stages, so there are many ways to contribute. If you're interested in contributing, please join the Discord server and say hello ๐
- Leah Lundqvist (@hex2f)