Twitter backend - Golang

A Twitter-like Website

Booby Image

This repository contains the backend code for the final project of Fall 2020 Internet Engineering course. In this project, we were instructed to build a twitter-like website. We called our version "Boobier" after a special seabird (more information here), and it's pretty much like Twitter. The frontend of this project is available here. The whole project is deployed on Heroku Cloud Application Platform.

Project Explanation

We chose to write the backend in GoLang since it was the course syllabus, and our database of choice was MongoDB because of its simplicity.

Here are the features that our website is capable of:

  • Tweeting and deleting a tweet
  • Making/Changing a profile (bio, profile picture, and header)
  • Following/Unfollowing other users
  • Notifications and Logs (history of a user's actions)
  • Like, comment, and retweet
  • Searching by username, text, and hashtag
  • Viewing the timeline
  • Seeing who liked and retweeted a tweet
  • Hashtag trends
  • Last but not least, user suggestion

Database and Object Models

We currently have three databases: one for users, another for tweets, and the last one for keeping the hashtags.

Until now, we have considered five objects to be modeled: users, tweets, owners (explained later), hashtags, and events.

1. User Model:

Each user U has the following fields:

  • Name: name of U.
  • Username: unique username.
  • Email and password: email is considered unique and passwords are hashed using bcrypt package.
  • Bio, profile picture, and header: together, they form the user profile.
  • Tweets: an array of ObjectIDs where each id refers to a tweet.
  • Followings/Followers: an array of Owners which represents the profiles U has followed or users that follow U.
  • Notifications: an array of Events and it keeps track of three things:
    • One of U's tweets were liked
    • One of U's tweets were retweeted
    • Someone followed U
  • Logs: Much like the Notifications, but it records U's actions.

2. Tweet Model:

Each tweet T is made of these fields:

  • ID
  • Text
  • Media
  • Date and Time of the tweet
  • Owner: an Owner object which represents the tweet owner.
  • Likes and Retweets: an array of Owners.
  • Parent: generally empty but not when the tweet is a comment for another one.
  • Comments: a list of CommentTweet objects.

The CommentTweet model contains all the Tweet fields except for the Parent and the Comments.

3. Owner Model:

Each owner model is representing a user and only has the Username, Profile picture, Name, Bio, and IsFollowing fields. The IsFollowing field indicates whether the user requesting this object follows the target user or not. For instance, all U's followers has this field equal to true for them.

4. Hashtag Model:

Only records the name of a hashtag, the tweets which it belongs to, and the number of times it was used in general.

5. Event Model:

Three different actions are considered to be an Event: Like, Retweet, and Following as explained before and each event has the following fields:

  • Mode: whether it was a Like, a Retweet, or a Follow action.
  • Source: the user causing the action.
  • Target: the user to whom the action relates.
  • Content: a short, simple description
  • Timestamp
  • Tweet: for Like and Retweet events shows the actual tweet.

The actual requests and corresponding responses can be seen in the code itself and doesn't need much of an explanation.

Search by text

We tried to implement text-based search much like Twitter itself so our search algorithm supports the following examples:

  • "q1 q2 q3": all the tweets with this exact pattern in them.
  • q1 q2 q3: all the tweets having at least one of the queries.
  • "q1" q2 "q3": all the tweets that have q1 and q3. (q2 optional)

You can generate the docs of the backend to get a better sense of requests and responses. To generate these docs (automatically with the help of swag), first install the package and then run swag init, change the listening hostname to localhost and then, the resulting documentation is available at this link.

Contributions

There are many many bugs to be reported, suggestions to be told, ideas to be shared, and other forms of feedback to be told. Any form of these contributions would be a huge help to us improving this project. Thank you in advance.

Website and Team

You can test our website at Boobier.

Our Team:

Similar Resources

An app/container built in Go to automate a Twitter account using Notion

Notion Tweeter Notion Tweeter is a utility I built using Go to help automate scheduling my tweets using Notion as a backend. More documentation coming

Sep 26, 2022

Instagram Backend API with golang

Instagram Backend API with golang

Appointy - Task Instagram Backend API 1) Creating an user 2) Getting an user by id 3) Creating a post 4) Getting a post by id 5) Getting List of posts

