• This repository has been archived on 11/Jun/2022
  • Stars
    star
    192
  • Rank 202,019 (Top 4 %)
  • Language
    JavaScript
  • Created over 4 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Twitter Clone Backend (Prisma + GraphQL)

Twitter Clone Backend

NOTE: As of 10-06-2022 at 19:35 IST, I am archiving this repository. It was fun while it lasted.

Twitter clone backend built with Prisma and GraphQL.

If you are looking for the frontend repo, click here

Core Packages

  1. prisma - allows us to define our application models and generates CRUD operations from our defined models
  2. graphql-yoga - graphql server
  3. jsonwebtoken - authentication

Features

  • Signup / Login
  • New Tweet
  • Like
  • Retweet
  • Comment
  • View Profile
  • Edit Profile
  • Search by users, tags, people
  • Dark theme / Light theme

Running locally

Prisma setup

  • You need to have a prisma account

  • Make sure to install the prisma cli tool globally in your machine

     npm i -g prisma
    
     # once you created your account, you can login from the terminal
     prisma login
  • Once you logged into your account, you need to create a new prisma project

     prisma init 
  • Copy the 'datamodel.prisma' file in the 'prisma_setup' folder to the root directory

     cp prisma_setup/datamodel.prisma . # assuming you are present in the root directory
  • Then you need to simply deploy the changes you made

     prisma deploy

Environmental variables setup

  • Create a .env file at the root directory with the following contents
JWT_SECRET=<YOUR_SECRET>
PORT=<PORT>

Then run npm i && npm run dev to start the development server

Watch this video on how to setup locally

New Tweet

Deploying the backend to heroku

First create an heroku account and install the heroku cli globally and login

npm i -g heroku
heroku login

Once logged in, create a new heroku application and push it to the remote 'heroku'

heroku create
git push heroku master

Then you need to manually setup the environmental variables using the heroku dashboard

UI

Home

Home

Explore

Explore

Profile

Profile

Edit Profile

Edit Profile

New Tweet

New Tweet

Tweet

Tweet