Bun Hot Reload Not Working – 3 Fixes

Is hot reloading not working in your bun.js project? This article gives you 3 potential fixes (from a real developer). First of all there are 2 ways you can hot reload code in your project: The first one, –hot, watches your files for changes and only reloads the content. It DOES NOT restart the bun … Read more

How to Use Files in Bun JS

Bun comes with its own modules for handling file read and writes. Let’s whip up a simple server that allows us to see this in action. Read a File with Bun Initialise a new server and paste in the following code to your index.ts file: This will read an index.html file off disk and return … Read more

Environment Variables in Bun JS (bun env)

Bun JS, like all other server side tech, comes with the ability to read environment variables from files. Environment files in your project root directory are read in this particular order: Note that for item 2 bun will first read from variable NODE_ENV, to decide which one to select. You can also manually override which … Read more

Express Server with Email Password Auth

Introduction The FIRST thing you do with any app is to create authentication for it, after all you will have users and they will need accounts! In this article I will show you the basic idea with a standalone one file express server. We will use several popular off the shelf libraries such as express … Read more

Simple Express Server in 2 Minutes

Creating a basic server in Express.js is very straightforward. Express.js is a minimal and flexible Node.js web application framework that provides a robust set of features to develop web and mobile applications. To create a basic server, follow these steps: Your server will start, and you should see the message “Server is running at http://localhost:3000” … Read more

How to Add NPM Packages in Bun JS

Bun JS has an insanely fast package installer which is one great reason to upgrade to it over Node! To install a package in bun simply use: For example, install figlet (ASCII art) and its typings:

Bun js Hot Reload – Full Guide

Bun incudes 2 very handy flags that will watch your project for file changes. I also cover this in my bun Elysia course. 1. Reload with the –watch flag This is used in the command to run your server, eg: If a files contents change within your project folder then bun will cold reload your … Read more

How to Create a Server in native Bun JS

Note that these instructions are for installing on Mac. Linux or WSL on Windows. Native Windows is experimental at this point (2023) so best to avoid it for now. Open up a folder in VS Code where your project will live. Open up a terminal within VS Code and enter: This will install bun for … Read more