paulstatezny

paulstatezny

Uniform - Less boilerplate, more code reuse in your portfolio of Elixir apps

Announcing Uniform.

Uniform tries to minimize the work required to maintain a large portfolio of Elixir apps. It does this via centralization and automation.

How it works

Uniform works best when you have a portfolio of apps whose core is very similar. (For example, a suite of Phoenix LiveView apps that all use TailwindCSS.)

Here’s how it works:

  1. You build your entire portfolio of apps in a single, “vanilla” Elixir app. (No “umbrella” or “poncho” setup.) You can generate this “Base Project” with mix new, mix phx.new, etc.
  2. You use Uniform’s “blueprint” DSL to set up “base files” and mix dependencies that are required for every app.
  3. You “eject” each app into its own completely separate codebase using mix uniform.eject. The ejected codebase contains the exact project structure you need, with only the code relevant to that app.
  4. You deploy each app using these ejected codebases.
  5. (Recommended) You automate updating ejected codebases via CI, (with mix uniform.eject) so that they basically “update themselves”.

The sales pitch

When you embrace the Uniform approach, it can feel a bit like magic.

  • Security defect in all 10 of the apps you maintain? Fix it in your Base Project and :magic_wand: poof – it’s fixed everywhere.
  • Need to quickly prototype a new app? mix uniform.gen.app my_app and you’re off to the races. No need to set up your suite of common tools for the umpteenth time. (Re-running generators, adding configuration, etc.)
  • Have a private library in one app that you want to use in another? Modify a couple lines of Uniform configuration and it’s instantly available.
  • Want to update some Hex deps across a dozen apps? Update them in your Base Project and they’re updated everywhere.

Uniform tries to lower the amount of effort required for developers to get stuff done. It automates away the manual work needed to keep your codebases “uniform” – in total sync. (But only in the ways you prefer them to be.)

Request for feedback

We know this approach is unconventional to say the least. But we’ve been quietly iterating on it, and it’s working pretty well for us!

We’re very curious what the community at large thinks about this approach.

Links

Click here for the docs and guides.

The code snippets in the Setting up a Phoenix project guide show what it looks like to configure Uniform for a “real” project.

https://github.com/ucbi/uniform

Most Liked

halostatue

halostatue

This looks really useful, and might be interesting to adapt to make it easier to eject into umbrella apps (one of the systems that I’m working on has client-specific modules).

If I might suggest, an example ejectable repo would be useful to better understand how Uniform works, though.

paulstatezny

paulstatezny

@halostatue (and anyone else!) I added an example Uniform project on GitHub.

https://github.com/ucbi/example_uniform_project

It’s quite barebones; the example apps are just facades. But it does include the basic structure of setting up Uniform for Phoenix apps. Over time we’ll need to add more to highlight the different features of Uniform.

You can see the codebases that are ejected from the base project here:

https://github.com/ucbi/example_uniform_project_tweeter
https://github.com/ucbi/example_uniform_project_twadmin

paulstatezny

paulstatezny

@halostatue That sounds like it fits perfectly into Uniform’s model.

Are you currently using private Hex packages for that shared code? Copy-pasting it across codebases? Something else?

Feel free to hit me up on Elixir Slack (@paulstatezny) if you want to talk about specifics that you’re not comfortable sharing here. I’d be happy to walk you through a potential setup that fits your needs.

Where Next?

Popular in Announcing Top

deadtrickster
I’ve just released stable versions of my Prometheus Elixir libs: Elixir client [docs]; Ecto collector [docs]; Plugs instrumenter/Export...
New
OvermindDL1
I created a new library (rather I pulled out a couple files from my big project), it manages an operating system PID file for the BEAM. ...
New
tmbb
I’ve published the first version of my Makeup library. It’s a syntax highlighter for Elixir in the spirit of Pygments, Currently it highl...
New
seancribbs
Today I released a new dialyzer Mix task as the dialyzex package! At the time we started writing this task, the existing dialyzer integra...
New
josevalim
Hi everyone, We would like to announce that Plataformatec is working on a new MySQL driver called MyXQL. Our goal is to eventually integ...
New
bluzky
You may know https://ui.shadcn.com/, a UI component library for React. I really love it’s design style and components. I’ve built some co...
384 14136 119
New
kip
Image is an image processing library for Elixir. It is based upon the fabulous vix library that provides a libvips wrapper for Elixir. I...
622 18934 194
New
ahamez
Hi everyone, I’ve been working on this protobuf library for 3 years. We use it in the company I work for, EasyMile, to communicate with ...
New
josevalim
Hello everyone, We have just released NimbleCSV which is a small and fast CSV parsing library for Elixir. It allows developers to define...
New
OvermindDL1
Been making an MLElixir thing (not released yet…) for fun in spare time in the past day. I’m just trying to see how much I can get an ML...
132 14057 106
New

Other popular topics Top

danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29603 241
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

We're in Beta

About us Mission Statement