Get started

What do you want to start with?

Start from scratch

In this section we will walk you through what you will need to start using Zephyr and enjoy its benefits by deploying an application through Zephyr and modifying configuration. We will start with installing and creating your account, then create a standalone React app. At the end of this guide, you will have your first React app deployed to Zephyr's managed cloud with Rspack as bundler and use our version control feature to preview all versions that's deployed.

If you are curious to read more about us, you can dive into our architecture, recipes (for more frameworks and bundlers) and features. Below guide is written based on Google Chrome thus other browser's behavior might differ (see a list of supported browsers)

Setup

Known issue on Managed Cloud VS. Cloud Provider

Because of Cloudflare Caching, the time to propagate deployed assets (for deployment to be visible) might take from within one minute to an hour and the timing is non-deterministic.

This is a known issue we are still investigating and seeking for improvements.

Issue might be happening to:

  • Our managed cloud (Cloudflare)
  • Customer's custom deployment provider if customers are using Cloudflare.

If you are following the get started guide without custom deployment provider you will be using our managed cloud.

Read more about how to configure Cloudflare and how to configure Netlify as your default cloud provider.

1. Create a react app

Prerequisites

If you don't have nvm to manage your node version yet, head to the official nvm guide to install it.

1nvm use 20

Once the prerequisites are fulfilled, we can start scaffolding our application in the terminal:

npm
yarn
pnpm
bun
1npm create rspack@latest
1pnpm create rspack@latest
TIP

If you are using our managed cloud (Cloudflare) or custom deployment integration through Cloudflare, when you are adding assets, naming your application in package.json or module federation configuration, make sure the name doesn't include capital letter to avoid query problem with Cloudflare.

The creation process will ask you for project folder name and project template, we will be choosing react in this example:

1.../Library/pnpm/store/v3/tmp/dlx-74427  |  +20 ++
2.../Library/pnpm/store/v3/tmp/dlx-74427  | Progress: resolved 20, reused 20, downloaded 0, added 20, done
3✔ Project folder … rspack-project
4? Project template › - Use arrow-keys. Return to submit.
5❯    react
6    react-ts
7    vue
8    vue-ts

Press

Enter
, enter the project directory:

npm
yarn
pnpm
bun
1npm install

Follow the console output to open the app in browser running on localhost.

2. Adding Zephyr

Open the project folder we created with code editor of your choice. Within current working directory, install Zephyr's plugin by running:

npm
yarn
pnpm
bun
1npm i zephyr-webpack-plugin

After install the plugin, open the file rspack.config.ts in project root and replace the original configuration as below:

rspack.config.mjs
1import { dirname } from "node:path";
2import { fileURLToPath } from "node:url";
3import { rspack } from "@rspack/core";
4import RefreshPlugin from "@rspack/plugin-react-refresh";
5import { withZephyr } from "zephyr-webpack-plugin";
6
7const __dirname = dirname(fileURLToPath(import.meta.url));
8const isDev = process.env.NODE_ENV === "development";
9
10export default withZephyr()({
11	context: __dirname,
12	entry: {
13		main: "./src/main.jsx"
14	},
15	resolve: {
16		extensions: ["...", ".ts", ".tsx", ".jsx"]
17	},
18	module: {
19		rules: [
20			{
21				test: /\.svg$/,
22				type: "asset"
23			},
24			{
25				test: /\.(jsx?|tsx?)$/,
26				use: [
27					{
28						loader: "builtin:swc-loader",
29						options: {
30							jsc: {
31								parser: {
32									syntax: "typescript",
33									tsx: true
34								},
35								transform: {
36									react: {
37										runtime: "automatic",
38										development: isDev,
39										refresh: isDev
40									}
41								}
42							},
43							env: {
44								targets: [
45									"chrome >= 87",
46									"edge >= 88",
47									"firefox >= 78",
48									"safari >= 14"
49								]
50							}
51						}
52					}
53				]
54			}
55		]
56	},
57	plugins: [
58		new rspack.DefinePlugin({
59			"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV)
60		}),
61		new rspack.ProgressPlugin({}),
62		new rspack.HtmlRspackPlugin({
63			template: "./index.html"
64		}),
65		isDev ? new RefreshPlugin() : null
66	].filter(Boolean),
67	experiments: {
68		css: true
69	}
70});

