Megatomix

Megatomix

Is it possible to program backend with pure elixir (direct SQL in BD) without frameworks? What are the challenges or problems?

First 10 of 19 Posts Switch mode

lpil

lpil

Creator of Gleam

Hi Megatomic! Welcome to the forum!

There’s no need for any specific library or framework to make a backend in Elixir, it just means that you have to make more decisions about what conventions and patterns to employ, and you may need to implement some functionality that the frameworks might otherwise offer.

At my previous workplace we had Elixir services that didn’t use the Phoenix framework or the Plug webserver abstraction, instead we just used the Elli web server (which has a very simple interface). We could have also done the same with Cowboy if desired.
The Raxx web server would have also been a good fit, we went for Elli as Raxx didn’t have middleware at the time.

The service that had a postgres database used Ecto, though if writing it again we might have instead opted to use the Postgrex library directly as we didn’t find Ecto offered much in that specific use-case. Our tech stack was quite diverse so we found that keeping things as simple as possible and using as few libraries and macros as possible made maintenance and on-boarding easier.

So yes, it is possible to implement a backend in Elixir without frameworks.

What’s a BD? :slight_smile:

sribe

sribe

Sure, as another example, I use Phoenix for routing etc, but not ecto: phoenix + postgrex.

Megatomix

Megatomix OP

PostgreSQL

Megatomix

Megatomix OP

I intend to use PostgreSQL

tnks

NobbZ

NobbZ

Postgres is a RDBMS, relational database management system. I’ve not yet heard someone classifying it as a BD.

Could you therefore elaborate on that term?

Megatomix

Megatomix OP

Sorry: a failed act at writing
BD = DB
BD in portuguese, DB in english (DataBase)

joelwallis

joelwallis

Hi @Megatomix,

I don’t see any blocks that would keep you from interacting directly with a database, without using a library. I also don’t see a good reason to not use a library such as Ecto, tho. Why would you like to do such a thing?

By the way, the answer for your question is YES. It’s completely possible to interact with databases directly. You would still have to deal with the issues that libraries like Ecto solve, but assuming you have a good reason to do so, and your preference for Postgres, I would advise you to take a closer look at postgrex, the package that allows you to interact with Postgres using Elixir.

hauleth

hauleth

Yes.

Less pleasant API and that will probably be it.

dimitarvp

dimitarvp

And crying yourself to sleep because you don’t have proper queries, joins and aggregations which you will inevitably need no later than two weeks in the project. :003:

lpil

lpil

Creator of Gleam

SQL query builders such as Ecto are just one approach to querying a database, other options are available, and in some other ecosystems these options more popular.

Personally I am a fan of writing plain SQL and have written a small library to make this a bit more convenient in Elixir. GitHub - lpil/yesql: An Elixir library for using SQL. · GitHub

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
jonnycharles
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
dli
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app? Looking for hints regarding: Addi...
New
roeland
Kia ora, We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
bottlenecked
Hi all, I wanted to ask how the community is dealing with post-release steps. Today we have Ecto migrations, which make sure that the db...
New
rahultumpala
Hello, I have an Elixir backend that implements a custom protocol over TCP. I want to load test the backend and assess the performance o...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New

We're in Beta

About us Mission Statement