{ "scripts": { "serve": "rasengan-serve ./dist" } }
PACKAGES
Rasengan Serve
@rasenganjs/serve is a simple utility to launch your Rasengan.js application in production mode. It serves the built application from the dist directory, ensuring a smooth and optimized deployment.
Installation
To use @rasenganjs/serve, install it as a dependency in your project:
npm install @rasenganjs/serve
Usage
After building your application with Rasengan.js, you can start the production server using the rasengan-serve command.
Start the production server
bash title="Terminal" npm run serve
This will start a server that serves your application from the dist folder.
Options
Currently, @rasenganjs/serve provides a default configuration for serving your built project. Future updates may include additional options for customization.
Custom port
You can specify a custom port for the server by using the -p or --port option:
npm run serve -- -p 3000
or
pnpm run serve -p 3000
The -p/--port option lets you replace the default port 4320 for the production server. You can also set a PORT environment variable instead; -p/--port takes priority over it if both are set. If the resolved port is already in use, @rasenganjs/serve automatically falls back to the next free one.
Bun Support
Introduced in v2.0.0-beta, @rasenganjs/serve can also run your app on Bun instead of Node.js. Set runtime: 'bun' in your rasengan.config.js:
import { defineConfig } from 'rasengan'; export default defineConfig({ runtime: 'bun', });
Then build and serve as usual, the exact same rasengan-serve ./dist command works for both runtimes:
npm run build npm run serve
rasengan-serve always starts under Node.js, but when it detects
runtime: 'bun' in your build it automatically re-executes itself under
bun before starting the server. No need to run bun rasengan-serve
yourself. You do need Bun installed on the machine (or container) running the command; if it isn't found on PATH, rasengan-serve prints a clear error instead of failing silently.
Community
Join the Rasengan.js community to get support, ask questions, and share your projects:
- GitHub Discussions : Ask questions and share ideas.
- X (Twitter) : Stay updated with the latest news.
- Linkedin : Follow the company page.
Let's build something amazing with Rasengan.js! 🚀
License
This package is MIT licensed.
