Video Hosting

Backend for video sharing mobile application

A few words about the project

Client hired us to develop his video sharing service, built with Yii1 and running in Google App Engine

Initial analysis

We always start our work with checking client's existing code. The goal is to find potential problems with code and determine how easiliy it can be maintained. It is important to do that before actual work has started, so client knows the estimates.

In this case code was poorly written. It seemed that previous developer tried to convert some kind of reataurant management application into video sharing service. So it had lots of code, that had to be cleaned up. Most of the application code was stored inside one extremely big api controller with minimum use of models, relations and even query builders. Such poorly built projects are very dangerous, it always contains errors, some of them client doesn't even know about. When you start fixing one part, another can unexpectedly get broken. So we always inform client that code needs to be refactored before we start adding new features.

Unfortunately in some cases client is limited by time, his application is about to be released and spending whole week just to fix the code is not an option. As you understand we've got exactly that case :) Ok, informing client about the potential risks and start working. Luckily we have special approach to handle such problems - first we find what code will be affected by new feature and then refactor only that code. Gradually code becomes more and more structured and clean.

Environment setup

Creating staging web application for client, where he can see our modifications before they are published on live. Discussing with frontend developer hwo we can easily switch mobile application between live and dev servers. Additionally creating backend code that will help us debug problems. Luckily it is really easy to create additional version of application using Google App Engine

Recommended videos

Client requests new feature that will select recommended video for every user. Selection should be based on complex formula, that takes into account user preferences, video owner's rating, video likes, views and duration. Obviously performing such calculations with every request is a bad idea, so creating "recommendations" table and updatng it via cron. Adjusting weigts of each factor and formulas until client is satisfied with listing and moving these parameters into configuration file.


Implement emoji support for iOS notifications. This task looks simple at first - just send text containing emoji code to Parse. But there is a problem - PHP is not really utf-8 friendly language. If you want to properly output emoji you have to use some not obvious techniques such as using json_decode() to parse utf8 codes. Creating small component for application, testing notifications - success!

Multiple tokens

Initially application was developed to work with only 1 device per account with primitive authentication (via device id). Later client realized that same user may login via his iPhone and iPad at the same time. So we had to develop login feature which meant user table, logins, email verification, password restore. Also we had to create additional table that will associate several sessions with 1 user account

Date: Jan 2016 — Mar 2016


Project team
Alexandr Makarov