A Social Media API Server
i9lyfe is a full-fledged social media API server built in Go. It supports all of the major social media application features with a scalable, production-grade arcitecture, serving as a foundation for building apps like Instagram, TikTok, or Facebook clones.
- Go - Programming Language
- Fiber v3 - HTTP (REST) API Framework
- PostgreSQL - Relational DBMS
- SQL - Structured Query Language for Relational Databases
- PL/pgSQL - Procedural Language for PostgreSQL. Stored functions.
- Neo4j - Graph DBMS
- CypherQL - Query Language for Neo4j
- WebSocket - Full-duplex, Bi-directional communications protocol. Realtime communication.
- Redis Key/Value Store - Cache. Fast data structures. Pagination. Aggregation.
- Redis Streams - Event-based messaging system. Background tasks queue.
- Redis Pub/Sub - PubSub pattern messaging system
- Google Cloud Storage - Cloud object storage
- JWT - User authentication. Token signing and verification.
- MessagePack - Object serializer and deserializer (major use)
- JSON - Object serializer and deserializer (minor use)
- Swagger - HTTP API Documentation
- AsyncAPI - Websockets API Documention
- Docker - Container running Postgres and Redis instances
- Git & GitHub - Repository & Version Control
- GitHub Actions - Continuous Integration. Unit & Integration Testing
- VSCode
- Ubuntu Linux
- Intro
- Technologies
- Table of Contents
- Features
- Upcoming features
- API Documentation
- API Diagrams
- API Tests
The following are the features supported by this API. Visit the API documentation for implementation guides.
Create posts of various types (inspired by Instagram) including Photo, Video, and Reel.
- Mention users
- Include hashtags
- Browse posts from people you follow
- Receive new posts in real-time.
- React to Posts and Comments
- Comment on Posts and Comments (replies).
- Repost: Re-share posts on your feed.
- Access Interactions: Access comments on posts and replies to comments, and access the list of users who have reacted to a post or comment.
- Save posts for later
- View your profile
- Access to other user profiles.
- Edit your profile.
- Manage your posts.
- Access to saved posts.
- Access to posts you've engaged with through likes and comments.
- Access to posts you we're mentioned in.
- Follow or unfollow users.
- Realtime chat with users of the application.
- Supports various message types including:
- Text and voice message
- Images and videos with caption
- Audio
- File attachments (Documents)
- Realtime user presence status and last seen.
- Users receive likes, comments, reposts, and mentions notifications involving them in realtime.
- Chat messages are delivered to target users in realtime.
- New posts are delivered to user's feed in realtime.
- Individual posts receive real-time interaction updates (upon client subscription).
- Clients receive user "presence" and "last seen" updates (upon subscription)
The following is a list of features to be supported by this Social Media Backend API.
- Users will be able to follow interests (or topics). Content will also be recommended to them based on the interests they follow.
- Full-text search through content (photos, videos, and reels)
- Search user accounts
- Search hashtaged posts
- A content recommendation system that pushes relevant content to the user's feed, based on:
- User following network
- User's interest followed
- User engagement stats
- and more recommendation parameters...
- App will recommend users to follow, based on your follow network and content interaction stats.
HTTP API (REST): Here. Open in Swagger Editor
WebSockets API: Here Open in AsyncAPI Editor.
API (C4) Component Level Diagram: Here. (Open in PlantUML Editor)
DBDiagram.io version: Here. View in DBDiagram Editor.
Mermaid version: Here.
API sequence diagrams: Here
We employ a testing approach where test cases are in the form of user stories. These stories simulate real-world API usage activity by a client/user, confirming that endpoints work as expected on both the client and server side.
Here we just want to test that the API endpoints/features work under normal, sane circumstances.
This test case builds a story around user signup, signout, login, and password reset features of the API. It is structured by a series of user/client actions or steps that simulate a real-world authentication scenario by a user.
This test case builds a story around post creation, mentioned user notifications, post fan-outs, commenting on a post, notifying the post owner, notifying users mentioned in comments, reacting to a post or comment etc.
More feature tests can be found here
Here we'll build user stories around everywhere error should occur in the API, including validation errors, business layer errors, database errors, and more.
Here we'll build client stories that intend to break the API.
Here we'll test the API's security guards and potential vulnerabilities