Some people asking around about which technology that CodeSaya uses. Some even speculated that it is running on WordPress. Seriously, WordPress? To avoid slandering and defamation.. no just kidding, we love WordPress. To answer that question, we will share what is under the hood of CodeSaya. If there is someone out there who like to build a similar app, hopefully this can help. Or if you think that our technology preferences suck and we can do better, please kindly inform us.
(this post is originally written by me in Bahasa Indonesia in here)
Normally startups and corporates start to talk about their technology stack when they are already receiving humongous amount of traffic. We are far from that level, but we like to do it anyway. This is the architecture that we use in CodeSaya:
Server Architecture of Codesaya
Django is a framework to create web apps. The first reason why django was picked is because it is Python. Writing and reading code in Python is a pleasure. When a project becomes big, the simplicity and elegance of a programming language is crucial. Programmers spend a lot of time reading the code instead of writing it. If your code has become a spaghetti code, forget about implementing a new feature, it is already a pain in the ass to even fix a bug!
Programmers spend a lot of time reading the code instead of writing it. If your code has become a spaghetti code, forget about implementing a new feature, it is already a pain in the ass to even fix a bug!
Framework in python is not only Django for certain, but it is an already powerful and mature framework. At first it is quite difficult to grok it but once you are used to it, developing a new feature or fixing a problem is as natural as breathing.
Bootstrap is an HTML and CSS framework. Using it makes our website a pleasure in the eyes. The decision to pick it beacuse it has a beautiful and clean design, easily understood, and very popular. Framework popularity is very important to find a solution on the net if you encounter a problem.
You mush have heard many time about choosing MySQL as a database for your website. Our recommendation is to use PostgreSQL instead. It has less quirks and has better performance compare to MySQL. As a bonus point, PostgreSQL is not owned by a big corporate as MySQL which is owned by Oracle. Fortunately, a lot of web hosting companies has already supported PostgreSQL. But if you insist on using MySQL, it is better to use MariaDB. It is built by the original authors of MySQL and 100% open source.
Django has a great ORM. Here in CodeSaya we don’t have a single line of SQL command in our codebase. And also with Django, it is fairly easy to switch from one database to another database. So it is always a good idea to have a framework with good ORM.
Nginx + Gunicorn
Nginx’s is used as a web and proxy server to handle requests from the cloud. When the request is for static files (images, js or css files, etc) then Nginx will handle it by itself. But when the request is something else then Nginx will pass it to Gunicorn. Gunicorn is an HTTP server to run python code. The alternative of Gunicorn is uWSGI which has slightly better performance. But we chose Gunicorn over uWSGI for Gunicorn’s easy configuration and deployment. When you are encountered by two solutions for your problem, pick the simplest one to implement. Meanwhile, Nginx is a new kid on the block as compared to Apache. But Nginx has much better performance and can handle thousands of concurrent request easily.
When you are encountered by two solutions for your problem, pick the simplest one to implement.
Memcached is utilized for caching. As for our online code editor, there’s an awesome tool called as CodeMirror which we use. CKeditor is employed for the editor to write articles. To analyze the traffic Google Analytic comes into the scene. And as last Ubuntu 14 is the operating system which run all those software.
The upcoming technologies
At the moment we are only using one virtual machine (VM) from DigitalOcean. All those elements are powered by that one VM. At the moment it is more than sufficient. But once we have a lot more traffic, we have to resort to use more than one VM. So we are considering to implement Docker and Ansible in our technology stack to ease the deployment of CodeSaya in more than one VM. Hell, even when we are using only one vm, we are planning to do it soon. Also we are thinking to put Varnish in to support Nginx. And we are learning the possibility of Redis in our stack to replace memcached.
Hopefully there’s something you can take away from this. If you have comments or suggestion for our technology preferences, please kindly deliver it to us. Thank you and have a nice day!