How we mocked inaccessible APIs
Client Background and Initial Engagement
A Swiss-based cryptocurrency brokerage that provides secure and efficient services for buying, selling, and trading digital assets. This company has become a trusted gateway to the world of cryptocurrencies, serving over 100,000 users globally.
This company operates in the cryptocurrency domain, specializing in crypto exchange services. Their expertise lies in facilitating cryptocurrency transactions, but they sought to venture into the NFT market, mainly offering gold NFTs for purchase. This represented a significant expansion into a new vertical within their business. This organisation discovered us through the Velox homepage. This company identified our established expertise in microservices architecture and commerce solutions, including the Velox base commerce framework, as a strong foundation for their project requirements.
Project Objectives
This organisation approached us to design and implement a tailored backend solution enabling their customers to purchase gold NFTs. At the time, they lacked any existing framework or infrastructure for this capability, making it a novel service offering for their platform.
Technical Challenges and Solutions
One of the most challenging aspects of mock APIs with OpenAPI specifications was integrating with external APIs. The project required several API integrations, such as fetching available NFTs, but we lacked direct access to these APIs during development. Typically, development involves access to staging or testing environments, but we had to rely on mocking to simulate the API interactions in this case.
Sly used the Prism Mock Server, a lightweight library for mocking APIs based on OpenAPI specifications, to address this. This allowed us to simulate end-to-end integration tests effectively, ensuring that our implementation conformed to the expected API behaviour -- we wanted to mimic real-world interactions using these APIs.
Mock APIs with OpenAPI specifications
This company's proposed solution was not a standard e-commerce implementation but a highly customized commerce application designed to address the unique requirements of gold NFT transactions. The design leveraged microservices principles to ensure modularity and scalability, allowing the application to evolve and support future services seamlessly. We structured the software into distinct modules, ensuring that these could later be extended or spun off into independent microservices.
Microservices are known for their ability to operate independently, enabling a decentralized approach to development and deployment. By structuring the application into modules, the groundwork is laid for transitioning to a microservices architecture, which offers advantages like fault isolation, independent scaling, and the ability to use different technologies for different services.
Implementation and Development Process
Sly initiated the development process of mock APIs with OpenAPI specifications. Sly estimated the workload and implementation complexity. Given the fintech and cryptocurrency context of the project, we had limited prior experience in this niche. Still, our expertise in microservices and commerce frameworks allowed us to deliver a reliable and efficient solution.
Testing and Quality Assurance
Sly authored most integration tests to ensure the backend responded correctly to the simulated API behaviours. These tests were embedded in the codebase, verifying that the system met the requirements without direct API access. This approach provided confidence in the application's reliability and readiness for deployment.
Key Project Highlights
- New Business Direction: The project marked our entry into NFT commerce, expanding its services beyond crypto exchange.
- Custom Implementation: The solution was entirely tailored to their needs, diverging from standard e-commerce templates.
- API Integration Without Access: Mocking external APIs using Prism was a unique aspect of this project, enabling thorough testing despite environmental limitations.
- Scalable Architecture: The modular design ensures adaptability for future microservices.
- Efficient Development: The project was completed within a limited timeframe (200 hours), showcasing efficient planning and execution.