1. Code
  2. Roundups

Develop a Social Media Website With These 10 Code Techniques


Social media sites have gone mainstream over the past few years, and it's affected web developers everywhere. With the success of sites like Digg, Twitter, Reddit, Delicious and Friendfeed, many developers have turned to adopting some of the practices of social media into their own sites. In fact, it's not that hard to build your own social news portal, with the help of a few key coding techniques and libraries.

Here you'll learn 10 clever coding techniques to help you build killer social media websites for yourself and your clients.

Here are a few "total packages" that you can use to build your own social media site:

We're going to dissect the most important features of social news sites, and showcase example code and libraries that can help you on your way to developing your own social media website.

1. Activity Stream

Ever since Facebook introduced activity streams to their user profiles, the concept has gone mainstream. It turns out that people are fascinated by their friend's activities. Really fascinated. Knowing every move that friends make, (without technically being a stalker), adds a lot of engagement and another "sticky" factor, keeping visitors at the site longer.

Joomla has a user feed plugin, and Drupal has an activity stream module that accomplishes this as well.

Photo by Ashley_Dryden.

2. User Authentication and Profiles

Kind of a no-brainer, right? It turns out that there are many different methods for setting up a user management system, and it all depends on your preference. Would you rather use a pre-existing solution, or create your own? What language do you want to build the site in? How many levels of access will your site need? These are a few of many questions that will be asked along the way.

If you'd like a more fine-tuned approach to building your site, you might try a framework like Django (python) or CakePHP (PHP) to build out your authentication system. These frameworks have built-in user authentication, and make it easy to develop the site around the user system.

If you're wanting to spend less time on authentication, you might try a content management system like Drupal (PHP) to build your site around. Drupal is an excellent CMS to use for building community sites, and has many modules to help you build out other functionality that you might need on your social site. Other content management systems like Joomla and Wordpress can also work well for building social sites.

3. Invite a friend

At the heart of every social media site is the desire to become "viral". One of the best ways to go viral is to have an "invite your friend" script that furrows into your user's email address book and does at least one of two things:

  1. It helps you find and link your contacts who are also members of the social media site.
  2. It invites contacts who aren't part of the social media site

Essentially all of the major social media sites like Friendfeed, Digg and Twitter have this feature. Having your users promote your product is the most effective form of advertising, and best of all it's 100% free.

Photo by Elven***Nicole.

4. Recommendation Engine

Showing recommended and relevant content is an excellent way to increase engagement and activity on the site. Reddit and Digg have excellent examples of recommendation engines, and the Digg blog even gives a snippet as to how big of an impact the addition of their recommendation engine has had on their stats.

- Digging activity is up significantly: the total number of Diggs increased 40% after launch.
- Friend activity/friends added is up 24%.
- Commenting is up 11% since launch.

With stats like that, it's pretty apparent that a recommendation engine could really help your social site. Many of these content recommendation engines are built on the Slope One Algorithm. Drupal has a Content Recommendation Module, which is also based on the Slope One Algorithm.

If you can create a great recommendation engine for your site, you'll have higher engagement and more clicks.

Photo by Noxious Nation.

5. Private Messaging

Private messaging is another solid feature that a social media site should have. Any way you can increase communication amongst your site's users, the better. Private messaging is a great way to keep your users coming back to the site. It's not as intrusive as email (unless you enable email notifications), and it isn't in real-time like IM. It's a simple layer of functionality that makes communicating across your site easier.

The great part about the private messaging feature is that it's already built-in to many CMS scripts. However, many sites don't even turn on this feature. Take advantage of this (mostly) pre-built functionality and keep your visitors happy and chatting with each other.

Photo by James Cridland.

6. Status Updates

Twitter has made the status update another mainstream aspect of social media sites. Letting the world know what you're doing at an exact moment a popular way to add engagement to a site. As most Twitter users will vouch, it's incredibly addicting.

What's even better for the developer is that it's probably quite easy to implement on your system. Status updates (or microblogging) is only a matter of having a limited content type (Twitter limits to 140 characters), and adding comments to it. Facebook's implementation of status updates allows friends to tack comments onto the statuses. is an open source platform for microblogging, and it powers sites like If you're using a content management system like Drupal or Joomla, it's quite easy to make a content type that has a limited number of characters and allows commenting.

Photo by Andrew Kumar.

7. Multiple Ways of Viewing the Data

In order to increase engagement and clicks on the site, social media sites like Digg allow you to view data in many different ways. For example, on the Digg site you can view:

  • New upcoming stories
  • Popular upcoming stories
  • Popular stories in the last 24 hours
  • Popular stories in the last 7 days
  • Popular stories in the last 30 days
  • Popular stories in the last year

... and many more.

Adding useful navigation that highlights different ways of viewing data like stories and statuses is a superb way to increase the clicks on your social media site. Everyone has different preferences, and allowing people the flexibility to tailor their experience viewing your site is a big incentive to keep them coming back.

Photo by Arol Balkan.

8. An API

This is probably the hardest aspect of an advanced social news site. Opening up your site with a public API for developers is a stellar way to increase awareness of your product. Now you've got hundreds (maybe thousands!) of different developers creating websites and software that allow to more easily find your site and data. Instead of having to fulfill every request for new features, an API allows anyone to mashup your data and display it however they want.

The only problem with an API is that it takes lots of work by the developer. Aside from the extra programming, there's documentation, support requests and all sorts of issues that surround having an API. And there's no really good way to provide a true API without advanced programming. However, there is a new service that just launched today called 3Scale that allows you to quickly and easily create an API for your web service.

Photo by Caterina.

9. Voting

At the heart of most social media sites is the ability to vote on content. On sites like Digg and Reddit, your vote determines whether or not the story will be made "popular" and shown on the homepage, or it can prevent the story from being seen by many people. Aside from the psychological aspect of being in control, voting provides lots of engagement factors to the site. If you're going to vote on one story, odds are you'll vote on many more. Click, click, click.

There are many great libraries for adding voting to sites for any different platform or language. Drupal has the robust Voting API which allows you to hook voting into many other Drupal modules. Joomla has over 22 voting extensions. A simple search on Google will reveal tons of PHP, ASP and Perl open source scripts for integrating voting into your site.

Photo by TheLawleys.

10. Widgets

What would a social media site be without a widget? Digg derives a hefty chunk of their traffic from voting widgets that people place on their site, in hopes of being submitted or to increase their vote count. Twitter, Friendfeed and Delicious allow you to put JavaScript or Flash widgets that show your latest interactions across these sites. By adding a widget to your social site's offering, you're increasing it's viral factor.

The beauty of most widgets is that they usually derive from a simple piece of JavaScript (or Flash), and could be made using RSS feeds or API calls. Sites like WidgetBox allow anyone to quickly and easily create a widget, if you're needing inspiration.

The widget is at the core of viral distribution of content in a social media site. Showcasing your best content or user content on blogs across the Internet helps bring traffic and interest from every corner of the Net.

Photo by Stuart_Frisby.
  • Subscribe to the NETTUTS RSS Feed for more daily web development tutorials and articles.

Glen Stansberry is a web developer and blogger who's struggled more times than he'd wish to admit with CSS. You can read more tips on web development at his blog Web Jackalope.

Liked this post? Vote for it on Digg below. Thanks!

Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.