Frameworks
Currently, for our specific use cases, we have implemented two distinct frameworks for our microservices: Django and FastAPI. We employ Django for services that do not experience high loads and require the convenience of Django's built-in admin features. Conversely, FastAPI is our framework of choice for services where the primary focus is achieving rapid response times.
Databases
When it comes to managing the relational databases for our microservices, we've chosen MariaDB, a time-tested, dependable database system that enjoys widespread adoption across the industry. To maintain optimal separation and scalability, we've established dedicated instances of MariaDB for each microservice. This strategy guarantees superior isolation and scalability, affording each microservice its own distinct database for efficient data storage and management.
In addition to MariaDB, for our NoSQL requirements, we've embraced MongoDB as our solution of choice. Similar to our approach with MariaDB, we've implemented separate MongoDB instances for each microservice, ensuring the flexibility and tailored data management capabilities that each microservice demands.
Communication
For facilitating internal microservice communication, we rely on the NATS messaging system, renowned for its exceptional speed and robustness. When it comes to interfacing with the external world, we opt for the REST protocol, ensuring seamless and standardized communication with external services and clients.
NATS request-reply pattern. Source: https://docs.nats.io/nats-concepts/core-nats/reqreply
Development
As our project continues to expand, we have implemented a valuable tool called "cookiecutter" to streamline the process of creating new microservices from standardized templates. Cookiecutter accelerates project initiation by swiftly generating new projects from pre-defined templates, a functionality made accessible through a command-line utility. This tool is particularly well-suited for producing Python package projects and more, enhancing our development efficiency.
Thanks to Cookiecutter, the creation of new services has become a breeze. With just a simple command, such as make create-django-app or make create-fastapi-app we can instantly initiate new microservices based on our preferred Django or FastAPI templates, saving valuable time and ensuring consistency across our expanding ecosystem.
As our entire application is designed to operate within a Kubernetes cluster, it's essential to have a seamless local development solution that eliminates the complexities involved. Ideally, we aim for a system that not only simplifies local development but also automates processes such as rebuilding and running the application. To meet these objectives, we've adopted the "Tilt" tool.
Tilt serves as a comprehensive solution, automating every step from the moment code changes are detected to the instantiation of a new process. This encompasses tasks like file monitoring, container image building, and keeping your development environment in sync with the latest code changes. With Tilt in place, our development workflow becomes significantly more efficient, allowing our team to focus on coding and innovation without being bogged down by manual tasks.
Conclusion
Anqa Commerce's tech stack, built on these foundations, stands as a testament to the platform's dedication to providing a dynamic, efficient, and scalable e-commerce solution, ultimately enhancing the shopping experience for both customers and vendors.