Skip to main content

Introduction

Bun is a fast all-in-one JavaScript runtime & toolkit with built-in bundler, test runner, and Node.js-compatible package manager. This guide uses Hono, a lightweight and ultrafast web framework.

Prerequisites

  • a UNIX-like system (see WSL if you are using Windows), in order to use the Valyent CLI
  • a Valyent account, with a registered payment method (you can sign up here)
  • Bun installed on your machine

Installing the CLI

You can inspect the installation script here and the GitHub repository.

Authenticating

Initializing the project

First, let’s create a new directory and initialize a Bun project:
Install the required dependencies:
Create an index.ts file:
Now, initialize the valyent.toml configuration file:
This command will guide you through selecting or creating a project and an associated application.

Adding the Dockerfile

Create a Dockerfile:
Add the following content:

Deploy the project

To expose the application’s port, we need to set up a gateway (in this case, the port 3000):
Deploy your application to Valyent:
Then, you can type the following:
to open your application in the browser.