BlogAnnounced at MongoDB.local NYC 2024: A recap of all announcements and updatesLearn more >>
MongoDB Developer
Sign in to follow topics
MongoDB Developer Centerchevron-right
Developer Topicschevron-right

Hostels Kenya Example App

4 min read • Published May 24, 2022 • Updated Jul 07, 2022
Facebook Icontwitter iconlinkedin icon
Rate this code example


Derrick Muteti and Felix Omuok from Kirinyaga University in Kenya contributed this project.

About the project

Hostels Kenya is a website that provides students the opportunity to find any hostel of their choice by filtering by distance from school, university name, room type, and even the monthly rent. It also provides the students with directions in case they are new to the area. Once they find a hostel that they like, they have the option to make a booking request, after which the landlord/landlady is automatically notified via SMS by our system. The students can also request to receive a notification when the hostel of their choice is fully occupied. Students have the opportunity to review and rate the hostels available in our system, helping other students make better decisions when looking for hostels. We launched the website on 1st September 2020, and so far, we have registered 26 hostels around our university and we are expanding to cover other universities.


I come from Nyanza Province in Kenya and I study at Kirinyaga University, the university in Kenya's central region, which is around 529km from my home. Most universities in Kenya do not offer student accommodation, and if any, a tiny percentage of the students are accommodated by the school. Because of this reason, most students stay in privately owned hostels outside the school. Therefore, getting a hostel is always challenging, especially for students who are new to the area. In my case, I had to travel from home to Kirinyaga University a month before the admission date to book a hostel. Thus, I decided to develop hostels Kenya to help students from different parts of the country find student hostels easily and make booking requests.

Why MongoDB?

My journey of developing this project has had ups and downs. I started working on the project last year using PHP and MYSQL. After facing many challenges in storing my data and dealing with geospatial queries, I had to stop the project. The funny thing is that last year, I did not know MongoDB existed. But I saw that MongoDB was part of the GitHub Student Developer Pack. And now that I was faced with a problem, I had to take the time and learn MongoDB.
In April this year, I started the project from scratch using Node.js and MongoDB.
MongoDB made it very easy for me to deal with geospatial queries and the fact that I was able to embed documents made it very fast when reading questions. This was not possible with MYSQL, and that is why I opted for a NoSQL database. Learning MongoDB was also straightforward, and it took me a short duration of time to set up my project. I love the fact that MongoDB handles most of the heavy tasks for me. To be sincere, I do not think I could have finished the project in time with all the functionalities had I not used MongoDB.
Since the site's launch on 1st October 2020, the site has helped over 1 thousand students from my university find hostels, and we hope this number will grow once we expand to other universities. With the government's current COVID-19 regulations on traveling, many students have opted to use this site instead of traveling for long distances as they wait to resume in-person learning come January 2021.

How it works

Students can create an account on our website. Our search query uses the school they go to, the room type they're looking for, the monthly rent, and the school's distance. Once students fill out this search, it will return the hostels that match their wishes. We use Geodata, the school's longitude, latitude, and the hostels to come up with the closest hostels. Filtering and querying this is obviously where the MongoDB aggregation framework comes into place. We love it!
Hostel owners can register their hostel via the website. They will be added to our database, and students will be able to start booking a room via our website.
Students can also view all the hostels on a map and select one of their choices. It was beneficial that we could embed all of this data, and the best part was MongoDB's ability to deal with GeoData.
Today hostel owners can register their hostel via the website; they can log in to their account and change pictures. But we're looking forward to implementing more features like a dashboard and making it more user friendly.
We're currently using mongoose, but we're thinking of expanding and using MongoDB Atlas in the future. I've been watching talks about Atlas at Asia, and I was amazed. I'm looking forward to implementing this. I've also been watching some MongoDB YouTube videos on design patterns, and I realize that this is something that we can add in the future.

Challenges and learnings

Except for the whole change from PHP and SQL, to MongoDB & Node.js, finding hostels has been our challenge. I underestimated the importance of marketing. I never knew how difficult it would be until I had to go out and talk to hostel owners., trying to convince them to come on board. But I am seeing that the students who are using the application are finding it very useful.
We decided to bring another person on board to help us with marketing. And we are also trying to reach the school to see how they can help us engage with the hostels.
For the future, we want to create a desktop application for hostel owners. Something that can be installed on their computer makes it easy for them to manage their students' bookings.
Most landlords are building many hostels around the school, so we're hoping to have them on board.
But first, we want to add more hostels into the system in December and create more data for our students. Especially now we might go back to school in January, it's essential to keep adding accommodations.
As for me, I’m also following courses on MongoDB University. I noticed that there is no MongoDB Certified Professional in my country, and I would like to become the first one.

Facebook Icontwitter iconlinkedin icon
Rate this code example

Entangled: A Story of Data Re-modeling and 10x Storage Reduction

Dec 14, 2023 | 5 min read
Code Example

Find our Devices - A locator app built using Realm

Jun 15, 2022 | 4 min read

Build a Totally Serverless REST API with MongoDB Atlas

Feb 03, 2023 | 5 min read
Code Example


Jul 07, 2022 | 1 min read
Technologies Used
Table of Contents