Templates for creating applications like a social network?

I need to design / architecture / develop a network application such as a social network.

Main functions:
- users create accounts in the system
- users agree "each other"
- users create content in the system
- users determine which friends can view / edit the content they created.

Was this core functionality created many times before? Are there any best practices for how to implement such things?

What interests me most is what the database will look like for this.

What would it look like in terms of SQL (any database)?
What would it look like from the point of view of NOSQL (any NOSQL database)?

What interests me the most is how the issue of “visibility of content” in the database is addressed. for example, how does a database / application ensure that only approved friends can see user-generated content?

thanks

+4
sql design-patterns architecture nosql social-networking
source share
7 answers

The first thing to do is a database, the SQL code will look like a normalized sql database. What else could it look like? The nosql database will look like a package of paired files with the name.

Three approaches to creating a social website after and only after you put a strain on research on existing popular and unpopular ones to find out their architecture and the markets they are targeting, and the specific services they offer these markets.

  • Reset your own from scratch (and or use a framework). Like Facebook, Beebo, Myspace, etc. This is obviously the longest way to get there, but that means you have something to sell when you do it. Both the platform and the membership and the USP are yours to sell to Rupert Murdoch or to anyone else.
  • Use a CMS that lends itself to a social site and uses basic features, as well as plugins and your own inspiration, to reach your target market. Drupal is often used in this area (I also used it successfully), but you can use Joomla, Xaraya, and many others, both free and paid. Yes, more research. Sell ​​less here when Rupert gives you the bell, since the base tool is probably GPL'd
  • Use one of the provided systems in which you register, and then use the tools to create your own, but all the useful properties are provided. They are known as white-labeled sites. Start your search here . There is little you can sell if someone wants to pick you up.

How "visibility of content" is handled. Initially, of course, the site developer decides who can see the content. Owners only, friends, registered users, general public? etc. But this decision should be consistent with the goals and policies of the site. The best way to handle this is through RBAC role access . See here for more details.

When you say that you need “design / architect / development”, is it because of overwhelming internal motivation or because someone is paying you?

In any case, remember that the social web space is very crowded. If you are just building another YouTube or FaceBook, then you are unlikely to be able to generate the critical mass of numbers needed to make such a site commercially successful.

If this is for a niche market that is no longer being serviced, for example, the Peckham and Brockley Exotic Club of Fokker Lovers, then you know what you have on the market and what features will be required, so any of the above options that you consider the most simple and cheap, you can use, but it is up to you to analyze and perform.

Of course, you may have an idea for a social site that is basic and not covered by others, i.e. You have noticed the mythological "market gap." In this case, go, but prepare to be disappointed. Or not.

+2
source share

Your design must be reliable. This is what I have in my project.

1.) Application.Infrastructure

  • Base classes for all business objects, a business collection of objects, data access classes and my user attributes and utilities as extension methods. This defines the overall organization of the behavior of my last .net application.

2.) Application.DataModel

  • A typed dataset for a database.
  • TableAdapters are expanded to include transactions and other functions that I may need.

3.) Application.DataAccess

  • Data Access Classes.
  • The actual location where database actions are requested using a basic set of typed data.

4.) Application.DomainObjects

  • Business objects and collections of business objects.
  • Transfers

5.) Application.BusinessLayer

  • Provides manager classes accessible from the presentation layer.
  • HttpHandlers.
  • My own base page class.
  • More stuff here.

6.) Application.WebClient or Application.WindowsClient

  • My presentation level
  • Accepts links to Application.BusinessLayer and Application.BusinessObjects.

Application.BusinessObjects are used throughout the application, and they move across all layers whenever neeeded [except for Application.DataModel and Application.Infrastructure]

All my queries are determined only by Application.DataModel.

Application.DataAccess returns or accepts business objects as part of any data access operation. Business objects are created using reflection attributes. Each business object is marked with attribute mapping in the target table in the database, and properties in the business object are marked with attribute mapping to the target coloumn in the corresponding database table.

My validation structure allows me to validate each field using a designated ValidationAttribute.

My framrwork makes heavy use of attributes to automate most tedious tasks, such as matching and validation. I can also use the new feature as a new aspect in the framework.

