Book Image

Build Your Own Web Framework in Elixir

By : Aditya Iyengar
Book Image

Build Your Own Web Framework in Elixir

By: Aditya Iyengar

Overview of this book

Elixir's functional nature and metaprogramming capabilities make it an ideal language for building web frameworks, with Phoenix being the most ubiquitous framework in the Elixir ecosystem and a popular choice for companies seeking scalable web-based products. With an ever-increasing demand for Elixir engineers, developers can accelerate their careers by learning Elixir and the Phoenix web framework. With Build Your Own Web Framework in Elixir, you’ll start by exploring the fundamental concepts of web development using Elixir. You'll learn how to build a robust web server and create a router to direct incoming requests to the correct controller. Then, you'll learn to dispatch requests to controllers to respond with clean, semantic HTML, and explore the power of Domain-Specific Languages (DSL) and metaprogramming in Elixir. You'll develop a deep understanding of Elixir's unique syntax and semantics, allowing you to optimize your code for performance and maintainability. Finally, you'll discover how to effectively test each component of your application for accuracy and performance. By the end of this book, you'll have a thorough understanding of how Elixir components are implemented within Phoenix, and how to leverage its powerful features to build robust web applications.
Table of Contents (15 chapters)
1
Part 1: Web Server Fundamentals
4
Part 2: Router, Controller, and View
10
Part 3: DSL Design

Preface

There’s an old story about the person who wished his computer were as easy to use as his telephone. That wish has come true since I no longer know how to use my telephone.

– Bjarne Stroustrup

The preceding quote from Stroustrup shows just how fast technology is evolving. We’re building more complex software day by day while also building it at an ever-increasing rate. However, as the complexity of software increases, so do abstractions around its fundamentals. As a result, it is easier to build software using those abstractions but harder to completely understand how a piece of software works the way it does. This is true for programming languages, deployment tools, and several other types of tools we use. Another one of those tools is a web framework.

A web framework is a tool or a set of tools that assists in building and releasing a web application. This is accomplished through the process of standardization and building abstractions around those standardized models. Web frameworks usually include tools for server management, data management, templating, and so on. From the 1990s to 2021, we have seen the evolution of web frameworks from Java Servlets and ASP.NET to Rails and Elixir’s Phoenix. Over the course of this period, we have significantly decreased the average amount of effort required to build a web application. However, since Phoenix facilitates productive web development, I frequently come across developers being bewildered by its “magic.” That “magic” is often one obstacle that stands in the way of an Elixir web developer to cross the seemingly never-ending bridge of mid-level to senior-level. It is also one of the key factors that determines how confident they feel as a developer.

This book aims to help developers overcome that obstacle by building a web framework from scratch using Elixir. The goal is to demystify the aforementioned Phoenix magic by breaking it down into components and designing/building them from the ground up while testing their expected behaviors. I expect developers to feel more confident in their web development skills and Elixir knowledge after reading this book. Maybe, some will even go on to make contributions to the Elixir open source community.