3 ms·
My experience with phx_gen_auth was like this: 1. Install Phoenix, expect the command to be available because everyone is raving about it. 2. Missing command.
by sergiomattei 5y ago
My experience with phx_gen_auth was like this:
1. Install Phoenix, expect the command to be available because everyone is raving about it.
2. Missing command.
3. Dig through docs.
4. Pull the development branch of Phoenix because phx_gen_auth is only available there.
5. Run the generator within the Phoenix git repo because it won't allow me to run it elsewhere using a development version.
6. Use the generator.
7. Never figure things out because the phx_gen_auth command is barely documented and now I've got files everywhere that I don't understand.
I tried implementing API authentication as well and while I got it working, it was less pleasant than my usual Django stack.
Another example. The colossal amount of docs referring to a missing Phoenix plugin for Guardian that got removed in a random update made me scratch my head and spend an hour digging through their changelog and commits to figure out why my code wasn't working. The change was not documented at all.
All in all, there were roadblocks every step of the way with poor docs and big undocumented breaking changes in libraries like Guardian. I want to love this thing but it made me so unproductive in the first couple weeks of using it for basic web/api development that I simply noped out.
- kfajdsl 5y agoYeah, all the different files in different directories in a Phoenix project is pretty overwhelming. I would recommend going through the official Phoenix guides before messing with some of the generators or libraries, that helped me a lot. Also, if you're interested in it, the Phoenix LiveView guides are also excellent.
- devoutsalsa 5y agoI feel your pain. I personally felt like the learning curve was on Elixir was quite steep, partially because I lacked a strong foundation in software engineering when I started. Fortunately I had the luxury of learning on the job & was given enough time to ramp up. Now I really like it.
- dudul 5y agoDamn, did you try it 6 months ago while it was still experimental? I started like 4 projects in the past 2 months with it and this does not at all mirror my milage. And I like it much better than a library because the code is just plain phoenix/ecto that is can customize easily.
- sergiomattei 5y agoNo, a month ago.
- bostonvaulter2 5y agoYeah, unfortunately there are still some sharp edges. Was there a particular reason you decided to use the unreleased version of Phoenix 1.6 instead of using the current version of phx_gen_auth (from https://github.com/aaronrenner/phx_gen_auth/ https://github.com/aaronrenner/phx_gen_auth/)? There's a decent bit of documentation there too. I haven't used guardian (not a fan of JWT) so I can't comment on it.
- ch4s3 5y agoYeah, phx_gen_auth hasn't landed in main phoenix yet. As another poster mentioned, you should try https://github.com/aaronrenner/phx_gen_auth https://github.com/aaronrenner/phx_gen_auth if you're going to use a generator. You might however get more mileage out of Programming Phoenix[1] where you'd learn what all of the files are for and how to build auth yourself. Plug and Ecto make it quite easy to do password auth. Guardian was popular in the past, but isn't widely used these days. You could use joken, or just roll it yourself. Generally the docs for Elixir libraries are very good, but you have indeed found some poorly documented things. I might suggest scraping together something simple and then trying out parts of the ecosystem that offer something new, like channels, live_view, broadway, or something else that takes advantage of OTP. Otherwise you're only going to see the gaps compared to Django and none of the benefits. [1] https://pragprog.com/titles/phoenix14/programming-phoenix-1-4/ https://pragprog.com/titles/phoenix14/programming-phoenix-1-...
- sergiomattei 5y agoWill do :)