One of the most important security rules to follow when you build a social media platform from scratch is that all the application’s layers should be protected from security risks identified by OWASP. Secondly, integrate into your app’s infrastructure a WAF (web application firewall). It will secure your app from outside attacks, such as SQL injections, XSS (Cross-Site Scripting) attacks, file inclusion, etc.
Another useful website security measure to follow when you aim to make a social networking site is to regularly conduct security audits of a web application code and timely updates of all software components of the website, including updates of the frameworks and libraries that were leveraged in the course of the development. Overall, these are just some of the possible ways to strengthen the security of the social media website. Generally, the Software Architect or Tech Lead working on your project designs the corresponding strategy and selects security tools and practices appropriate for your product.