<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Gustavo Bueno</title>
    <description>The latest articles on DEV Community by Gustavo Bueno (@emesislol).</description>
    <link>https://dev.to/emesislol</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F380099%2F2db1bab3-70fc-4a65-8b1f-22a632f5dbca.jpg</url>
      <title>DEV Community: Gustavo Bueno</title>
      <link>https://dev.to/emesislol</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/emesislol"/>
    <language>en</language>
    <item>
      <title>Bun: The Supercharged JavaScript Runtime</title>
      <dc:creator>Gustavo Bueno</dc:creator>
      <pubDate>Tue, 21 Nov 2023 08:00:00 +0000</pubDate>
      <link>https://dev.to/emesislol/bun-the-supercharged-javascript-runtime-54g4</link>
      <guid>https://dev.to/emesislol/bun-the-supercharged-javascript-runtime-54g4</guid>
      <description>&lt;p&gt;Bun is an intriguing new addition to the JavaScript ecosystem, designed as a runtime like Node.js but with a focus on high performance. Let's dive deep into its workings, architecture, and capabilities.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Bun Works
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Zig-Based Architecture
&lt;/h3&gt;

&lt;p&gt;Unlike Node.js, which is built on C++, Bun is primarily written in Zig, a language known for its performance and safety features. Zig provides Bun with low-level control and efficient memory management, contributing to its high-speed operations.&lt;/p&gt;

&lt;h3&gt;
  
  
  JavaScript Engine
&lt;/h3&gt;

&lt;p&gt;Bun integrates a high-performance JavaScript engine that is JIT (Just-In-Time) compiled. This engine is crucial for executing JavaScript code swiftly and efficiently.&lt;/p&gt;

&lt;h3&gt;
  
  
  Compatibility with Node.js and Web APIs
&lt;/h3&gt;

&lt;p&gt;Bun aims for compatibility with Node.js and web APIs. This means that it can run most Node.js packages and JavaScript written for web browsers, facilitating easier migration and interoperability.&lt;/p&gt;

&lt;h2&gt;
  
  
  How is it built
&lt;/h2&gt;

&lt;p&gt;As mentioned before, the core of Bun is built using Zig's powerful features like compile-time code generation and cross-compilation. These features help in optimizing the runtime for different platforms and use cases.&lt;/p&gt;

&lt;p&gt;Bun integrates with existing technologies such as libuv (for asynchronous I/O) and other C libraries, blending the best of both worlds for performance and functionality.&lt;/p&gt;

&lt;p&gt;Throughout its architecture, Bun emphasizes performance optimizations. This includes faster startup times, efficient bundling, and quicker execution of JavaScript code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key features
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Fast Package Manager
&lt;/h3&gt;

&lt;p&gt;Bun comes with a built-in package manager that is touted to be significantly faster than npm or Yarn. It leverages parallel downloading and caching for efficiency.&lt;/p&gt;

&lt;h3&gt;
  
  
  Bundling and Transpiling
&lt;/h3&gt;

&lt;p&gt;Bun includes capabilities for bundling and transpiling JavaScript and TypeScript code. Its bundler is integrated into the runtime, offering speed advantages over traditional JavaScript tooling.&lt;/p&gt;

&lt;h3&gt;
  
  
  Native TypeScript Support
&lt;/h3&gt;

&lt;p&gt;Unlike Node.js, which requires external tools for TypeScript support, Bun natively understands TypeScript. This eliminates the need for additional transpilation steps.&lt;/p&gt;

&lt;h3&gt;
  
  
  Web APIs and Polyfills
&lt;/h3&gt;

&lt;p&gt;Bun supports various Web APIs and provides polyfills for Node.js-specific features, making it easier to run web code on the server side.&lt;/p&gt;

&lt;h3&gt;
  
  
  Fast HTTP Server
&lt;/h3&gt;

&lt;p&gt;Bun's HTTP server is designed for high performance, capable of handling a large number of concurrent connections with low latency.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cross-Platform Support
&lt;/h3&gt;

&lt;p&gt;Bun is designed to work across different platforms, with support for Linux, macOS, and Windows.&lt;/p&gt;




&lt;p&gt;Bun is still evolving, with an active community contributing to its development. Its focus on performance and efficiency positions it as a compelling alternative in scenarios where speed and resource optimization are critical. As it matures, Bun may well become a significant player in the JavaScript runtime space, alongside Node.js and Deno.&lt;/p&gt;

