Skip to content

A RESTful API that mimics the backend part of reddit.

License

Notifications You must be signed in to change notification settings

ZeyadTarekk/Reddit-Replica-REST-API

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Read-it RESTful API

GitHub contributors GitHub issues GitHub license GitHub forks GitHub stars GitHub Language

πŸ“ Table of Contents

About

  • A RESTful API that mimics the backend part of reddit.
  • Reddit is a social news aggregation, content rating, and discussion website. Registered users (commonly referred to as "Redditors") submit content to the site such as links, text posts, images, and videos, which are then voted up or down by other members. Posts are organized by subject into user-created boards called "communities" or "subreddits". Submissions with more upvotes appear towards the top of their subreddit and, if they receive enough upvotes, ultimately on the site's front page. Reddit administrators moderate the communities. Moderation is also conducted by community-specific moderators.

πŸ’» Built Using

  • Node.js
  • Express.js
  • MongoDB
  • Mongoose
  • Jest
  • jsdoc
  • swagger to generate api documentation
  • bcryptjs to encrypt passwords
  • crypto to generate tokens
  • multer to upload files
  • nodemailer to send mails
  • express rate limit to avoid DOS attacks
  • Firebase Cloud Messaging for push notifications

🏁 Getting Started

This is an list of needed instructions to set up your project locally, to get a local copy up and running follow these instructuins.

  1. Clone the repository $ git clone https://github.com/Reddit-Replica/SW-Backend.git

  2. Navigate to project folder and create file named ".env" $ cd SW-Backend & touch .env

  3. Fill ".env" file

    BCRYPT_PASSWORD = your password to encrypt passwords
    SALT_ROUNDS = salt rounds needed to encrypt passwords
    TOKEN_SECRET = your JWT token secret
    MONGO_URL = your database connection string like: mongodb://localhost:27017/Read-it
    MONGO_URL_TESTING = your testing database connection string like:mongodb://localhost:27017/Read-it-test
    FRONT_BASE= the frontend base url like: http://localhost:8081 (used in sending emails)
    MAILGUN_API_KEY = your mailgun api key
    SENDER_EMAIL = your sender email
    DOMAIN= your domain
    REQUEST_LIMIT= number of requests allowed in 15 minutes
    MONGO_URL_SEED = your database connection string like:mongodb://localhost:27017/Read-it-seed (data will be seeded in that database)

  4. Install dependencies $ npm install

  5. Run seeder From that script

  6. start application in development mode $ npm run dev

  7. Login You can login by any username and password:12345678

API Documentation

  • A live version here
  • You can download the OpenAPI specification for that live link.
  • You can generate the OpenAPI specification from that script then you will find it in documentation.json.

Functional Documentation

  • You can generate the functional documentation from that script then you will find it in docs/index.html

Useful Scripts

Run in development mode

$ npm run dev

Run in deployment mode

$ npm start

Run unit tests

$ npm run test You will find the test report in test-report.html

Generate coverage report

$ npm run coverage you will find it in coverage/index.html

Generate OpenAPI specification

$ npm run doc you will find it in documentation.json

Generate Functional Documentation report

$ npm run jsdoc you will find it in docs/index.html

Run seeder

  • Change the number of needed users, posts, messages, sunreddits, comments from seeds/seeder.js file in line 15, 16, 17, 18, 19
  • Then run $ npm run seed

Run linter

$ npm run lint

Run prettier

$ npm run prettier

πŸ“· Some Features and Demo videos

πŸ”’ User Authentication

  • Login using Google
  • Login using Facebook
  • Signup
  • Login
  • Forget password
  • Forget username
  • Change password
SW1.mp4
SW5.mp4

πŸ™β€β™‚οΈ User Profile

  • Profile overview (posts, comments, upvotes, downvotes, etc.)
  • Your Posts
  • Your Comment
  • Your Upvotes
  • Your Downvotes
  • Your Saved Posts and Comments
  • Your Hidden Posts and Comments
  • Your History
  • Your Followers
SW4.mp4
SW5.mp4

πŸ“° Post

  • Create rich text post
  • Create image and video post
  • Create link post
  • Add flair to post
  • Add spoiler to post
  • Add nsfw to post
  • Upvote and downvote post
  • Save post
  • Hide post
  • Share post
  • Edit own post
  • Delete own post
  • Lock own post
SW3.mp4
SW7.mp4

πŸ”Ž Search

  • Search by post
  • Search by comment
  • Search by community
  • Search by people
SW9.mp4

πŸ—¨οΈ Comment

  • Create rich text comment
  • Nested comments up to any level
  • Upvote and downvote comment
  • Reply to comment
  • Edit own comment
  • Delete own comment
  • Lock own comment
SW2.mp4

πŸ”” Notifications

  • Push notifications
  • All notifications

βœ‰οΈ Messages

  • Send a private message
  • All messages
  • Unread messages
  • Sent messages
  • Post replies
  • Usernames mentions
  • Delete message
  • Spam message
  • Reply to message
SW6.mp4

🀡 Moderator

  • Queues
    • Spamed (posts only, comments only, posts and comments)
    • Edited (posts only, comments only, posts and comments)
    • Unmoderated (posts only, comments only, posts and comments)
  • User management
    • Banned users
    • Muted user
    • Approved user
    • Moderators
  • Flairs and emojis
    • Add new flair
    • Edit flair
    • Delete flair
    • Reorder flairs
  • Rules and regulations
    • Add new rule
    • Edit rule
    • Delete rule
    • Reorder rules
  • Community settings
    • Edit community name
    • Edit community description
    • Edit community topic
    • Edit community language
    • Edit community type (Public, Private, Restricted)
    • Edit community region
  • Posts & Comments settings
    • Enable/disable community Spoiler tag
    • Edit suggested sort for posts
    • Enable/disable image in posts
  • Community traffic
    • Day of week
    • Month
    • Page views
    • Members joined
    • Members left
SW8.mp4

Coverage Report


Contributors

Zeyad Tarek
Zeyad Tarek
Ziad Sherif
Abdelrahman Hamdy
Youssef Elwaer
Abdelrahman Noaman
Beshoy Morad
Beshoy Morad

License

This software is licensed under MIT License, See License for more information.

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%