/New_PasteBin

Primary LanguageJavaScript

Pastebin 2.0

The current PasteBin has gotten too bulky and doesn't have any searching capabilities. PasteBin 2.0 is a less clunky (minimalistic) version. Our application allows users to create pastes which can be any text or lines of code with a set expiry date (a user may choose to create an indefinite expiration date as well). These pastes are then posted on to the homepage for other users to see. The pastes are in the form of cards which contain the title, body, user’s profile picture, user’s handle, and user’s name. Users can also login to the application via Google or they can choose to remain anonymous. Users that do log in can view their account profile page, view their specific pastes, and create private pastes as well. Anonymous users can only choose to create public or unlisted pastes. Additionally, what makes our application unique from the original PasteBin is that we have filter and search capabilities. We’ve implemented a search bar that allows the user to search for a paste (users can either type the title or body of the paste) and a filter box that users can utilize to view pastes in the order of newest, oldest, or alphabetical.

Collaborators

Archana Dhyani (Front-end)

Blas Kojusner (Front-end)

Param Gupta (Back-end)

Sudhanshu Tarale (Back-end)

Tech Stack

  • Front-end:
  • Back-end:
    • Golang
    • Embed
    • Gorm
    • SQLite

Link to Project Board for all Sprints

https://github.com/Archana90663/New_PasteBin/projects

Index

Features

  • The home page provides a list of all pastes so that users can explore
  • other pastes(with search functionality comming in the future). The
  • ability to set expiry for pastes. Ability to get sharable link of
  • pastes. A rich text editor for formatting your pastes

Exploring the repository of pastes

The home page contains a repository of all pastes there to explore. The latest pastes are within cards. The cards each contain the user who made the paste, their @, and other metadata such as when the paste was created and when it will expire, as well as the title and preview of the content of the paste itself.

Open a paste

A user can interact with each of the previewed pastes by clicking on the READ button within each of the cards to open the paste.

ezgif com-gif-maker (1)

Create a paste

Simply click the new paste button on the navbar, and fill the form.

ezgif com-gif-maker

Constraints for pastes:-
The title must not be empty.
The title must not be more than 260 charscters
The body must not be empty
The body must not be more that 10,00 characters
The expiry date is optional.
The expiry must not be before the current time.

How to add expiry to paste

While creating the paste, there is a DateTime field where you can select the expiry.

ezgif com-gif-maker (2)

How to add syntax highlighting to paste

While creating the paste, use the language dropdown to select the language for syntax highlighting ezgif com-gif-maker (4)

How to share the created paste

Once the paste is created you will be redirected to the page of that particular text, where you simply copy the link and share it.

ezgif com-gif-maker (3)

You can also share a paste you open from the homepage in a similar way.

What if you try to open an expired paste link

If you try to open the link of an expired paste, it will display an error message showing the paste has expired.

Login to PasteBin

Users have the ability to login to our application using the Google Login API. This is for users who want to create private pastes as well

Logout of PasteBin

Users can also logout and the navbar gets updated accordingly

View Account Profile

Users can view their account profile in PasteBin 2.0. It consists of their profile picture, name, email, and username

View User's Pastes

Users can view all the pastes they've created in the past (as long as they haven't expired yet)

Delete Paste

Users have the ability to delete their pastes (as long as they haven't expired yet)

About Page

We have created an about page that summarizes what our application is about, how it's different from the original PasteBin, and information about the developers.

How to build the app

If your target machine is not supported by the executable in the releases section, first you will have to build the app. First make sure you have all the requirements installed.

Requirements:-
NodeJs
@angular/cli
Golang

To build the app open your terminal and run the following

cd New_PasteBin
make install
make build

This will create an executable file in the directory New_PasteBin/Server. The file will be named server.

Build app without make on windows.

First, we have to install all node dependencies

cd new_pastebin_frontend
npm install
cd ..

Then we run the powershell script :- build.ps1

How to run the app

After you build the app or download it from releases, simply execute the executable. This will run the server that will listen to requests on port 8080. The homepage of the app will be at localhost:8080/

Run the app without building

If you want to run the app without building (useful in the development process), do the following. First, make sure you have all the requirements installed.

Requirements:-
NodeJs
@angular/cli
Golang

The execute the following commands in terminal(one-time setup)

cd New_PasteBin
make install

Finally to run the app, execute

make run

This will host the front end on port 4200. The homepage will be at localhost:4200. The backend will run parallelly on the port 8080

Run without make on windows

First, we have to install all node dependencies

cd new_pastebin_frontend
npm install
cd ..

Then we run the powershell script :- run.ps1

Back-End

Refer this for the API documentation

Testing

To run tests for the app open your terminal and run the following

cd New_PasteBin
make install
make test

This will run all frontend and backend tests. If you want only want to run the backend golang test, open your terminal and run the following

cd New_PasteBin
make install
make test_go

If you want only want to run the backend postman test, open your terminal and run the following

cd New_PasteBin
make install
make test_postman

Demo Video of the project

demo-video.mp4

Cypress Testing Demo Video

cypressDemo.1.mp4

Backend Testing Demo Video

backend.tests.mp4