3. Git configuration

The next step is configure the git configuration for your project.

Why do you need this step

Behind the scene, we map your git configuration to Zephyr (remote origin url, organization or username, repository name and branch) to deploy your application. Without this step your deployment will fail.

  • 1. Create a new repository on Github

Click here to create a new repository named rspack-project on Github. Choosing either Private or Public won't affect our deployment. And then click on Create repository.

  • 2. Configure remote origin url

On the next page where your repository has been created on Github, copy paste the command lines under ...or create a new repository on the command line and execute them in terminal within the project.

4. First build and deploy

After we finished configuring the project, within your terminal run:

npm
yarn
pnpm
bun
1npm run build

If you haven't register an account with us, or you haven't sign in for a while, your default browser will pop up and prompt you to sign up to our dashboard. If you already have an account or signed in recently, the browser will notify that you already signed in.

Within the terminal you should see your deployed URL. Press

Command
and click on the URL at the same time to open your deployed URL in your default browser.

INFO

Note that this URL will live as long you don't delete your account and you can share it with anyone to preview it. We will discuss how and where you can find your deployed URL within our platform next.

Chrome Extension

You can check the application you just deployed in our chrome extension and you can preview every version of the application you deploy.

Head to Chrome Web Store to install our chrome extension - Zephyr Mission Control. Click on Add to Chrome and confirm with Add extension. After you finish remember to pin the extension by clicking on on extension management tab to provide you a quicker access to Zephyr's side panel.

Once you click on the side panel will pop up and prompt you to log in. You might need to right click on the extension and choose Open Side Panel if you are using it for the first time.

What happens when you log in?

While we are loggin you in, we are storing your authorization information locally under ~/.zephyr in your root directly. Whenever you want to clean up your local profile information (they are JWT claims for each of the project you deployed through Zephyr), you can enter your root directory in terminal and run:

1rm rf ~/.zephyr

Open your side panel by clicking on . Note that this URL is alive as long you don't delete your account and you can share it with anyone to preview it.

Every application you have deployed on Zephyr (under the same account) will be displayed under Name, categorized by repository name and their package name. Click on the dropdown menu under Version you will see the versions of your app. Items under Tags denotate the tag rules of this application, both auto generated by us or set up by you.

5. Deploy a new version

Now you have deployed the first version, let's add modify the app and deploy a new version. Open the file src/App.jsx to change the content of your website:

src/App.jsx
1import React from "react";
2import { useState } from "react";
3import reactLogo from "./assets/react.svg";
4import "./App.css";
5
6function App() {
7	const [count, setCount] = useState(0);
8
9	return (
10		<div className="App">
11			<div>
12				<a href="https://reactjs.org" target="_blank" rel="noreferrer">
13					<img src={reactLogo} className="logo react" alt="React logo" />
14				</a>
15			</div>
16			<h1>Rspack + React + Zephyr</h1>
17			<div className="card">
18				<button onClick={() => setCount(count => count + 1)}>
19					count is {count}
20				</button>
21				<p>
22					Edit <code>src/App.jsx</code> and save to test HMR
23				</p>
24			</div>
25			<p className="read-the-docs">
26				Click on the Rspack and React logos to learn more
27			</p>
28		</div>
29	);
30}
31
32export default App;

Next in your terminal run:

npm
yarn
pnpm
bun
1npm run build

The console output will return the latest deployed URL. On Chrome ChromeExtension, the latest deployed version will be under Version dropdown in as the first option. You should see the app's heading is changed to Rspack + React + Zephyr

Now the latest version of your app is deployed. You can check the source code till this stage here:

Version name

The names of your versions are generated by Zephyr. The first part of the name is the branch name, serialised version of your email, followed by the version number.

6. Using Chrome Extension

Once you have deployed a new version of your application, the latest deployed version will show up in browser as soon as you select it under Name.

INFO

Our chrome extension is only supported on Chromium based browsers. See a list of supported browser.

7. Dashboard

If you want to see all your projects and their versions, sign in on dashboard and you will see all your projects and their dependencies.

More detailed explaination on how to use our dashboard is coming soon.