timpile
Handwrite - Unofficial API wrapper for Handwrite.io
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: https://hex.pm/packages/handwrite.
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!
Most Liked
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
- Although they are mostly swappable, recent packages chose jason instead of poison for json
- http client - I’m using tesla whenever possible since users can swap the http library easily.
Handwrite.Client
- Instead of
"#{secret_key()}", you can make sure secret_key returns string value… which leads to the next point -
secret_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.- For global configuration - check out sentry package
- See configuration related sections at Library Guidelines as well
Code organization
- I found you made a module for each resource - such as
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.- See also ExAws.S3 where the module have functions for each API call and introduce modules for high-level tasks, such as ExAws.S3.Upload (src)







