NextJs-Reddit-Clone
NextJs-Reddit-Clone copied to clipboard
A reddit clone made with NextJs 13, Firebase, Chakra UI, Recoil. Create or join new subreddits, add votes and comments.
NextJs-Reddit-Clone
A reddit clone made with NextJs 13, Firebase, Chakra UI, Recoil
- NextJs (13.x)
- React (18.x)
- Firebase (9.x)
- Chakra UI (2.x)
- Recoil (0.7.x)
- Typescript (4.x)
- Production build script
Live Demo
See a live demo on Vercel
Installation
Setup Firebase
-
Navigate to
https://console.firebase.google.com/u/0/
ClickAdd Project
-
Click the
Enter your project name
field.
Typereddit-clone
ClickContinue
ClickSelect an account
Select your account
ClickCreate project
ClickContinue
-
Click
web
-
Click the
App nickname
field.
Typeyour-app-name
ClickRegister app
Copy and store thefirebaseConfig
values
ClickContinue to console
-
Click
Authentication
ClickGet started
-
Click
Email/Password
ClickSave
ClickAdd new provider
ClickGoogle
ClickSave
-
Expand
Build
menu
ClickStorage
ClickGet started
-
Click
Next
ClickDone
-
Click
Rules
tab
Copy paste the following inedit rules
rules_version = '2'; service cloud.firestore { match /databases/{database}/documents { match /users/{userId}/{restOfPath=**} { allow read, write: if request.auth != null && userId == request.auth.uid; } match /posts/{postId} { allow read; allow write: if request.resource.data.creatorId == request.auth.uid; allow delete: if request.auth.uid == resource.data.creatorId; allow update; } match /comments/{commentId} { allow read; allow write: if request.resource.data.creatorId == request.auth.uid; allow delete: if request.auth.uid == resource.data.creatorId; allow update; } match /communities/{communityId} { allow read; allow write: if request.auth != null; } } }
Click
Publish
Setup Project
- Clone/download repo
- Create a file called .env in the root directory of your project, type the following in cmd/powershell
cp env.example .env
- Inside the
.env
file, add the firebase keys from thefirebaseConfig
copied duringstep 4
of firebase setup -
yarn install
(ornpm install
for npm) to install the dependencies
Usage
Development
yarn dev
- Build app continuously (HMR enabled)
Production
yarn build
yarn start
- Build app once (HMR disabled) to
/.next/
All commands
Command | Description |
---|---|
yarn dev |
Build app continuously (HMR enabled) |
yarn build |
Build app once (HMR disabled) to /.next/ |
yarn start |
Run production build |
See also
- Design ideas were taken from Reddit
- Some Implementation Ideas for this project are taken from Shadee Merhi
- Project was bootstrapped with create-next-app