Soylent is a simple, nutritious, and affordable food that possesses all the essential ingredients a body needs to be healthy; it’s a convenient powder that is mixed with water and provides a complete meal for those looking for an easy, healthy, and cost-effective option to preparing meals.
The product’s nutritional makeup is comprehensive. It includes protein, carbohydrates, fats, fiber, and vitamins and minerals such as potassium, iron, and calcium. It contains all of the elements of a healthy diet, with limited contribution from less desirable components such as sugars, saturated fats, or cholesterol. The Soylent recipe is based on the recommendations of the Institute of Medicine (IOM) and is approved as a food by the Food and Drug Administration (FDA). The list of ingredients includes oat flour, rice protein, and omega 3 fatty acids extracted from algae. Our custom microvitamin blend provides essential nutrients like vitamin D and folate, and electrolytes such as potassium.
In order to validate demand for the product, we launched a crowdfunding campaign in May of 2013 using Tilt/Open, a white label crowdfunding platform software from a fellow Y-Combinator company. Our initial goal was $100,000, but we quickly went on to raise $3 million and become the largest food-related crowdfunding campaign in history, a title we still hold to this day. Since then, we have gone on to gain tens of thousands of subscribers, release 5 substantial improvements to the product, and raise a $20 million Series A from Andreessen Horowitz to fund our next stage of growth. Our company is now 20 full-time employees and is headquartered in Los Angeles with production facilities in California and Colorado.
I serve two primary roles at the company, CTO and co-founder. As CTO, I lead the engineering team and help build great software to make our company as efficient as possible. As a co-founder, I help out with all the random stuff that naturally comes up in building companies.
Although we have been working on Soylent for over 2 years now, the engineering team was only one person (myself), until last October. Early on, the business was changing so quickly, we used mostly off-the-shelf software services to accomplish our basic business goals. We launched our crowdfunding campaign on Tilt/Open, fulfilled them using ShipStation, and, after completing our initial product development cycle and fulfilling our initial crowdfunding orders, launched a new e-commerce site using Shopify and ChargeBee for one-off and subscription orders respectively. This allowed us to have a highly front-end design tailored specifically to our brand, while not having to build a proper e-commerce platform. We launched the site in about a month and were able to take advantage of all of the “batteries” Shopify and ChargeBee include in their services. We still had custom scripts to fill gaps in the platforms, but 90% of our problems were solved right out of the box. We selected Shopify because it struck the right balance between ease of use and extensibility. It’s a fully-hosted solution and comes with it’s own CDN already hooked up, but also has a solid API with webhooks so you can start building on top of it quickly. ChargeBee has similar features but specializes in subscription payments. Both are extremely affordable solutions and worked fairly well together during the time we were relying on them heavily.
Current E-Commerce Stack
Now that we have a solid engineering team, we’ve built a system which we believe offers the ideal tradeoff between scalability and flexibility. Consequently, we are now prepared to both handle the next order of magnitude of e-commerce activity while simultaneously rolling out new features quickly.
At the top of the stack is Amazon Route 53 pointed at Heroku’s routing mesh. Separately we have an Elastic Load Balancer sitting in front of a few nginx instances to handle our transition from soylent.me to soylent.com seamlessly. Nginx handles routing all of our subdomains and legacy url structures to our new site and required very little time to setup.
From there, Fastly serves all of our assets over a CDN. Fastly plays well with Heroku and has some nice tunability under the hood that gives us flexibility when we need it. We still use S3 from time to time for larger files that we don’t want to store in our repo, but we aren’t leaning heavily on it. Our core e-commerce app is written in Python and uses the Django web framework. The newer features around data modeling and migration generation have been helpful and we’ve yet to run into a framework issue we couldn’t solve quickly. Django is slightly less popular than Rails for e-commerce apps, but the scientific Python community more than outweighs any Rails specific gains to be had. To date we have used Python in every division of the company and in many different capacities. Finance has used Python to crunch numbers, marketing has used data science toolkits and iPython to understand customer segments, the product team has used PyMOL to create molecular visualizations, and the list goes on. Although e-commerce is the sole channel through which Soylent is available for purchase, we are not strictly an e-commerce company. We are a food company focused on engineering the ideal staple food and to that end, we leverage technology to help us design and deliver the best possible product that has been optimized around several criteria, primarily health, affordability, and convenience. Industry standard tooling for this type of work is sorely lacking and we have had to resort to building our own tools in many cases. The ability to assist in all aspects of the business with a single programming language has been a huge selling point for Python in our organization.
Longer running processes that need to be executed asynchronously are sent to a RabbitMQ task queue managed via Celery. Sending Mandrill API calls for emails, tracking back-end analytics in Segment and Google Analytics, and handling webhooks from external services all flow through our queue-worker system which has helped keep the app snappy on very limited hardware. It requires some thoughtfulness when designing how data will flow through the system, but ultimately pays off in responsiveness and scalability. It’s not uncommon for us to receive huge gluts of POST requests to our webhook receiver endpoints as data changes on counter-party systems and we need to be able to perform a non-trivial amount of work on each payload. CloudAMQP, which serves as a RabbitMQ as a service, has absolutely no problem handling the data and then our workers can process everything over time, obviating the need to scale up web servers to handle the load.
For persistent data storage, we use PostgreSQL and couldn’t be happier. The deployment and management on Heroku couldn’t be simpler. Back-ups and read-slaves are available at the click of a button, and the benefits of Heroku’s Dataclips product cannot be emphasized enough. Dataclips allowed us to roll out read-only database access to the majority of the company in a manageable way in a matter of days. Everyone in the company was able to start running queries and working with real-time data in spreadsheets with no ETL process or glue-code typically required for reporting. We have since rolled out Chartio on top of Postgres and had no problems at all with any of the usual frustrations that come up when using business intelligence tools.
Perhaps the biggest benefit of Postgres has been the flexibility to mix in non-relational, key-value data as necessary. Due to our reliance on 3rd party systems early in our company history we have a lot of unstructured data floating around. We obviously want to store the data and make it accessible for the long term, but we don’t always know what we will need to do with it later, and don’t want to waste time trying to design the perfect schema around it. By dumping this data into either a Postgres HStore or JSON column, we can safely store the data, and even create a synthetic schema on-top of it as needed using views. As our data needs evolve and the business goals become clearer, we can dive a level deeper to optimize the schema and apply structure to the non-relational data without breaking any of the current uses. This layer of abstraction allowed us to complete a fairly sizable multi-system integration in only a few weeks.
Processing and fulfilling orders is handled through several Python scripts which validate, sort, and transform orders as necessary before posting orders to ShipWire’s API. Our fulfillment system has evolved over a couple iterations to be much more precise and flexible, ensuring that we catch any errors before orders go out the door, while still letting our operations team control order flow on a fairly granular level based on inventory supply and projections. We recently blogged about our initial order fulfillment system, and I highly recommend reading it for a comparison.
DevOps & Workflow
When working on the project, everything is run locally in Docker and then deployed to Heroku for staging and production. Docker has simplified on-boarding new engineers and completely standardized our development environments. We aren’t using it in production yet, but I wouldn’t be surprised if we started to soon. In addition to testing locally in Docker, we use CodeShip for continuous integration and deployment. The GitHub and Slack integrations are rock solid and it’s really sped up development. We also use Rainforest for QA as a service to run real-world tests on our site. This has helped immensely with cross-browser testing and helped us verify the end-to-end functionality of each build.
As we move forward, we’re fortunate to be pleased with our engineering structure and project workflow. Building this system from start-to-finish took months and we have lots of new opportunities on the horizon. We now have a fairly stable ecosystem of tools and frameworks that work extremely well for our business and contribute to efficient and effective software development. We hope that by offering a peek into the inner workings of our company, we can receive thoughtful feedback on what we can do better and prepare for the future. If you want to build software for the future of food, join us! We are open to candidates with a variety of backgrounds and experience levels. You can view open positions at jobs.soylent.com.