Cannabis dispensaries used phone calls, text messages, and email to place orders with vendors causing delays and inaccuracies with order fulfillment. The LeafTrade team had an idea to streamline the order fulfillment process using technology.
The major technical challenge in developing LeafTrade was to find a balance between quickly developing new features to meet a tight schedule while setting up an appropriate foundation for future directions. When we first started with the project, it had been built in an ad-hoc fashion for specific industry needs without having taken into account features which where urgently required, specifically:
- A graphical storefront/shopping cart and other traditional ecommerce features
- The need to accommodate a growing number of customers, some with extremely varied inventory management and sales procedures
We realized quickly that adding on to the existing codebase would result in having to deal with an increasing amount of technical debt and make it difficult to reach the project’s goals in time, but the time and effort required to do a complete rebuild of the project from scratch was also too high. As a result, we decided to start with an existing e-commerce framework as a foundation, leverage the features it provided, and implement the features from the previous application as needed along with new development work.
After completing the first release candidate on the new framework, we began testing the migration to the new platform – specifically, we developed a set of data transfer scripts, as well as procedures for onboarding customers onto the new platform. We made a series of test migrations, allowing the client and customers to verify that data was being transferred correctly, which allowed us to transition to the new platform with only a few minutes of downtime. The migration was a success, and existing customers were able to immediately use the new platform the next day after the final migration. We were then able to continue further development on new features as required.
Backend Framework and Structure:
LeafTrade uses a django/python/postgresql stack, with redis for caching. The original e-commerce framework was Saleor, which we used as a basis for future development. Early in the process, we made the decision to fork Saleor and not attempt to maintain compatibility with the base project, for two reasons:
- While Saleor is a solid ecommerce framework, it lacked many industry-specific features, and didn’t have a plugin system sufficient to support them.
- LeafTrade has the unusual property that while the raw number of sales is relatively low, the product catalogs are quite large and individual orders were also frequently large, so we wanted to be sure to directly support this in terms of optimization, etc.
In addition, for security and future-proofing, we updated the codebase to work with the latest stable versions of django and python.
Frontend Framework and Structure:
Out of the box, Saleor used a hybrid of jQuery and React for the frontend interface, together with graphql for some connections with the backend. While this worked well enough, we felt like it contained too many pieces and, additionally, several customers requested an API interface to build integrations with their internal systems. We therefore decided to standardize on a REST api and remove graphql entirely.
We also limited the use of new jQuery code in favor of using React as much as possible for a responsive modern interface. However, we decided against making Leaftrade a single page application in favor of implementing React UIs as needed. This allowed us to leverage django’s built-in features for rapid development while still giving us the option of rich client-side experiences when required.
Deployment and Testing
While high availability is a priority for most e-commerce platforms, they can usually withstand a certain amount of downtime without it being a major issue. Conversely for LeafTrade, even from its earliest stages, required excellent reliability – tight ordering windows enforced by vendors means that much of the activity is carried out immediately before the end of the week and at other times. Any downtime during these periods was unacceptable. To this end, we deployed LeafTrade on completely redundant infrastructure via Amazon Web Services (AWS). All application servers, database servers, and caching servers were duplicated. In addition, we used docker with AWS’s elastic container service to ensure that if there was a failure, it would self-heal and replace the failed component with no human intervention.
We also implemented a continuous integration system with mandatory integration test phases before release to limit the number of issues encountered during a release and prevent mistakes.
The combination of these measures allowed us to maintain a very high uptime even while the site was under rapid and active development.
We suggested the LeafTrade team utilize our dedicated team model. With this model we helped ensure the LeafTrade team could scale quickly while not taking on the overhead of hiring a full development team. The dedicated team model gives an early stage company access to developers and designers, that work solely on their project, acting as their own team.
Since the cannabis industry moves quickly but lacks technology platforms to support the needs of the industry we wanted to ensure we build a platform that could be built quickly but scalable. We wanted to help support the team with a combination of design, development and strategy resources so their team could have the support to focus on client relationships. Our leadership team who has experience in building marketplaces and client relationships stepped in to help act as the CTO to ensure product decisions were seamlessly made without stress on the day to day operations on the business.
- A functional product that supports a two sided marketplace
- A redesigned product design
- A product that was able to raise $4.5 million in funding
“Vault Innovation’s discovery phase propelled the once-simple MVP towards a platform that users continue to praise for its functionality and design. Autonomous project management, communication, and adaptability are valuable attributes, while thorough resource vetting fosters confidence.”— James Yi
Work With Us
Have an innovative solution for an industry but need a technical team to help build it? Whatever your idea is, we can help design and develop the software for the idea. Contact us today for a free product discovery session.
To start the conversation email us at firstname.lastname@example.org.