Types Of Frontend Websites
Tags: webdev, react, angular, vue
Published: 2021-05-17 08:48:59

Hello everyone👋

Technology has evolved in different ways and in the same way the concepts of building products or tools. Frontend web development is one of the domains which is changing rapidly with the growing community and requirements of faster development. Many libraries and frameworks have been introduced to the developers starting from jquery to react, angular etc. Every technology, concept, library and framework have its own pros and cons but they know how to stand out as per the requirement.

In this article, I am going to discuss different methods of creating frontend sites.

### Topics

```yaml
- Vanilla HTML Websites
- Client-Side Rendering
- Server-Side Rendering
- Static-Site Generator
```

### Vanilla HTML Websites

Vanilla HTML or Static Websites are the raw form of websites that we build using `HTML`, `CSS`, `JavaScript`. They are directly served from a web host or CDN.

![Static Website](https://cdn.hashnode.com/res/hashnode/image/upload/v1621176481419/sVusuh4Lb.jpeg)

#### Pros

- It is easy to get started with.
- Generally, not so complex.
- SEO optimization can be done.

#### Cons

- Less modularity; Hard to update/maintain pages as we need to rewrite a lot of the same code for every page.
- New request to the server for every page.
- Generally, do not contain dynamic data.

### Client-Side Rendering

You may have heard this term many times, it is also known as CSR in short. So what happens in Client-Side Rendering?

When we build a site with React, Angular or Vue, it creates a SPA (Single Page Application) that doesn't have any pre-rendered `HTML` pages. When the browser requests the server for the site, the initial request is for a blank HTML page and then it fetches the JS scripts that manipulate the DOM and render the pages. Routing, data handling etc., are also done within the browser itself.


![Client Side Rendering](https://cdn.hashnode.com/res/hashnode/image/upload/v1621177704707/CzL1inkZ7.png)

#### Pros

- Easy to maintain codebase.
- Modular approach.
- It's fast except for the initial request.

#### Cons

- It is not SEO friendly.
- It can become complex.

> `React.js`, `Angular`, `Vue` can be used to build SPAs.

We can optimize these kinds of sites with Server-Side Rendering.

### Server-Side Rendering

In Server-Side Rendering, the pages are rendered on the server on every request for it. The server aggregates the data from its source like a database and fed it to the templates to render the requested HTML pages. And rendered pages are then sent back to the browser, to display to the user.

![Server Side Rendering](https://cdn.hashnode.com/res/hashnode/image/upload/v1621178361766/o92jvSxda.png)

#### Pros

- Easy to maintain codebase.
- Modular approach.
- SEO friendly.

#### Cons

- Network latency can impact.
- New request for every page.

> `Next.js` for React and `Nuxt.js` for Vue can be used for Server-Side Rendering.

There is a hybrid approach to get benefits of both CSR and SSR which we will be discussing next.

### Static-Site Generator

In Static-Site Generator, the static pages are compiled at the build-time i.e, before deployment with some initial data. The static pages are then deployed to a web server. After the initial request, the site behaves more like a Single-Page Application.

![Static Site Generator](https://cdn.hashnode.com/res/hashnode/image/upload/v1621179375849/uDbKkaMo5.png)

#### Pros

- Easy to maintain codebase.
- Modular approach.
- SEO friendly.

#### Cons

- It can become complex.

> `Gatsby.js` with React can be used for Static-Site Generator.

### Conclusion

There is no hard and fast rule on which one you should use. It depends on your application and its usage.

In my opinion, Client-Side Rendering is suited for applications where users will stay for a longer time and will interact often and want a user experience similar to a desktop application. For example, a trading platform.

Server-Side Rendering is good for applications like @[Hashnode](@hashnode), a blogging platform.

---

> Originally published on [blog.bibekkakati.me](https://blog.bibekkakati.me/types-of-frontend-websites)

---

Thank you for reading 🙏

If you enjoyed this article or found it helpful, give it a thumbs-up 👍

Feel free to connect 👋

[Twitter](https://twitter.com/kakatibibek) | [Instagram](https://instagram.com/bibekkakati) | [LinkedIn](https://linkedin.com/in/bibekkakati)


---

If you like my work and want to support it, you can do it here. I will really appreciate it.

<a href="https://www.buymeacoffee.com/bibekkakati">
<img src="https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=bibekkakati&button_colour=FFDD00&font_colour=000000&font_family=Cookie&outline_colour=000000&coffee_colour=ffffff">
</a>