Bun
Bun is the default runtime environment for Milkio. As a fast JavaScript runtime, it is compatible with Node.js and supports running TypeScript code directly.
Getting Started
When creating an application, choose bun
as the runtime environment.
Deployment Guide
You can deploy your application directly on a server, but we recommend using Kubernetes or some container-supported Serverless platforms. Examples include Google Cloud Run, AWS Lambda, etc.
Alternatively, you can explore Serverless platforms with custom runtimes like Cloudflare Workers or Vercel without using Bun. These platforms offer simpler deployment experiences compared to Kubernetes or container solutions. However, they often come with limitations in compatibility, such as not being able to utilize most Node.js or Bun functionalities.
Packaging
You can use the bun
command to package your application. Although Bun is designed as a JavaScript runtime, it maintains good compatibility with Node.js. Therefore, similar to using Node.js, it will execute the scripts in your /package.json
.
This command will automatically call the build
script defined in the scripts
section of your /package.json
. By default, the command looks like this:
After execution, a /dist
folder will be created in your project directory containing compressed and optimized code. Deploy all files in this directory to the server, then run the following command to start your application:
Deployment Using Docker
Docker is a virtual container. By writing a Dockerfile, we can package the code and environment into an image and run the image as a virtual container at any time.
This Dockerfile has been carefully optimized. Installing dependencies first and then copying the code can cache the dependency part, speeding up the image build process each time.