</description>
      <category>bunjs</category>
      <category>javascript</category>
      <category>runtime</category>
      <category>development</category>
    </item>
    <item>
      <title>Creating and running a Next.js project using Bun</title>
      <dc:creator>Gustavo Bueno</dc:creator>
      <pubDate>Fri, 17 Nov 2023 07:00:00 +0000</pubDate>
      <link>https://dev.to/emesislol/creating-and-running-a-nextjs-project-using-bun-aef</link>
      <guid>https://dev.to/emesislol/creating-and-running-a-nextjs-project-using-bun-aef</guid>
      <description>&lt;p&gt;The new JavaScript runtime environment is an exciting prospect for developers familiar with Node.js. This article will guide you through the process, leveraging my years of experience as a software engineer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding Bun and Next.js
&lt;/h2&gt;

&lt;p&gt;Before diving into the technical aspects, it's essential to understand what Bun and Next.js are and why they're a good match.&lt;/p&gt;

&lt;h3&gt;
  
  
  Bun
&lt;/h3&gt;

&lt;p&gt;A new JavaScript runtime like Node.js but built on the Zig language. It's known for its exceptional performance and includes a package manager, bundler, and transpiler.&lt;/p&gt;

&lt;h3&gt;
  
  
  Next.js
&lt;/h3&gt;

&lt;p&gt;A React-based framework that offers server-side rendering, static site generation, and other features for building efficient web applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting Up Your Environment
&lt;/h2&gt;

&lt;p&gt;To start, ensure you have Bun installed on your system. You can install Bun on macOS, Linux, and Windows (via WSL). Visit &lt;a href="https://bun.sh/"&gt;the official Bun website&lt;/a&gt; for the latest installation instructions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating a Next.js Project
&lt;/h2&gt;

&lt;p&gt;Once Bun is installed, you can create a Next.js project. Unlike traditional Node.js, where you'd use &lt;code&gt;npx create-next-app&lt;/code&gt;, with Bun, you use its package manager. Run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;bun create next-app my-next-project
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Running the Project
&lt;/h2&gt;

&lt;p&gt;Navigate to your project directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;my-next-project
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, start your Next.js application using Bun:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;bun &lt;span class="nt"&gt;--bun&lt;/span&gt; run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Note that we added &lt;code&gt;--bun&lt;/code&gt; so that we run the dev server with Bun instead of Node.js&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This command starts the development server, and you can view your application by navigating to &lt;code&gt;http://localhost:3000&lt;/code&gt; in your browser.&lt;/p&gt;

&lt;h2&gt;
  
  
  Developing with Next.js and Bun
&lt;/h2&gt;

&lt;p&gt;Developing a Next.js application on Bun isn't radically different from developing on Node.js. However, you'll notice performance improvements, especially in build times. You write your React components and pages as usual.&lt;/p&gt;

&lt;h2&gt;
  
  
  Building and Deploying
&lt;/h2&gt;

&lt;p&gt;To build your Next.js application for production, use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;bun build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command creates an optimized production build. For deployment, you can use Vercel, Netlify, or any other service that supports Next.js.&lt;/p&gt;

&lt;h2&gt;
  
  
  Advantages and Considerations
&lt;/h2&gt;

&lt;p&gt;Using Bun with Next.js provides several benefits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Performance&lt;/strong&gt;: Faster startup and execution times.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Modern Tooling&lt;/strong&gt;: Bun's integrated package manager and transpiler streamline the development process.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compatibility&lt;/strong&gt;: Bun aims to be largely compatible with existing Node.js packages.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, as Bun is relatively new, there may be compatibility issues with some Node.js packages. It's important to test thoroughly and keep an eye on the evolving ecosystem.&lt;/p&gt;

&lt;p&gt;Bun represents an exciting development in the JavaScript world, offering significant performance improvements. When combined with Next.js, it provides a robust platform for building fast, efficient web applications. As the Bun ecosystem matures, it's likely to become an even more compelling option for JavaScript developers.&lt;/p&gt;

