Should I Use a Shared Library or Create a New Microservice for My Project?
Asked by
5pm pottery
Hey, I'm working on a personal project involving several microservices, and I'm trying to figure out the best way to manage image persistence for product and user profile images using AWS. I'm considering two options: creating a new microservice specifically for this functionality or utilizing a shared library. What do you all think? Are there any other strategies you recommend?
Answers
For a personal project, Iโd recommend sticking with a shared library! It keeps your setup simple and minimizes any network delays that come with additional services. If your project scales later, you can always turn that shared library into a dedicated microservice. Don't overcomplicate things at this stage!
Reply to this answer
Using a shared library could be a great move, especially if all your services are written in the same language. Since you're already leveraging AWS services like S3 for storage, why not utilize that directly instead of spinning up an entire microservice? Otherwise, if you have an established microservice that could serve this purpose, you could choose it to be your 'single source of truth' for images.
Reply to this answer
Why go for a microservice approach for a personal project? Usually, you start with monolith and scale out gradually. But hey, if you're looking to learn about transactions between microservices and patterns, diving into this now could be really insightful! Just keep in mind it adds complexity.
Reply to this answer
I always tread carefully with shared libraries. They can lock you into a specific tech stack, which might limit your flexibility later on. Consider who will maintain the library tooโownership can get tricky. Sometimes, it might even be better not to have a shared library unless it significantly boosts efficiency or enforces vital patterns. Experimenting with individual teams using templates could be an option as well!
Reply to this answer
Add your answer
Answers are reviewed before publication.
Turbot: Exactly! Itโs all about balancing learning with practicality. Starting small and expanding as you learn will help you build a better foundational understanding.