Oct 3, 2022

To-Do list in GoLang with Redis as a backend -- Sample project for proof of concepts

🗒 GoLang To-Do List Sample App w/ Redis 📝 Description A simple to-do list app written in GoLang with Redis as a backend showing a few GoLang feature

Dec 14, 2021

Golang backend for GerivichStore.ID website

GERVICHSTORE.ID - API Backend API for GERVICHSTORE.ID website. API SPEC Products Get All Products Method : GET Endpoint : /api/products/ Header : Cont

Dec 28, 2021

Centralized backend & server for Vocdoni's Voting-as-a-Service API

Centralized backend & server for Vocdoni's Voting-as-a-Service API

Vocdoni Manager Backend The vocdoni manager is a private service providing organizations with a UI to manage their community and edit their public con

Feb 18, 2022

API client/backend for Moody's infrastructure

MoodyAPI API client/back-end for Moody's infrastructure The API back-end currently provides: DDNS Records Maintenance. Surveillance Camera Notificatio

Dec 14, 2022

Dogecoin GigaWallet is a backend service for creating payment platforms, tipping bots, dogecoin exchanges and more.

Dogecoin GigaWallet is a backend service for creating payment platforms, tipping bots, dogecoin exchanges and more.

The Dogecoin GigaWallet is a backend service which provides a convenient integration API for platforms such as online shops, exchanges, social media p

Nov 3, 2022

The API backend for the HackMan hackathon event. Returns a random word associated with a unique key

The API backend for the HackMan hackathon event. Returns a random word associated with a unique key

Feb 18, 2022

Backend REST-api server for hyperism

hyperism-go Backend REST-api server for hyperism Quick Overview Step 1. Deploy REST API, Database and IPFS git clone https://github.com/hyperism/hyper

Apr 30, 2022
A console based twitter client for displaying tweets from twitter lists
A console based twitter client for displaying tweets from twitter lists

About I follow a bunch of people who span a bunch of topics and wanted a way to keep track of all the cool stuff they post. I figured there would cert

Oct 6, 2022
wtf? paranormal twitter.com activity using Twitter Cards. Migros.tr #DoITYourself

GTKE - go-tweet-kart-ele wtf? paranormal twitter.com activity using Twitter Cards. Migros.tr #DoITYourself Just for fun. Go. # You have go. go install

Dec 7, 2021
Twitter backend - Golang
Twitter backend - Golang

A Twitter-like Website This repository contains the backend code for the final project of Fall 2020 Internet Engineering course. In this project,

Nov 26, 2022
Scrape the Twitter Frontend API without authentication with Golang.

Twitter Scraper Twitter's API is annoying to work with, and has lots of limitations — luckily their frontend (JavaScript) has it's own API, which I re

Dec 29, 2022
Twitter ID Finder For Golang

Twitter ID Finder n文字の全数IDを探せます Usage $ make go build -o main main.go $ ./main Twitter ID Finder Creator: @_m_vt Digits: 2 Target IDs: 100 Really? [

Dec 12, 2021
A Go client library for the Twitter 1.1 API

Anaconda Anaconda is a simple, transparent Go package for accessing version 1.1 of the Twitter API. Successful API queries return native Go structs th

Jan 1, 2023
Go Twitter REST and Streaming API v1.1

go-twitter go-twitter is a Go client library for the Twitter API. Check the usage section or try the examples to see how to access the Twitter API. Fe

Dec 28, 2022
twitter clone front-end for Internet Engineering course - fall 99 built by go+echo

twitter backend build twitter-like back-end for internet engeering course - fall 99 with go+echo+gorm team mates Roozbeh Sharifnasab + Parsa Fadaee +

Nov 9, 2022
Periodically collect data about my Twitter account and check in to github to preserve an audit trail.

Twitter audit trail backup This repository backs up my follower list, following list, blocked accounts list and muted accounts list periodically using

Dec 28, 2022
A REST API microservices-based Twitter Clone server.

Simple API Twitter Clone A REST API microservices-based project to fetch, edit, post, and delete tweets. API documentation The API documentation is bu

May 13, 2022