https://github.com/bhargav-joshi/quote-generator-nodejs-nextjs
A simple Random Quote Generator app built with Node.js for the backend and Next.js for the frontend. The app allows users to view random quotes and add their own quotes to the database.
https://github.com/bhargav-joshi/quote-generator-nodejs-nextjs
backend frontend nextjs nodejs
Last synced: about 2 months ago
JSON representation
A simple Random Quote Generator app built with Node.js for the backend and Next.js for the frontend. The app allows users to view random quotes and add their own quotes to the database.
- Host: GitHub
- URL: https://github.com/bhargav-joshi/quote-generator-nodejs-nextjs
- Owner: bhargav-joshi
- Created: 2025-02-02T12:34:28.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-02T13:25:10.000Z (over 1 year ago)
- Last Synced: 2025-02-10T16:15:16.303Z (over 1 year ago)
- Topics: backend, frontend, nextjs, nodejs
- Language: JavaScript
- Homepage:
- Size: 114 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# π― **Random Quote Generator - Node.js + Next.js**
A simple **Random Quote Generator** app built with **Node.js** for the backend and **Next.js** for the frontend. The app allows users to view random quotes and add their own quotes to the database.
### Demo Screenshots of Project -






---
## π **Features**
- **Backend (Node.js + Express):**
- β
Fetches a random quote.
- β
Allows users to add new quotes.
- **Frontend (Next.js):**
- β
Displays quotes fetched from the backend.
- β
Allows users to interact with the system and view new random quotes.
---
## π¦ **Technologies Used**
- **Backend:**
- Node.js
- Express.js
- CORS (Cross-Origin Resource Sharing)
- Body-parser
- **Frontend:**
- Next.js
- Axios (for making HTTP requests)
- **Database (Optional):**
- MongoDB / SQLite (can be used to store quotes persistently)
---
## β‘ **Getting Started**
Follow the steps below to get the application up and running on your local machine.
## β‘ Step by Step Guide
Step 1: Setup Node.js & Express Backend
We'll create an API that:
- β
Returns a random quote.
- β
Allows users to add new quotes.
#### 1οΈβ£ Initialize a Node.js Project
Run the following commands:
```
mkdir quote-generator
cd quote-generator
npm init -y
```
#### 2οΈβ£ Install Required Dependencies
```
npm install express cors body-parser
```
#### 3οΈβ£ Create server.js (Backend)
β
Run the Backend:
```
node server.js
```
---
## β‘Step 2: Setup Next.js Frontend
Let's build a simple Next.js app to fetch and display quotes.
#### 1οΈβ£ Create a Next.js App
Run:
```
npx create-next-app@latest quote-app
cd quote-app
npm install axios
```
#### 2οΈβ£ Update pages/index.js
Edit the file pages/index.js
#### 3οΈβ£ Run the Next.js App
```
npm run dev
```
## β‘ Node Version Management
To ensure compatibility with the latest Next.js, use Node.js version 20.x or higher:
```
nvm install 20
node -v
```
## β‘ Step 3: Verify the Application
- Backend should be running on `http://localhost:5000`
- Frontend should be running on `http://localhost:3000`
Visit http://localhost:3000 and you should see a random quote displayed with a button to fetch a new one.
#### π Enjoy Your Random Quote Generator!