How can I write backend with Elixir for web development except Phoenix?

So I have a frontend written in some basic html, css and js. I want some backend with Database (login/register) for my website. Are there any recommended documentation about that how do build that in plain elixir (mix)? Or are there any good started librarys? Thanks in advance.

Try Plug.


I would advice against it since there is no issue in using phoenix as an api only instead of you spending time trying figure out how wire up plug and ecto from scratch.


Though it explicitly addresses serving web pages rather than APIs (the two aren’t so different), you might want to have a read of Saša Jurić’s blog post Phoenix is modular. It’s a nice overview of what libraries constitute Phoenix, how it’s possible to use them individually or strip some out of a Phoenix app, and why despite knowing that you might not want to.


For those who think Phoenix is “heavyweight” here’s a single file exs file that launches a Phoenix-based server (from @Gazler). phoenix.exs · GitHub


Oh I absolutely LOVE this, thanks for posting it!


That is really cool!
I ported it to an Elixir app, to see how it will look like.

Thank you @gazler for creating it and @gregvaughn for sharing it here.

1 Like

If you want to ship content through a websocket like discord you could use cowboy and plug, but that’s only for apps you want to make horridly real time. If you are just implementing a way to do logic and query a database, (and you don’t want to use phoenix), you might just be better off with a firebase app (which still has real-time listeners).

Thank you Greg. Appreciate the contribution

There’s also a book Programming Ecto - it’s dealing with Phoenix only marginally and there’s a whole chapter literally named “Adding Ecto to an Elixir Application Without Phoenix” :slightly_smiling_face: Maybe that could be useful for your purposes too.

1 Like

but does phoenix only work with postgres?

No, there are a lot of db-adapters.

Absolutely not the case, what gave you that idea? Phoenix doesn’t care about databases. Ecto does. And it can work with a good number of DBs.