How to create a website like Twitter?
Here is how I created a website like Twitter.
You may be wondering if it is at all possible to create a website like Twitter. Maybe you are thinking whether it is possible to make a Twitter-like website entirely by yourself? Well... I was able to make something very similar to Twitter, so certainly it is possible.
I don't like to copy things to the exact detail, so I decided to get creative and add a few of the features that I found to be personally interesting as well.
I created this web page to share my knowledge how I created such a website features the news feeds (that I call Channels). I will try to brleifly explain how I created this site.
Below I provide a preview image of what my Twitter-like website looks like, just to get you a basic idea of what it's like.
So where is my Twitter-like website?
The website I created, featuring user account registrations, email account confirmations, user picture uploads, Twitter-like updates (actually very similar to Facebook), feed comments, friend's lists, on-site inbox, "like" messages functionality, and a few others... is called Authentic Society. This is a constant work in progress, so it may not be perfect. But the matter of fact is that it works and many people signed up and were able to figure out how to use it.
How long did it take me to build Authentic Society?
Authentic Society is something I have been working on for a very long time. It is based on a PHP framework I developed over the years. This framework is a big part of Authentic Society. Every time I start a new website, I always use this PHP framework because of my previous experience using it (I was the one who created it after all), so it makes sense to me. Even Website Homework and my other website Fallout Software are written using that same PHP framework. This helps me to manage more than one website using familiar code and directory tree structure.
Most of my knowledge comes from experience of working at start-up software companies. I have also done a large amount of research on the subject of web programming in my spare time. It's basically my hobby, it's what I do even when I am not working.
Do not ask me if it's possible to create a website like Twitter for free! That's not quite possible. When you work on a large scale website such as this, it is inevitable that you will spend time on research, programming and creative graphics (like submit and post message buttons). Programming a website with custom features requires time and effort. There isn't a way to create a Twitter-like website for free. On the bright side of things, the source code of a website that functions like Twitter is considered intellectual property. And if you can pull this off, then you may be able to sell it to other people or use it for your own needs.
Creating a website like Twitter requires at least basic knowledge in the areas described below. If you have never programmed any type of a website before, you may find it extremely difficult to learn. But at least I can share what I know with you and point you in the right direction. If you end up making your own Twitter-like site based on this information, then I have succeeded.
Making a website like Twitter: The road map
These are the things you must understand in order to build your own Twitter-like site.
Which code/text editor to use? You can use any free text editor to build your Twitter-like site. But I use IntelliJ IDEA for everything. There is simply no other IDE (Integrated Development Environment) that exists right now that can match the set of features of IntelliJ. It allows you to write code in all languages you will need to know in order to build a Twitter-like site. But it's expensive. If you are serious about learning to program websites and have the money to spend, I recommend getting it. It's worth every penny, at least to me. I believe there are free student licenses (or discounts) available. I am not affiliated with them, I just can't imagine writing code using any other editor.
Can you write computer code in a basic text editor such as Notepad (on Windows / PC) or TextWrangler (on Mac /OSX )? Sure you can! But an IDE will help you with things such as code complete (completion of code as you write) and many other features tailored to suit programmer's particular needs.
HTML The Hypertext Mark-up Language is the basic building block of any website. Modern websites (I am writing this in 2011) usually use DIV tags to construct the layout and navigation. You need to understand how to construct some basic elements of a Twitter-like site using DIV fields. That's the easy part. You will also need to learn how to keep your code refactored (basically another word for organizing code in computer jargon), otherwise you will become quickly disoriented while looking for something in particular throughout your code.
Client-side vs. Server-side programming Writing code in HTML is referred to as writing client-side code. What people mean by this is that HTML code is executed in the browser using the processors inside your computer. The browser is the client.
The next item you need to know about once you've tackled HTML, is PHP. PHP is executed on the server where your site is hosted. Therefore, writing PHP code is referred to as server-side programming. In order to create a website like Twitter, you must have knowledge of programming in languages that are considered both server-side and client-side.
PHP helps with the dynamic aspects of the site, for example actually processing the message submitted by your Twitter-like input box. All messages submitted into your Twitter feed will be stored in a MySQL database. PHP is used to actually write the message to store it in the database. Once it's stored, PHP can also retreive it back and display it in your web browser.
PHP PHP is a recursive acronym that stands for PHP: Hypertext Preprocessor. PHP is a server-side programming language that is also often thought of as a script language. PHP can also be used for building entire web applications and is a popular choice for making Facebook apps. After you've got your basic layout constructed using HTML, you will have created DIV blocks for things such as displaying Twitter feed, Twitter-like feed messages, and so on. By writing server-side PHP code, you will be able to make your site dynamic. In other words, unlike HTML, PHP will allow you to display DIV blocks, feed messages, and so on... by making choices as to when to display which message and to who. On Twitter, not every user receives exactly the same messages. Each user has a unique ID, and so this logic is programmed using PHP. In addition, PHP is a great tool for communicating to your database such as MySQL database.
MySQL Database MySQL is used for storing all the data used by your Twitter-like website. We connect to a database using a username and password, by executing a PHP command. We can insert, delete and modify existing entries dynamically. Do we have to use MySQL to create a website like Twitter? No, we can use any other database. But here I explain it using PHP and MySQL because that is how I did it.
Your MySQL database will contain tables. A table is a place where you collect items of a specific type. For example, a table named users will contain information such as usernames and passwords of all users who signed up for your site. A table named feed could contain all the feed messages that registered users from the table users have posted. Another table name could be inbox for storing mail messages sent between registered users. And so on.
Java can be looked at as both a language and as a server-side platform that will run on a hosted server and execute commands (or functions) in real time. In the beginning stages you will probably not need to know Java in order to provide the basic set of Twitter-like features on your site. But when performance starts to matter more, you will probably want to write new, or re-write existing code previously written in PHP using Java to increase performance of your software.
People (especially Java programmers) can debate that Java is faster than PHP. Yes it's true, but others who have found this article on Google may not even be familiar with programming at all. Java requires additional programs such as Tomcat running on the server, which means you will need to know how to set it up (not an easy task for a beginner). PHP, on the other hand is readily available on all modern web hosting companies, all you have to do is learn how to write PHP code. In this case, it's probably best to write your first Twitter website using PHP. The point is, if you already know Java you probably already know how to make a Twitter-like website!
You might have a question: Does PHP code work in all browsers? Well, that's a wrong question to ask. You see, as I mentioned earlier, PHP is a server-side language. That means it is executed on the computer which is hosting your website. This code is executed outside of your browser. Your browser runs on your computer, but it does not process PHP code. It only displays the results of your PHP code.