Skip to content

A starter project for all React apps, used Bun Run Vite

Notifications You must be signed in to change notification settings

alexkahndev/create-ak-app

Repository files navigation

Server-Side Rendered (SSR) App with Bun, Elysia, and React

This application is a server-side rendered (SSR) app using Bun, Elysia, and React. It demonstrates the power of modern JavaScript technologies for building fast, efficient, and scalable web applications.

Technologies

Bun

Bun is a fast JavaScript runtime and toolkit. It's designed for speed and comes with a bundler, test runner, and Node.js-compatible package manager. Bun starts fast and runs fast, extending JavaScriptCore, the performance-minded JS engine built for Safari. It provides a minimal set of highly-optimized APIs for performing common tasks, like starting an HTTP server and writing files. Bun also includes a package manager, test runner, and bundler, making it an all-in-one runtime for JavaScript and TypeScript apps.

Elysia

Elysia is a performance-focused web framework. It follows WinterGC compliance, making it runtime agnostic. Elysia is designed with an Express-like syntax, type inference, middleware, file uploads, and plugins for JWT authentication, tRPC, and more. It takes full advantage of Bun's HTTP, file system, and hot reloading APIs. This makes Elysia one of the fastest Bun web frameworks.

One of the key features of Elysia is its support for Swagger, a powerful tool for designing, building, and documenting RESTful APIs. The Swagger middleware in Elysia auto-generates a Swagger page for your application, allowing you to easily test your routes. This can be a significant boost to your development workflow, as it allows you to quickly and easily verify that your routes are working as expected.

React

React is a library for building web and native user interfaces. It allows you to build user interfaces out of individual components written in JavaScript. React is designed to let you seamlessly combine components written by independent people, teams, and organizations.

Server-Side Rendering (SSR) and Search Engine Optimization (SEO)

Server-side rendering (SSR) is a technique where your site's content is rendered on the web server rather than the browser. This can lead to better search engine optimization (SEO) and a higher ranking for the webpage. SSR can benefit SEO by providing fully rendered content for complete indexing, faster page loads that search engines reward in rankings, and avoiding SEO pitfalls. SSR reduces the amount of work the client's browser has to do, ensuring a faster display of the web page. This is especially beneficial for users with slower internet connections or less powerful devices.

React Hydration

React Hydration is the process of making a server-rendered React app fully interactive on the client side. When a user requests a web page, the server sends the initial HTML render, which is just static HTML content. React Hydration takes this static HTML, which was initially rendered by the server, and attaches event listeners to make it fully interactive on the client side. During hydration, React works quickly in a virtual DOM to match up the existing content with what the application renders, saving time from manipulating the DOM unnecessarily. It is this hydration that makes SSR worthwhile.

Installation

To install Bun, run the following command:

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

This command is supported on macOS, Linux, and WSL.

To create a new Elysia app from scratch, run the following command:

```bash bun create elysia your-app ```

Replace your-app with the name of your application.

Running the Application

To run create-ak-app and have this full stack app ready for you, follow these steps:

  1. Clone the repository: git clone <repository-url>
  2. Navigate to the project directory: cd create-ak-app
  3. Install dependencies: bun install
  4. Start the development server: bun dev

Enjoy your coding!

References

For more information on these technologies, refer to their official documentation:

About

A starter project for all React apps, used Bun Run Vite

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published