</description>
      <category>bunjs</category>
      <category>nextjs</category>
      <category>javascript</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Starting with the NestJS Framework: A Beginner's Guide to Production-Ready Applications</title>
      <dc:creator>Gustavo Bueno</dc:creator>
      <pubDate>Fri, 10 Nov 2023 11:58:19 +0000</pubDate>
      <link>https://dev.to/emesislol/starting-with-the-nestjs-framework-a-beginners-guide-to-production-ready-applications-2gpm</link>
      <guid>https://dev.to/emesislol/starting-with-the-nestjs-framework-a-beginners-guide-to-production-ready-applications-2gpm</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br&gt;
NestJS is a progressive Node.js framework for building efficient and scalable server-side applications. It's built with TypeScript and combines elements of Object-Oriented Programming (OOP), Functional Programming (FP), and Functional Reactive Programming (FRP). This article aims to guide beginners through the foundational concepts of NestJS, culminating in the deployment of a production-ready application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setting Up Your Development Environment&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Install Node.js and npm&lt;/strong&gt;: Ensure you have Node.js and npm installed. They are crucial for managing backend dependencies.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Install NestJS CLI&lt;/strong&gt;: Use npm to install the NestJS CLI globally. This tool helps in creating, managing, and maintaining your NestJS applications.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm i &lt;span class="nt"&gt;-g&lt;/span&gt; @nestjs/cli
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create a New Project&lt;/strong&gt;: Initialize a new project using the NestJS CLI.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nest new project-name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Understanding NestJS Core Concepts&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Controllers&lt;/strong&gt;: Controllers handle incoming requests and return responses to the client. They are defined with the &lt;code&gt;@Controller()&lt;/code&gt; decorator.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Providers and Services&lt;/strong&gt;: Providers are a fundamental concept in NestJS. Services, marked with &lt;code&gt;@Injectable()&lt;/code&gt;, are a type of provider that contain business logic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Modules&lt;/strong&gt;: Modules organize your code into separate units. Each application has at least one module, the root module.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Middleware&lt;/strong&gt;: Middleware functions handle requests and responses, similar to Express middleware.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Exception Filters&lt;/strong&gt;: They handle exceptions that occur during the execution of request processing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pipes&lt;/strong&gt;: Pipes perform data transformation or validation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Guards&lt;/strong&gt;: Guards handle authentication and authorization.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Interceptors&lt;/strong&gt;: Interceptors add extra logic to incoming requests or outgoing responses.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Building a Basic Application&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create a Simple REST API&lt;/strong&gt;: Start by building a simple CRUD (Create, Read, Update, Delete) API. This involves creating controllers and services for handling data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Connect to a Database&lt;/strong&gt;: Integrate a database, like PostgreSQL or MongoDB, using TypeORM or Mongoose.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Implement Authentication&lt;/strong&gt;: Use Passport.js for implementing authentication strategies.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Validation and Error Handling&lt;/strong&gt;: Implement DTOs (Data Transfer Objects) for validation and use exception filters for error handling.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Testing Your Application&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Unit Testing&lt;/strong&gt;: NestJS supports Jest for unit testing. Test individual components in isolation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;End-to-End Testing&lt;/strong&gt;: Use tools like Supertest to perform end-to-end testing.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Preparing for Production&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Environment Configuration&lt;/strong&gt;: Use configuration files to manage different settings for development, staging, and production environments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Logging&lt;/strong&gt;: Implement a logging mechanism to track errors and other important events.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security Best Practices&lt;/strong&gt;: Implement security best practices, such as rate limiting, CORS, and helmet.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance Optimization&lt;/strong&gt;: Use techniques like caching and efficient database querying.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Documentation&lt;/strong&gt;: Document your API using tools like Swagger.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Deployment&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Containerization&lt;/strong&gt;: Containerize your application using Docker for consistent deployment environments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CI/CD Pipeline&lt;/strong&gt;: Set up a CI/CD pipeline with tools like Jenkins or GitLab CI for automated testing and deployment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Choose a Hosting Provider&lt;/strong&gt;: Deploy your application on platforms like AWS, Heroku, or Google Cloud Platform.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
NestJS offers a robust platform for building scalable server-side applications. By understanding its core concepts and following best practices, beginners can effectively develop and deploy production-ready applications. Remember, the key to mastering NestJS lies in continual practice and staying updated with the framework's evolving ecosystem.&lt;/p&gt;

</description>
      <category>nestjs</category>
      <category>node</category>
      <category>setup</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
