π A Fast and Lightweight React Server Components Framework for Bun
Disclaimer
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.
Getting Started
Marz is built on top of Bun, so before you begin, make sure to follow Bun's installation guide.
Step 1: Install Bun
Install Bun by following their installation guide, which can be found here.
Step 2: Create Marz
Use the following command to create a Marz project using the interactive create-marz
CLI:
bun create marz
Step 3: Run the Server
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.
Step 4: Define Routes
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.
Known Issues
Issue 1: Duplicate Export Error
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.
Issue 2: Page Renders Twice
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.
Contributing
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 π
Authors
- Leah Lundqvist (@hex2f)