Close Menu
Soshace Digital Blog

    Subscribe to Updates

    Get The Latest News, Updates, And Amazing Offers

    What's Hot
    Beginners

    Everything You Wanted to Know about the UX Research Methods

    React

    Creating Mock API using Mirage in a React application

    Programming

    Уроки React. Урок 3

    Important Pages:
    • Home
    • About
    • Services
    • Contact Us
    • Privacy Policy
    • Terms & Conditions
    Facebook X (Twitter) Instagram LinkedIn YouTube
    Today's Picks:
    • Scaling Success: Monitoring Indexation of Programmatic SEO Content
    • Leveraging Influencers: Key Drivers in New Product Launches
    • How Privacy-First Marketing Will Transform the Industry Landscape
    • The Impact of Social Proof on Thought Leadership Marketing
    • Balancing Value-Driven Content and Promotional Messaging Strategies
    • Top Influencer Marketing Platforms to Explore in 2025
    • Emerging Trends in Marketing Automation and AI Tools for 2023
    • Strategies to Mitigate Duplicate Content in Programmatic SEO
    Wednesday, September 10
    Facebook X (Twitter) Instagram LinkedIn YouTube
    Soshace Digital Blog
    • Home
    • About
    • Services
    • Contact Us
    • Privacy Policy
    • Terms & Conditions
    Services
    • SaaS & Tech

      Maximizing Efficiency: How SaaS Lowers IT Infrastructure Costs

      August 27, 2025

      Navigating Tomorrow: Innovations Shaping the Future of SaaS

      August 27, 2025

      Maximizing Impact: Strategies for SaaS & Technology Marketing

      August 27, 2025
    • AI & Automation

      Enhancing Customer Feedback Analysis Through AI Innovations

      August 27, 2025

      Navigating the Impact of AI on SEO and Search Rankings

      August 27, 2025

      5 Automation Hacks Every Home Service Business Needs to Know

      May 3, 2025
    • Finance & Fintech

      Critical Missteps in Finance Marketing: What to Avoid

      August 27, 2025

      Analyzing Future Fintech Marketing Trends: Insights Ahead

      August 27, 2025

      Navigating the Complex Landscape of Finance and Fintech Marketing

      August 27, 2025
    • Legal & Compliance

      Exploring Thought Leadership’s Impact on Legal Marketing

      August 27, 2025

      Maximizing LinkedIn: Strategies for Legal and Compliance Marketing

      August 27, 2025

      Why Transparency Matters in Legal Advertising Practices

      August 27, 2025
    • Medical Marketing

      Enhancing Online Reputation Management in Hospitals: A Guide

      August 27, 2025

      Analyzing Emerging Trends in Health and Medical Marketing

      August 27, 2025

      Exploring Innovative Content Ideas for Wellness Blogs and Clinics

      August 27, 2025
    • E-commerce & Retail

      Strategic Seasonal Campaign Concepts for Online and Retail Markets

      August 27, 2025

      Emerging Trends in E-commerce and Retail Marketing Strategies

      August 27, 2025

      Maximizing Revenue: The Advantages of Affiliate Marketing for E-Commerce

      August 27, 2025
    • Influencer & Community

      Leveraging Influencers: Key Drivers in New Product Launches

      August 27, 2025

      Top Influencer Marketing Platforms to Explore in 2025

      August 27, 2025

      Key Strategies for Successful Influencer Partnership Negotiations

      August 27, 2025
    • Content & Leadership

      The Impact of Social Proof on Thought Leadership Marketing

      August 27, 2025

      Balancing Value-Driven Content and Promotional Messaging Strategies

      August 27, 2025

      Analyzing Storytelling’s Impact on Content Marketing Effectiveness

      August 27, 2025
    • SEO & Analytics

      Scaling Success: Monitoring Indexation of Programmatic SEO Content

      August 27, 2025

      Strategies to Mitigate Duplicate Content in Programmatic SEO

      August 27, 2025

      Effective Data Visualization Techniques for SEO Reporting

      August 27, 2025
    • Marketing Trends

      How Privacy-First Marketing Will Transform the Industry Landscape

      August 27, 2025

      Emerging Trends in Marketing Automation and AI Tools for 2023

      August 27, 2025

      Maximizing ROI: Key Trends in Paid Social Advertising

      August 27, 2025
    Soshace Digital Blog
    Blog / JavaScript / React / Bootstrap your next Preact application with Bun
    JavaScript

    Bootstrap your next Preact application with Bun

    peterBy peterMarch 25, 2023Updated:May 26, 2024No Comments7 Mins Read
    Facebook Twitter Pinterest Telegram LinkedIn Tumblr Email Reddit
    Bootstrap your next Preact application with Bun
    Share
    Facebook Twitter LinkedIn Pinterest Email Copy Link
    Bootstrap your next Preact application with Bun
    Bootstrap your next Preact application with Bun

    Introduction

    In recent times, runtimes like Node.js and Deno have increased in popularity due to their role in revolutionizing the JavaScript ecosystem. However, there is also increased consideration for speed and native features that the runtimes provide, as they aren’t as fast and also do not provide native features for certain actions like bundling, transpiling, and package management. These considerations pushed Jarred Sumner, an ex-software engineer at Stripe, and his team to build a highly fast and performant runtime called Bun, which caters to most of these considerations. In this article, I will illustrate the power of Bun by bootstrapping a Preact application using Bun.

    The History of Runtimes

    Before diving into what Bun entails, we will go through the history of runtimes. Traditionally, JavaScript was made to run in the browser. This was the paradigm until 2009 when a developer named Ryan Dahl eventually began developing a tool named Node.js that would allow JavaScript to run outside of the browser. He chose the V8 engine, which was used by Google’s Chromium to power this tool. This development revolutionized JavaScript as Node.js grew in popularity, becoming a vital tool in frontend and backend web development. Node.js drove many modern JavaScript standards like ES modules, fetch API, etc., that did not exist before its creation. However, in order to utilize the full capabilities of Node.js, like working with typescript, a superset of the JavaScript language, bundling, and transpiling, you will have to utilize third-party tools like Webpack and Babel, as Node.js wasn’t shipped with these features natively, and also, its package management system and module system weren’t as efficient as envisioned. This was Ryan Dahl’s concern when he left the Node.js project in 2012 and began developing Deno, a Node.js successor written in Rust. Deno provided faster performance, support for web standards, first-rate TypeScript (native support), and JSX support but didn’t include package management, as Deno manages dependencies using URLs. and by doing so, external modules are imported directly into local modules.

    However, these runtimes were built using Chromium v8 engines, which have some performance pitfalls like slow startup times and memory management, amongst others. There have been efforts to create runtimes that offer increased speed and performance, and that led to the creation of Bun.

    What is Bun

    Bun is a JavaScript runtime that was built to offer increased speed and performance as well as features like bundling, transpiling, and package management natively. It is written in the Zig programming language and it employs the JavaScript Core engine created by Apple for Safari. The majority of Bun was written from scratch, including its NPM, SQLite, HTTP, and WebSocket clients, as well as its JSX/TypeScript transpiler.
    Bun’s speed is due to the fact that it uses JavaScript Core as its core engine, unlike its counterparts, Node.js and Deno, which use the V8 Engine. Some of the advantages of the JavaScript Core engine include:

    • prioritizing increase in the speed of startup times, as compared to V8 which prioritizes fast execution.
    • Possession of three optimizing compilers which makes it much more complex but faster, as compared to V8 which only has two compilers with less consideration on speed but on ease of use.
    Read More:  React Lesson 6: CSS and Animation

    Installing Bun

    Before bootstrapping our application, we will install Bun. To install Bun for MacOS, Windows, or Linux, run the command below:

    curl -fsSL https://bun.sh/install | bash
    
    

    For macOS users, After running the command above, run this command below:

    exec /bin/zsh
    
    

    Bootstrapping our Application

    Let’s look at how to set up a Preact application with Bun in this section. First, ensure that you have the Bun runtime installed. To do so, enter the command:

    bun --version
    
    

    Typing this command will display the bun version. To get more information on the commands available in bun enter the command below:

    bun --help
    
    

    Typing this command will display some helpful information about the commands that bun provides.

    Commands that bun provides
    Commands that bun provides

    Next, we will create a Preact application using the create command displayed above. Type the command below:

    bun create
    
    

    On typing this command, it displays some commands to create projects of different types, like a React project, an Apollo Server project, a svelte project, and many more.

    Commands to create projects of different types
    Commands to create projects of different types

    We will choose the method for developing a Preact application. To create a Preact app, type the command below:

    bun create preact <name of app>
    cd <name of app>
    
    

    On installing the app, you can start a development server of the application with the following command:

    bun dev
    
    

    On running the command, it will launch the preact application at localhost:3000

    Preact application at localhost:3000

    Preact application at localhost:3000You can also build your application for production with the following command:

    bun build
    
    

    Features of Bun:

    1- Bun as a package manager

    As described previously, Bun can be used as a package manager as it supports it natively. In order to install packages with Bun, You must have Bun installed on your system and a project already set up with Bun.  The Bun install command is represented below:

    bun install
    
    

    To add a specific package to your project, type the command below:

    bun add <package name>
    
    

    To delete a specific package from your project, type the command below

    bun remove <package name>
    
    

    2- Bun as a fast Runtime

    Because Bun employs the JavaScript Core engine, which is said to be faster than the v8 engine used by its counterparts(Node and Deno), it outperforms them in the speed of bundling, transpiling, and installing packages. In order to ascertain these claims,  let’s compare the speed of creating a new preact app using Bun and the default preact-cli method. Let’s begin.

    Read More:  React Lesson 2: Homework Assignment

    Firstly, we will start with creating a preact app with Bun. Navigate to your project directory and run the following command:

    bun create preact <name of app>
    
    

    Installation of a Preact app using Bun took less than 4 seconds, as shown in the picture below:

    Installation of a Preact app using Bun
    Installation of a Preact app using Bun

    Next, we will start with creating a Preact app with the preact-cli method. Navigate to your project directory and run the following command:

    npx preact-cli create default <name of app>
    
    

    Installation of a Preact app using the preact-cli method took about a minute, as shown in the picture below:

    Installation of a Preact app using the preact-cli method
    Installation of a Preact app using the preact-cli method

    From the test above, we can see that installing a Preact application with Bun proved to be much faster than using the preact-cli method.For more information, you can look at this GitHub repository, which contains a number of benchmark tests that you can run on Bun.

    Reference Links

    – https://medium.com/@gemma.croad/understanding-the-javascript-runtime-environment-4dd8f52f6fca
    – https://hackernoon.com/why-deno-could-replace-node
    – https://bun.sh/
    – https://www.makeuseof.com/what-is-bunjs-why-the-javascript-community-excited/
    – https://levelup.gitconnected.com/is-bun-js-the-node-js-killer-ffeb0f89196a

    Conclusion

    In this tutorial, we learned about the Bun runtime, how to install it, how to create a Preact app, and how to install and remove packages using Bun. We also did some tests to showcase the awesome features that Bun provides. That being said, I hope this article was able to convince you to bootstrap your next project using Bun and to take advantage of the awesome features that this new runtime provides.

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    peter

      Related Posts

      Streamlining Resource Allocation for Enhanced Project Success

      December 18, 2024

      Conducting Effective Post-Project Evaluations: A Guide

      December 16, 2024

      Strategies for Keeping Projects on Track and Meeting Deadlines

      December 10, 2024
      Leave A Reply Cancel Reply

      You must be logged in to post a comment.

      Stay In Touch
      • Facebook
      • Twitter
      • Pinterest
      • Instagram
      • YouTube
      • Vimeo
      Don't Miss
      Interview January 11, 2018

      Interview with Iskander

      My name is Iskander and I am a full-stack developer with more than 4 years of experience in developing web applications.
      For frontend development, I use Angular and React/Redux. At the backend, I work with Node.js and Java.

      Node.js Lesson 11: Echo Server

      November 26, 2020

      Роли внутри проектов

      March 18, 2016

      React Lesson 10: Normalize Data with Immutable.js

      March 9, 2020

      Categories

      • AI & Automation
      • Angular
      • ASP.NET
      • AWS
      • B2B Leads
      • Beginners
      • Blogs
      • Business Growth
      • Case Studies
      • Comics
      • Consultation
      • Content & Leadership
      • CSS
      • Development
      • Django
      • E-commerce & Retail
      • Entrepreneurs
      • Entrepreneurship
      • Events
      • Express.js
      • Facebook Ads
      • Finance & Fintech
      • Flask
      • Flutter
      • Franchising
      • Funnel Strategy
      • Git
      • GraphQL
      • Home Services Marketing
      • Influencer & Community
      • Interview
      • Java
      • Java Spring
      • JavaScript
      • Job
      • Laravel
      • Lead Generation
      • Legal & Compliance
      • LinkedIn
      • Machine Learning
      • Marketing Trends
      • Medical Marketing
      • MSP Lead Generation
      • MSP Marketing
      • NestJS
      • Next.js
      • Node.js
      • Node.js Lessons
      • Paid Advertising
      • PHP
      • Podcasts
      • POS Tutorial
      • Programming
      • Programming
      • Python
      • React
      • React Lessons
      • React Native
      • React Native Lessons
      • Recruitment
      • Remote Job
      • SaaS & Tech
      • SEO & Analytics
      • Soshace
      • Startups
      • Swarm Intelligence
      • Tips
      • Trends
      • Vue
      • Wiki
      • WordPress
      Top Posts

      14. Уроки Node.js. Отладка скриптов. Часть 2.

      Programming September 29, 2016

      Essential Tips on How to Become a Full Stack Developer

      Programming October 5, 2019

      How to send multiple forms with Ajax (FormData) in Django

      Python September 16, 2020

      Learn JavaScript and React with the TOP JavaScript YouTube Channels

      JavaScript May 16, 2019

      Subscribe to Updates

      Get The Latest News, Updates, And Amazing Offers

      About Us
      About Us

      Soshace Digital delivers comprehensive web design and development solutions tailored to your business objectives. Your website will be meticulously designed and developed by our team of seasoned professionals, who combine creative expertise with technical excellence to transform your vision into a high-impact, user-centric digital experience that elevates your brand and drives measurable results.

      7901 4th St N, Suite 28690
      Saint Petersburg, FL 33702-4305
      Phone: 1(877)SOSHACE

      Facebook X (Twitter) Instagram Pinterest YouTube LinkedIn
      Our Picks
      Franchising

      A Guide to HR Developing Performance Goals

      AI & Automation

      Enhancing Customer Feedback Analysis Through AI Innovations

      JavaScript

      AI in Recruitment: Cases and Trends

      Most Popular

      Optimizing LinkedIn Lead Generation: Seamless CRM Integration

      LinkedIn

      Agile Software Development, Scrum part 3

      JavaScript

      Enhancing Software Development Efficiency with Agile Methodology

      Development
      © 2025 Soshace Digital.
      • Home
      • About
      • Services
      • Contact Us
      • Privacy Policy
      • Terms & Conditions

      Type above and press Enter to search. Press Esc to cancel.