|
| 1 | +# Deploy with Zephyr Cloud |
| 2 | + |
| 3 | +[Zephyr Cloud](https://zephyr-cloud.io) is a zero-config deployment platform that integrates directly into your build process and provides global edge distribution for federated applications. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- **Automatic Deployment**: Automatically deploys your federated applications during the build process - simply save your code and get a URL in seconds. |
| 8 | +- **Multi-Bundler Support**: Works with Webpack, Vite, Rsbuild, and more. |
| 9 | +- **Bring Your Own Cloud (BYOC)**: Deploy using BYOC to any cloud provider. |
| 10 | +- **Advanced Deployment Management**: Manages complex multi-artifact deployments across different release cadences, handles micro frontend dependency management automatically, and provides version rollback and roll-forward capabilities. |
| 11 | + |
| 12 | +## How to deploy |
| 13 | + |
| 14 | +1. Install the Zephyr plugin for Rsbuild: |
| 15 | + |
| 16 | +```bash |
| 17 | +npm install zephyr-rsbuild-plugin --save-dev |
| 18 | +``` |
| 19 | + |
| 20 | +2. Add the plugin to your Rsbuild configuration: |
| 21 | + |
| 22 | +```js title="rsbuild.config.js" |
| 23 | +const { withZephyr } = require('zephyr-rsbuild-plugin'); |
| 24 | + |
| 25 | +module.exports = withZephyr()({ |
| 26 | + // your existing Rsbuild configuration |
| 27 | + entry: './src/index.js', |
| 28 | + output: { |
| 29 | + path: __dirname + '/dist', |
| 30 | + }, |
| 31 | + // ... rest of your config |
| 32 | +}); |
| 33 | +``` |
| 34 | + |
| 35 | +Or if you're using ES modules: |
| 36 | + |
| 37 | +```js title="rsbuild.config.mjs" |
| 38 | +import { withZephyr } from 'zephyr-rsbuild-plugin'; |
| 39 | + |
| 40 | +export default withZephyr()({ |
| 41 | + // your existing Rsbuild configuration |
| 42 | + entry: './src/index.js', |
| 43 | + output: { |
| 44 | + path: __dirname + '/dist', |
| 45 | + }, |
| 46 | + // ... rest of your config |
| 47 | +}); |
| 48 | +``` |
| 49 | + |
| 50 | +3. Build your project as usual: |
| 51 | + |
| 52 | +```bash |
| 53 | +npm run build |
| 54 | +``` |
| 55 | + |
| 56 | +During the build process, your application will be automatically deployed and you'll receive a deployment URL. Zephyr Cloud handles asset optimization, global CDN distribution, module federation setup, and provides automatic rollback capabilities. |
| 57 | + |
| 58 | +## Integration with Rsbuild |
| 59 | + |
| 60 | +Zephyr Cloud provides first-class support for Rsbuild applications, offering: |
| 61 | + |
| 62 | +- **Optimized Build Pipelines**: Specifically designed for Rsbuild's high-performance architecture |
| 63 | +- **Module Federation Support**: Enhanced module federation capabilities with automatic dependency resolution |
| 64 | +- **Asset Optimization**: Intelligent asset bundling and CDN distribution |
| 65 | +- **Development Integration**: Seamless integration with Rsbuild's development workflow |
| 66 | + |
| 67 | +## Installation |
| 68 | + |
| 69 | +```bash |
| 70 | +# npm |
| 71 | +npm install --save-dev zephyr-rsbuild-plugin |
| 72 | +``` |
| 73 | + |
| 74 | +## Usage |
| 75 | + |
| 76 | +### Basic Setup |
| 77 | + |
| 78 | +Add the plugin to your Rsbuild configuration: |
| 79 | + |
| 80 | +```js title="rsbuild.config.js" |
| 81 | +import { defineConfig } from '@rsbuild/core'; |
| 82 | +import { pluginReact } from '@rsbuild/plugin-react'; |
| 83 | +import { withZephyr } from 'zephyr-rsbuild-plugin'; |
| 84 | + |
| 85 | +export default defineConfig({ |
| 86 | + plugins: [ |
| 87 | + pluginReact(), |
| 88 | + withZephyr(), // Add Zephyr plugin |
| 89 | + ], |
| 90 | +}); |
| 91 | +``` |
| 92 | + |
| 93 | +### With Options |
| 94 | + |
| 95 | +```js title="rsbuild.config.js" |
| 96 | +import { defineConfig } from '@rsbuild/core'; |
| 97 | +import { pluginReact } from '@rsbuild/plugin-react'; |
| 98 | +import { withZephyr } from 'zephyr-rsbuild-plugin'; |
| 99 | + |
| 100 | +export default defineConfig({ |
| 101 | + plugins: [ |
| 102 | + pluginReact(), |
| 103 | + withZephyr({ |
| 104 | + wait_for_index_html: true, // Wait for HTML processing |
| 105 | + }), |
| 106 | + ], |
| 107 | +}); |
| 108 | +``` |
| 109 | + |
| 110 | +### TypeScript Configuration |
| 111 | + |
| 112 | +```ts title="rsbuild.config.ts" |
| 113 | +import { defineConfig } from '@rsbuild/core'; |
| 114 | +import { pluginReact } from '@rsbuild/plugin-react'; |
| 115 | +import { withZephyr } from 'zephyr-rsbuild-plugin'; |
| 116 | + |
| 117 | +export default defineConfig({ |
| 118 | + plugins: [pluginReact(), withZephyr()], |
| 119 | +}); |
| 120 | +``` |
| 121 | + |
| 122 | +### With Module Federation |
| 123 | + |
| 124 | +```ts title="rsbuild.config.ts" |
| 125 | +import { defineConfig } from '@rsbuild/core'; |
| 126 | +import { pluginReact } from '@rsbuild/plugin-react'; |
| 127 | +import { pluginModuleFederation } from '@module-federation/rsbuild-plugin'; |
| 128 | +import { withZephyr } from 'zephyr-rsbuild-plugin'; |
| 129 | + |
| 130 | +export default defineConfig({ |
| 131 | + plugins: [ |
| 132 | + pluginReact(), |
| 133 | + pluginModuleFederation({ |
| 134 | + name: 'my-app', |
| 135 | + remotes: { |
| 136 | + 'shared-ui': 'shared_ui@http://localhost:3001/remoteEntry.js', |
| 137 | + }, |
| 138 | + shared: { |
| 139 | + react: { singleton: true }, |
| 140 | + 'react-dom': { singleton: true }, |
| 141 | + }, |
| 142 | + }), |
| 143 | + withZephyr(), // Add after Module Federation |
| 144 | + ], |
| 145 | +}); |
| 146 | +``` |
| 147 | + |
| 148 | +## Getting Started |
| 149 | + |
| 150 | +1. Install the plugin in your Rsbuild project |
| 151 | +2. Add it to your Rsbuild configuration plugins array |
| 152 | +3. Configure Module Federation (if needed) for microfrontends |
| 153 | +4. Build your application with `npm run build` |
| 154 | +5. Your app will be automatically deployed to Zephyr Cloud |
| 155 | + |
| 156 | +Start for free today at [zephyr-cloud.io](https://zephyr-cloud.io). |
0 commit comments