Skip to content
This repository has been archived by the owner on Sep 11, 2022. It is now read-only.

PiusLucky/SneakIn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

đź‘˝ SneakIN (Beast Mode)

A stand-alone chatting-engine built from scratch

The initial idea of this application was to take features from Whatsapp, Slack, and Telegram in building a hybrid-like Chatting System without depending on any form of external chatting SDK like Stream, SendBird including the Big Wolf, Chat Engine.

Competitive Versions

  Versions of different technologies where features were extracted
Tech Type Description
Whatsapp web/apk 2.21.17.2. Andriod version
Slack apk 21.08. Andriod version
Telegram web/apk Desktop 2.9.2. + 2021 alpha-version

Visit Site

Check Out Live

ShowCase

Home Snapshot


Dashboard Snapshot (Light Mode)

Dashboard Snapshot (Dark Mode)


PrivateChat Snapshot (Light Mode)

PrivateChat Snapshot (Dark Mode)


About Snapshot (Light Mode)

About Snapshot (Dark Mode)


Starred Snapshot (Light Mode)

Starred Snapshot (Dark Mode)


Profile Snapshot (Light Mode)

Profile Snapshot (Dark Mode)


Firebase Rules

Database Rules
{
  "rules": {
    "users": {
      ".read": "auth != null",
      ".write": "auth != null",
      "$uid": {
        ".write": "auth != null && auth.uid === $uid",
        ".validate": "(newData.hasChildren(['about', 'name', 'avatar', 'userRawData'])  && !newData.hasChildren(['starredMsgs'])) || (newData.hasChildren(['starredMsgs', 'about', 'name', 'avatar', 'userRawData'])  && newData.hasChildren(['starredMsgs']))",
        "about": {
          ".write": "auth != null",
          ".validate": "newData.hasChildren(['details', 'timeUpdated'])",
          "details": {
            ".validate": "newData.val().length > 0"
          },
          "timeUpdated": {
            ".validate": "newData.val() <= now"
          }
        },
        "name": {
          ".validate": "newData.val().length > 0"
        },
        "avatar": {
          ".validate": "newData.val().length > 0"
        },
        "starredMsgs": {
          ".read": "auth != null",
          "$starredMsgsId": {
            ".write": "auth != null && auth.uid === $uid",
            ".validate": "newData.hasChildren(['createdBy', 'isContent', 'item', 'timeStarred', 'timestamp'])",
            "createdBy": {
              ".write": "auth != null",
              ".validate": "newData.hasChildren(['id', 'name'])",
              "id": {
                ".validate": "newData.val().length > 0"
              },
              "name": {
                ".validate": "newData.val().length > 0"
              }
            },
            "isContent": {
              ".validate": "newData.val().length >= 4"
            },
            "item": {
              ".validate": "newData.val().length > 0"
            },
            "timeStarred": {
              ".validate": "newData.val() <= now"
            },
            "timestamp": {
              ".validate": "newData.val() <= now"
            }
          }
        },
        "userRawData": {
          ".write": "auth != null",
          ".validate": "newData.hasChildren(['creationTime', 'id'])",
          "creationTime": {
            ".validate": "newData.val() <= now"
          },
          "id": {
            ".validate": "newData.val() === $uid"
          }
        }
      }
    },

    "channels": {
      ".read": "auth != null",
      "$channelId": {
        ".write": "auth != null",
        ".validate": "newData.hasChildren(['id', 'name', 'createdBy', 'details', 'suscribed_users'])",
        "id": {
          ".validate": "newData.val() === $channelId"
        },
        "name": {
          ".validate": "newData.val().length >= 5"
        },
        "details": {
          ".validate": "newData.val().length >= 5"
        },
        "suscribed_users": {
          ".validate": "newData.hasChildren(['users_id', 'users_name'])"
        },
        "createdBy": {
          ".validate": "newData.hasChildren(['avatar', 'id', 'name', 'timestamp'])"
        }
      }
    },

    "messages": {
      ".read": "auth != null",
      ".write": "auth != null"
    },

    "typing": {
      ".read": "auth != null",
      ".write": "auth != null"
    },

    "presence": {
      ".read": "true",
      ".write": "true"
    },

    "privateMessagesIds": {
      ".read": "auth != null",
      ".write": "auth != null"
    },

    "unique_id_of_users": {
      ".read": "auth != null",
      "$id": {
        ".write": "auth != null",
        ".validate": "newData.hasChildren(['suscribedUsersId'])"
      }
    },

    "lastOnlinePresence": {
      ".read": "auth != null",
      "$id": {
        ".write": "auth != null",
        ".validate": "newData.hasChildren(['last_seen'])"
      }
    }
  }
}
Storage Rules
rules_version = '2';
service firebase.storage {
  match /b/january-ee57e.appspot.com/o {
    match /avatars {
      match /users/{userId} {
        allow read: if request.auth != null;
        allow write: if request.auth != null && request.auth.uid == userId && request.resource.contentType.matches('image/.*') && request.resource.size < 1 * 1024 * 1024;
      }
    }
    match /chat {
      match /public/{imagePath=**} {
        allow read: if request.auth != null;
        allow write: if request.auth != null && request.resource.contentType.matches('image/.*') && request.resource.size < 1 * 1024 * 1024;
      }
      match /private/{userId1}/{userId2}/{imagePath=**} {
        allow read: if request.auth != null && (request.auth.uid == userId1 || request.auth.uid == userId2);
        allow write: if request.auth != null && (request.auth.uid == userId1 || request.auth.uid == userId2) && request.resource.contentType.matches('image/.*') && request.resource.size < 1 * 1024 * 1024;
      }
    }
  }
}

Acknowledgements

Tech Stack

Client: React, Redux, Styled-component

Server: Firebase

E2E Testing: Cypress

Environment Variables

To run this project, you will need to add the following environment variables to your .env file

REACT_APP_API_KEY

REACT_APP_AUTH_DOMAIN

REACT_APP_DATABASE_URL

REACT_APP_PROJECT_ID

REACT_APP_STORAGE_BUCKET

REACT_APP_SENDER_ID

REACT_APP_APP_ID

Roadmap

  • Adding more tests

  • Fixing minor UI bugs

  • Implementing Hasher Algorithms Using CryptoJS (soon)

Authors

License

MIT License

Support

For support, email luckypius50@gmail.com