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
See a live demo on Vercel
-
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 the
App nickname
field.
Typeyour-app-name
ClickRegister app
Copy and store thefirebaseConfig
values
ClickContinue to console
-
Click
Email/Password
ClickSave
ClickAdd new provider
ClickGoogle
ClickSave
-
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; } } }
- 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
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 |
- Design ideas were taken from Reddit
- Some Implementation Ideas for this project are taken from Shadee Merhi
- Project was bootstrapped with create-next-app