dwyl / github-backup

:octocat: :back: 🆙 Backup your GitHub Issues so you can still work when (they/you are) offline.
https://github-backup.herokuapp.com
GNU General Public License v2.0
32 stars 3 forks source link

Phoenix vs Plug/Cowboy #12

Closed SimonLab closed 6 years ago

SimonLab commented 6 years ago

Should we use Phoenix or implement "just a simple" server with Plug and Cowboy?

Our first thought was to use only Plug and Cowboy to create server:

However for a long term project Phoenix might be a better choice:

At the end I agree that on a long term project Phoenix might be a better choice.

Cleop commented 6 years ago

A nice comparison from this article: https://shankardevy.com/code/create-elixir-web-app-using-cowboy/

nelsonic commented 6 years ago

@SimonLab here's a "proxy-question": how long did it take you to "grok" the codebase in https://github.com/dwyl/hits-elixir ?

It is my opinion that a Phoenix App will be more maintainable than an Elixir-Cowboy one.

SimonLab commented 6 years ago

Because the lib doesn't contain a lot of file: image it was quiet easy at the end to understand the flow of the application by just having a quick look at these files. Also the main content of the files is documentation :+1: The main file (https://github.com/dwyl/hits-elixir/blob/master/lib/hits.ex) only contains 7 functions of a few lines of code! That's why it's very easy to grasp the logic of the code.

It took me more time as I dive directly into the documentaion of Plug and Cowboy and watch a few youtube videos on this but I could have been faster to just learn by tweaking the project directly.

However hits-elixir is a relatively small app and as soon as more complex functions are needed it can become more tricky to navigate between files. Phoenix give a canvas for bigger project to follow in this case.

Cleop commented 6 years ago

We chose to go with Phoenix rather than Cowboy/Plug given our longer term vision for this project. Phoenix has now been set up. @SimonLab - are you happy to close this?

caldempsey commented 5 years ago

I'd disagree. I think you shouldn't look to phoenix to solve the problem of how to structure your application. Elixir doesn't care how you structure your application. Neither does phoenix. I'd recommend reading up on domain driven design if you are looking for a maintainable project structure to enterprise scale. But in the end of the day 30 files is just not a lot of code. You can refactor and move everything around 10 times and it would take you probably an hour or less each iteration. So your question shouldn't really be what's a good file structure until you need it.