VOOZH about

URL: https://thenewstack.io/getting-started-with-elixir-and-phoenix-a-js-alternative/

⇱ Getting Started With Elixir and Phoenix, a JS Alternative - The New Stack


TNS
SUBSCRIBE
Join our community of software engineering leaders and aspirational developers. Always stay in-the-know by getting the most important news and exclusive content delivered fresh to your inbox to learn more about at-scale software development.
REQUIRED
It seems that you've previously unsubscribed from our newsletter in the past. Click the button below to open the re-subscribe form in a new tab. When you're done, simply close that tab and continue with this form to complete your subscription.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.
Welcome and thank you for joining The New Stack community!
Please answer a few simple questions to help us deliver the news and resources you are interested in.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Great to meet you!
Tell us a bit about your job so we can cover the topics you find most relevant.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Welcome!

We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.

What’s next?

Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.

Follow TNS on your favorite social media networks.

Become a TNS follower on LinkedIn.

Check out the latest featured and trending stories while you wait for your first TNS newsletter.

PREV
1 of 2
NEXT
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
Thanks for your opinion! Subscribe below to get the final results, published exclusively in our TNS Update newsletter:
NEW! Try Stackie AI
From clobbered drafts to real-time sync
Apr 14th 2026 10:00am, by David Moore
TypeScript 6.0 RC arrives as a bridge to a faster future
Mar 14th 2026 9:00am, by Darryl K. Taft
Mastra empowers web devs to build AI agents in TypeScript
Jan 28th 2026 11:00am, by Loraine Lawson
2025-09-17 06:00:52
Getting Started With Elixir and Phoenix, a JS Alternative
tutorial,
Frontend Development / JavaScript / Software Development

Getting Started With Elixir and Phoenix, a JS Alternative

A strong use case for Phoenix and Elixir is apps that require thousands of simultaneous connections without slowing down. We test it out.
Sep 17th, 2025 6:00am by Jessica Wachtel
👁 Featued image for: Getting Started With Elixir and Phoenix, a JS Alternative
Image by Mouaadh Tobok via Unsplash.

Elixir is an alternative to JavaScript-based web development that claims to offer faster development and lower costs. In this developer walkthrough, we try out Elixir and its Phoenix web framework.

Elixir was created by Josè Valim back in 2011, in response to the challenges of web development. Valim aimed to combine the reliability and scalability of Erlang with the goals of modern developers. Elixir is a programming language built on the Erlang VM, known for concurrency and fault-tolerance. Elixir can handle thousands of simultaneous connections, which makes it well-suited for distributed, fault-tolerant systems. It uses the functional programming paradigm.

Phoenix is a web framework built on top of Elixir. Phoenix handles routing, database integration and standard web conventions. It’s a recommended option for developers looking to build web apps or APIs in Elixir.

A strong use case for using Phoenix and Elixir is apps that require thousands of simultaneous connections without slowing down. Think chat apps, live dashboards, multiplayer games. Phoenix has a live view where you can push updates to the browser without writing a single line of JavaScript.

This isn’t a catch-all, though; there are a lot of instances where JavaScript remains the optimal tool. If you need rich client-side interactivity, are quickly prototyping or building small-scale apps, or want integration with full-stack JavaScript environments, JavaScript and its tools are still a better choice than Elixir.

Let’s get to the rough part: in my short experience with Elixir and Phoenix, I found this software unintuitive and frustrating to work with. I say that knowing this probably represents my skill as a developer as much as the software itself (sorry). That said, I’ve written more of these articles than I could quickly count. This is the first time I almost posted a tutorial with bugs in it. Why? When Phoenix scaffolds the pages, the boilerplate code includes incorrect routes. Yes, it’s solvable, but I’ve built many of these basic CRUD apps. Working with Phoenix was the most frustrating one.

Requirements

Note: I had to update my OS to Sequoia before I could install Elixir.

Create a New Phoenix Project

This creates a project with the following directory structure:

  • Controllers lib/notes_app_web/controllers
  • HTML templates lib/notes_app_web/templates
  • Routes lib/notes_app_web/router.ex
  • Context note for business logic lib/notes_app/notes.ex

Set Up the Database

Setting up the database will allow you to store notes long after you refresh the page.

Scaffolding a CRUD Interface

Phoenix has a generator command that will create a full CRUD web interface for a resource.

This creates the notes context, schema, table, and columns for the table. The context is helper functions to create, update, delete, and list notes. The schema is the blueprint of the notes. The migration instructions build the table in the database. The controller handles all requests. Views and templates display the app on your browser. And then we have the router, which ensures /notes works at the end of a URL.

We’re ready to start the dev server. This can run throughout the development process. We don’t have to start and stop it.

Go to this URL in your browser: http://localhost:4000/notes

You will see that there are a lot of folders and files. I didn’t love this, which might have been the start of my challenges.

We are going to focus on the following pages:

  • Index page
  • Show page
  • New and Edit pages
  • Controller
  • Routers

Index Page

You’ll find the index page in the notes_app_web/templates/note/index.html.heex.

This is the homepage and it shows all your notes. It’s the central navigation page, plus it’s the page we’ll need to keep going back to after deleting or editing a note.

Show Page

This page will show you one note in detail. The goal of this page is to help the user read or review a specific note in detail. You can find it here: notes_app_web/templates/note/show.html.heex

New and Edit Pages

These are our form pages, where we build and edit the notes.

Here’s the partial form: _form.html.heex.

Create a new note: new.html.heex

This is where you can edit a note: edit.html.heex

Before we build the controller, let’s talk about debugging. When Phoenix scaffolds the boilerplate for your Notes resource, it still includes old-style routers. The older style routers (which will not work with the latest install) look like the code below and you’ll find them in the controller:

Those were replaced by verified routes that use the ~p syntax. If you don’t manually go through and replace the old code, you will see errors when you edit or delete notes in your browser. I use Chrome, and it happened to me during the making of this tutorial… a lot.

There is a simple fix, though: Replace the old routes with this code:

We’re Ready to Build the Controller

Here’s where the action of the application takes place. We’re going to build our full CRUD functionality into this one file. The controller connects the templates to the database. It handles business logic, validation, and navigation (redirects). You can find this file here: notes_app_web/controllers/note_controller.ex.

Routes

Routes tell Phoenix which controller action to call for each URL. resources generates all standard CRUD routes automatically. You can find this file here: notes_app_web/router.ex.

And there you have it! You may find this software more intuitive and easier to work with than I did. Give it a try.

TRENDING STORIES
Jessica Wachtel is a developer marketing writer at InfluxData where she creates content that helps make the world of time series data more understandable and accessible. Jessica has a background in software development and technical journalism.
Read more from Jessica Wachtel
SHARE THIS STORY
TRENDING STORIES
SHARE THIS STORY
TRENDING STORIES
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.