A sample business object will look like this in my application.

User.cs

[TableMapping("Users")] public class User : EntityBase { #region Constructor(s) public AppUser() { BookCollection = new BookCollection(); } #endregion #region Properties #region Default Properties - Direct Field Mapping using DataFieldMappingAttribute private System.Int32 _UserId; private System.String _FirstName; private System.String _LastName; private System.String _UserName; private System.Boolean _IsActive; [DataFieldMapping("UserID")] [DataObjectFieldAttribute(true, true, false)] [NotNullOrEmpty(Message = "UserID From Users Table Is Required.")] public override int Id { get { return _UserId; } set { _UserId = value; } } [DataFieldMapping("UserName")] [Searchable] [NotNullOrEmpty(Message = "Username Is Required.")] public string UserName { get { return _UserName; } set { _UserName = value; } } [DataFieldMapping("FirstName")] [Searchable] public string FirstName { get { return _FirstName; } set { _FirstName = value; } } [DataFieldMapping("LastName")] [Searchable] public string LastName { get { return _LastName; } set { _LastName = value; } } [DataFieldMapping("IsActive")] public bool IsActive { get { return _IsActive; } set { _IsActive = value; } } #region One-To-Many Mappings public BookCollection Books { get; set; } #endregion #region Derived Properties public string FullName { get { return this.FirstName + " " + this.LastName; } } #endregion #endregion public override bool Validate() { bool baseValid = base.Validate(); bool localValid = Books.Validate(); return baseValid && localValid; } } 

BookCollection.cs

 /// <summary> /// The BookCollection class is designed to work with lists of instances of Book. /// </summary> public class BookCollection : EntityCollectionBase<Book> { /// <summary> /// Initializes a new instance of the BookCollection class. /// </summary> public BookCollection() { } /// <summary> /// Initializes a new instance of the BookCollection class. /// </summary> public BookCollection (IList<Book> initialList) : base(initialList) { } } 
+2
source share

A graphical database such as http://www.neo4j.org is a choice. This works well for a social network (e.g. http://blog.neo4j.org/2009/09/social-networks-in-database-using-graph.html ) and ACL based security (e.g. http: // wiki .neo4j.org / content / ACL ).

+2
source share

First you need to explore existing social networks (Facebook, Myspace, etc.). There is a lot of information about how they are implemented.

0
source share

The key to the success of social networks is not the technology on which it is based, but the problems that they solve for users. If users like it, you are doomed to success, even if your technology is crap.

[EDIT] How is this implemented? Check out the SQL-based user role system. In this case, each user can also be added as "authorized access" to any object. Depending on how many objects you have and how fine-grained the control should be, this may mean that you have a table with three columns: OBJECT, USER, ACCESS_TYPE where ACCESS_TYPE can be one of OWNER , READ (friend), WRITE ( close friend).

This table will become quite large, but a few 100 million rows are not unusual for today's databases.

0
source share

As Aaron noted, you must first ask yourself what problem you want to solve.

What content do you want to share? If this is really only visible to friends? It is much simpler and more scalable if you make the content publicly available, because the content is displayed regardless of who is viewing the page, and you can easily cache it. Publicly accessible user content attracts new users.

If you want to restrict access and give the user the opportunity to join groups of friends to the resource, I would go with simple group access control. Let each resource have a group of users who can edit the resource and a group of users who can see it.

Thus, each resource has two attributes of the same value, and each user has the right to a finite number of groups. You can attach the view-group and edit-group attributes to a document stored in a NOSQL database, a search engine such as Lucene / Sphinx, or a row in an SQL database. When requesting user-accessible content, pass all the groups the user belongs to (in SQL, you should use the IN clause in Sphinx setFilter('view-group', array(2,3,4)) ). The database will only return content available to the user. Since you only attach 2 (view-group and edit-group) to the document, you can save them in memory, which makes the search quick and scalable.

0
source share

In the end, it looks like Elgg or Dolphin can meet our requirements. They seem to be PHP frameworks for promoting your own social network. I looked at the Facebook platform, but nowhere did I clearly explain what it is - this is apparently the facebook code, but maybe it's just code for an API or something like that.

0
source share

All Articles