Skip to content

noctoid/NekoGram-v2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NekoGram-v2

NekoGram Version 2

Web Server

NekoGram web server is built on the great Python web framework Sanic which supports async/await functions that vastly increase the performance of any web app built using it.

API

postings

All postings related APIs are like this /p/...

/p/read/
/p/read_many/
/p/create/
/p/update/
/p/delete/
/p/search/
/p/user_plist/
comments
/c/get/
/c/create/
/c/delete/
/c/update/
likes
/l/get/
/l/do/
/l/undo/

Front End App

NekoGram Frontend App is an single page javascript application written in React.

Database Wrapper

To ensure maximum data access throughput, the Database Wrapper is designed to listen RPC calls from RabbitMQ, and fetch the command from the containing json.

Sample Postings Related Requests:

{
    "ver": "0.1",
    "object": "postings",
    "method": "read",
    "query" : {
        "payload": {
          "posting-id": 123456789,
          "user-id": "..."
        }
    }
}
{
    "ver": "0.1",
    "object": "postings",
    "method": "delete",
    "query" : {
        "payload": {
          "posting-id": 123456789,
          "user-id": "..."
        }
    }
}
{
    "ver": "0.1",
    "object": "postings",
    "method": "update",
    "query" : {
        "payload": {
            "posting-id": 123456789,
            "user-id": "...",
            "text": "blahblahblah...",
            "media-mime": "image/jpg",
            "media-url": "https://example.com/image/s123456789"
        }
    }
}
{
    "ver": "0.1",
    "object": "postings",
    "method": "create",
    "query" : {
        "payload": {
            "posting-id": 123456789,
            "user-id": "...",
            "text": "blahblahblah...",
            "media-mime": "image/jpg",
            "media-url": "https://example.com/image/s123456789"
        }
    }
}

Sample Comments Requests: Create comment

{
    "ver": "0.1",
    "object": "comments",
    "method": "create",
    "query": {
        "payload": {
            "posting-id": 123456789,
            "user-id": "...",
            "comment-id": "...",
            "text": "blahblahblah...."
        }
    }
}

Delete comment

{
    "ver": "0.1",
    "object": "comments",
    "method": "delete",
    "query": {
        "method": "delete",
        "payload": {
            "posting-id": 123456789,
            "user-id": "...",
            "comment-id": "..."
        }
    }
}

Sample Likes Requests: Like

{
  "ver": "0.1",
  "object": "likes",
  "method": "create",
  "query": {
    "payload": {
      "posting-id": 123456789,
      "user-id": "..."
    }
  }
}

Dislike

{
  "ver": "0.1",
  "object": "likes",
  "method": "delete",
  "query": {
    "payload": {
      "posting-id": 123456789,
      "user-id": "..."
    }
  }
}

Data retrieved will be in form of certain object also packed in json.

Information Experts

All the data models are described in this session, and they are User, Posting, Like, Comment, Notification.

User

{
  "uid": "uuid4",
  "email": "schrodinger@example.com",
  "phone": "+11234567890",
  "password": "hash_of_the_password",
  "username": "username",
  "displayName": "Display Name",
  "profile_image": "https://cdn.example.com/img/1234567.png",
  "following": [
    "uid1", "uid2", "uid3"
  ],
  "follower": [
    "uid1", "uid2", "uid3"
  ],
  "postings": [
    "pid-1", "pid-2", "..."
  ],
  "notification": [
    {
      "nid": "1234",
      "etc": "..."
    }, {}
  ]
  
}

Posting

There are 4 types of postings which are differentiated by type attribute; and they are posting, like, comment, repost which have different content.

// Meta Posting
{
  "pid": "uuid4-0000-0000-0000-00000000",
  "uid": "uuid4-9999-1234-5678-12345678",
  "type": "posting", // or "like", "comment", "repost"
  "content": {...}   // actual content
  "comments": [ // list of pid
    "uuid4-0000-0000-0000-00000001",
    "..."
   ],
   "likes": [ // list of pid
    "uuid4-0000-0000-0000-00000004",
    "..."
   ],
   "repost": [
    "uuid4-0000-0000-0000-00000007",
    "..."
   ],
   "public": true
}

Posting Content: Posting Content contains text and media

{
  "txt": "I had In n Out for lunch today and it is good.",
  "hasMedia": true,
  "mimeType": "image/png",
  "mediaUrl": "https://cdn.example.com/img/a-nice-burger.png",
  
}

Likes Content: Likes has no real content, but the pid of the posting it likes.

{
  "target_pid": "uuid4-0000-1111-2222-00000000"
}

Repost Content: Repost has a quote (may be empty) and the pid of the posting

{
  "target_pid": "uuid4-0000-1111-2222-00000000",
  "txt": "Nice Post!"
}

Comment Content: Repost has a quote (cannot be empty) and the pid of the posting

{
  "target_pid": "uuid4-0000-1111-2222-00000000",
  "txt": "Good job!"
}

About

NekoGram Version 2

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published