Skip to content

the-real-i9/i9lyfe-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

796 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

i9lyfe (API Server)

Test i9lyfe

A Social Media API Server

Intro

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.

Technologies and Tools

go gofiber postgresql redis websocket neo4j jwt googlecloud docker

Technologies

  • 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)

Tools

  • 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

Table of Contents

Features

The following are the features supported by this API. Visit the API documentation for implementation guides.

Content Creation & Sharing

Create posts of various types (inspired by Instagram) including Photo, Video, and Reel.

  • Mention users
  • Include hashtags

Feed

  • Browse posts from people you follow
  • Receive new posts in real-time.

Content Engagement and Interaction

  • 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

User Profile Management

  • 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.

Networking

  • Follow or unfollow users.

Chatting and Direct Messaging

  • 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.

Realtime Notification and Message Delivery

  • 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.

Realtime Updates

  • Individual posts receive real-time interaction updates (upon client subscription).
  • Clients receive user "presence" and "last seen" updates (upon subscription)

Upcoming features

The following is a list of features to be supported by this Social Media Backend API.

Following Interests

  • Users will be able to follow interests (or topics). Content will also be recommended to them based on the interests they follow.

Search: Full-text Search | Results Ranking | Fuzzy Matching

  • Full-text search through content (photos, videos, and reels)
  • Search user accounts
  • Search hashtaged posts

Discover: Content Recommendation System

  • 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...

User Follow Recommendation

  • App will recommend users to follow, based on your follow network and content interaction stats.

API Documentation πŸ“–

HTTP API (REST): Here. Open in Swagger Editor

WebSockets API: Here Open in AsyncAPI Editor.

API Diagrams 🎨

Architecture Diagram

API (C4) Component Level Diagram: Here. (Open in PlantUML Editor)

Show Diagram

i9lyfe_api_arch

Entity-Relationship Diagram

DBDiagram.io version: Here. View in DBDiagram Editor.

Mermaid version: Here.

Sequence Diagrams

API sequence diagrams: Here

API Tests πŸ§ͺ

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.

Feature Tests

Here we just want to test that the API endpoints/features work under normal, sane circumstances.

User Authentication Story

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.

User Post & Comment Story

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

Upcoming tests

Error tests

Here we'll build user stories around everywhere error should occur in the API, including validation errors, business layer errors, database errors, and more.

Bad API Usage Tests

Here we'll build client stories that intend to break the API.

Attack Simulation Tests

Here we'll test the API's security guards and potential vulnerabilities