Campus Discounts uses several Compose-hosted databases including MySQL, MongoDB, Redis, Elasticsearch and RabbitMQ to power their social media platform. Recently they started exploring IBM Watson to add cognitive features to the app. We sat down with founder and CTO Don Omondi to hear their story.
As a student in Kenya, Don Omondi had difficulty getting information when he was looking to buy a cell phone. “I had to travel more than 22 miles to the nearest town to start window shopping for a phone.” He knew he wasn’t the only one struggling with buying the necessities. “Maybe I could create a platform which will make it easy for students like me to find and buy things easily and from sellers nearby,” Don told us. The opportunity came when IBM held their SmartCamp competition in Nairobi, where Don was among the finalists. Shortly thereafter, he founded Campus Discounts to realize his dream.
Campus Discounts is a social network where students find and recommend discounts posted by vendors near their campuses. Businesses create pages and post discounts on the campus site. Students can then view their campus page and find discounts nearby. After a free signup, students can select product categories of interest and also connect to fellow students through the buddy system. Students can also flag bargains and notify their friends easily via recommendations which make up a users’ news feed and timelines.
Businesses who are interested in listing their offerings can tag up to 3 locations which will make the discount show in all campuses within a default 10 km radius or they can target a wider geography for an extra fee. They can also get analytics like traffic flow, behavioral trends etc., on the same platform. Localization of the platform (language, currency) is done automatically. At the moment, Campus Discounts doesn’t have any peer-to-peer sales model but that’s on their roadmap, including transaction processing and other e-commerce features.
Powering the data layer of the platform are six databases. MySQL is used for ‘primary’ data such as users, discounts, business pages, apps, and sessions. Redis is used to cache this data for redundancy. MongoDB is used for storing ‘secondary’ data. This data is derived from actions on primary data such as likes, comments, follows, ratings, reviews, friendships, etc. Don likes MongoDB because “We can store and retrieve all these little pieces of data easily - they don’t have to be related with one another.”
The majority of the site’s user-centric features are handled by Elasticsearch. “The reason we use Elasticsearch is for its power of geographic qualities, scoring and sorting of data and flexible search capabilities,” said Don. Discounts have a geoshape field mapping while campuses have a geopoint field mapping which, for example, allows them to do a query in Elasticsesarch for any discounts belonging to specific categories, with at least 5 likes, that have the word ‘Samsung’ in their description and within a given radius (e.g., 10 kilometers). “Elasticsearch makes these kinds of queries very easy to implement.” The fifth database Campus Discounts uses is JanusGraph (currently not hosted on Compose). It’s a highly scalable graph database which is originally a fork of the popular open source project Titan. Don uses this for graphing relationships between registered and non-registered users for social invites as well as to suggest new friendships on the platform based on their interests, what businesses they are following, and so forth. This also makes it easier for businesses to provide targeted discounts to student segments. Finally, Campus Discounts uses Compose for RabbitMQ, a popular message broker to synchronize, track, route, and queue tasks that need to be processed later. “All our secondary data is persisted asynchronously, developers who tap into our API can activate webhooks to know when it’s done”
Running on top of the databases is PHP Symfony (a collection of reusable PHP components) for the backend and Ember.js plus Node.js on the front end. Why PHP? According to Don, “A lot of people hate on PHP, but it has an unrivaled community and library support which can be priceless for certain use cases. For example, Symfony comes with Doctrine, a mature data persistence library for ORM, ODM and Cache as well as ways to integrate them all.”
Don has shared his experiences working with multiple databases and application stack in several articles under Compose’s WriteStuff banner. You can find them here.
Recently, Don started experimenting with IBM Watson to embed its cognitive abilities into the Campus Discounts platform. One idea that he loves and has already implemented is matching real world items with discounts posted on the platform. As he explains, “Wouldn’t it be cool if you see this dress or bike that you really like, you take a picture, upload it to Campus Discounts, and we find nearby offers that match that image?” With Watson, he can now do that. He’s also expanded this into a chat bot and voice command like feature. As he explains, “Using the HTML5 audio API, you can talk to our Watson Bot to find specific offers, or even to log out.” Don reckons since Compose databases are already available on IBM Bluemix and Watson Data Platform, it’s secure, easy and performant to blend the two, “Watson makes sense of it then Elasticsearch finds it”.
So, why Compose? “First and foremost, as CTO of a growing startup, I have a lot on my plate right now. Compose really comes in and takes the weight off my shoulders. I can focus on developing my code; I don't need to worry about installing databases, keeping them up to date, keeping my platform live and keeping it secure. And when I do need help, I can rely on your support team for a prompt response.”
Don likes the fact that as a cloud platform, Compose allows him to host databases in many locations and with different service providers like Google Cloud Platform, Amazon AWS, and IBM SoftLayer. He also likes to play around and try out new things, “Compose recently introduced ScyllaDB, which is a faster, Cassandra replacement database. So, if I wanted to test it out, I just need to spin it up with a click and try it in minutes.”
With hard work and Compose’s help, Campus Discounts has seen rapid growth since its inception in 2015. It’s now available in over 36,500 campuses worldwide.
To learn more about Campus Discounts, visit: https://campus-discounts.com/.
If you have any feedback about this or any other Compose article, drop the Compose Articles team a line at firstname.lastname@example.org. We're happy to hear from you.