timpile
I started using the Handwrite REST API for a side project and since they don’t have an API library for Elixir I decided to make an unofficial one for them: handwrite | Hex.
This is my first published Hex package and I have only used Elixir for side projects, so I’d love to make this library more stable and usable. I’m sure there is a lot of improve on, so any feedback or code reviews would be greatly appreciated!
Trending in Announcing
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries.
offset-based pagination with...
New
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi all!
I want to present a small library which provides a mix task for generating an Entity-Relationship Diagram for Ecto schemas.
You...
New
Hello
Published a new library - ProcessHub!
ProcessHub is a library designed to manage process distribution within the Elixir cluster. ...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
This showed up on my feed.. anyone heard of it? Just hype?
Ox Alpha is a reasoning model designed for coding, sustained ag...
New
It’s not that it’s vocabulary is too advanced. It’s something worse.
I get lost trying to follow even a paragraph written by Claude. It’...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Today we’re releasing Oban for Python. Not an Oban client in Python. Not a pythonx wrapper embedded in Elixir. Nope, it’s a fully operati...
New
@hugobarauna, Dr. Dimitrios Koutmos (my brother) and I (Alex Koutmos) have been hard at work on writing a book on how you can use Elixir ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 6- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
malloryerik
I checked out handwrite.io because of your library, but I see their pricing policy is “inquire within”. I’m guessing they’ve got reasonable pricing if you’re using it on side projects?
timpile
I’m still only using it in a sandbox environment, but as far as I can tell the pricing is comparable to other card printing services. They are very responsive, if you reach out to them I’m sure they can give you a better answer.
chulkilee
Welcome! My first hex package was also a rest api wrapper (ex_force)
Here are some feedback/thoughts:
Dependency
Handwrite.Client"#{secret_key()}", you can make sure secret_key returns string value.. which leads to the next pointsecret_key/0callsSystem.get_env/1on runtime - it may be okay for application (although not recommended), but for library, you should use application configuration (e.g.Application.get_env/3) (for global config) or pass that value down to the function.Code organization
Handwrite.Endpoint.Handwriting. There is no right answer, but I found it’s actually easier to read, use, and maintain the code I put the all things under one module if they’re at the similar level resources. See ExForce module source.timpile
Thanks for the great suggestions!
These are all super helpful and I appreciate the links to examples as well. I’ll have to spend some time digging through it all and prioritizing my todo list.
I’ll definitely at least move the secrets to the application config. That seems like a quick win and an important change.
gregvaughn
I disagree. Strongly. If an application were to have two dependencies using this library, then the configuration must be global. That’s a bad thing. The library should accept configuration given to it. A default in application config is acceptable, but I still don’t love it.
Terminology is confusing here. Mix config has initial keys in the namespace that correspond to OTP apps, however, in an umbrella project, multiple OTP apps must be considered. In addition, umbrella projects can support multiple releases, each of which should be able to have their own configuration. What we commonly refer to as application config should probably be better thought of as release config.
chulkilee
Oh, I agree with you in that global config for a library must be avoided.
I should have been more clear on this part
I wanted to give hints to move away from using
System.get_env/1first…For starter - and this kind of library, this is very likely to have one instance - which is “acceptable” (although I don’t prefer) to have (global) application config. That’s why I refer to the library guides lines, which has a section for Avoid application configuration
@timpile for the configuration - it’s better to have a library to provide building blocks and let library users load config as needed.
For example:
By doing this, your library does not care how to store and retrieve the configuration at all - and that is in the library user code.
I did make a mistake when I wrote the first library - I had default config value and make authentication happens when not passed to make it easy to use.. but I found it’s not good. See my commit to change from httpoison to tesla with 1) dropping default config and 2) making all functions to take a tesla struct, which holds the all information such as url and auth token - see Replace HTTPoison with Tesla · chulkilee/ex_force@8d32d9a · GitHub