Skip to content

themanjeetkr/NexusCommunity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Nexus Community

Nexus Community is a full-stack blogging community app. Users can register, verify their email, log in, browse posts, create and edit blogs with image uploads, like posts, contact the team, and generate blog ideas from a topic prompt.

Tech Stack

  • Frontend: React, Vite, React Router, Axios, React Hot Toast
  • Backend: Node.js, Express, MongoDB, Mongoose
  • Auth: JWT, bcrypt
  • Uploads: Multer with Cloudinary storage
  • Email: Nodemailer with Gmail
  • AI ideas: OpenAI Chat Completions API

Project Structure

NexusCommunity/
|-- backend/
|   |-- config/          # MongoDB connection
|   |-- controllers/     # Route handlers
|   |-- middleware/      # Auth middleware
|   |-- models/          # Mongoose models
|   |-- routes/          # Express routers
|   |-- uploads/         # Local uploaded assets / legacy uploads
|   `-- index.js         # Express app entry
`-- frontend/
    |-- public/
    `-- src/
        |-- assets/
        |-- components/
        |-- context/
        `-- pages/

Features

  • Blog listing with filters and like support
  • Protected blog creation and edit page
  • Image upload support through Cloudinary
  • User registration and login
  • Email verification flow
  • Blog idea generator
  • Contact page
  • Persistent auth state using local storage

Getting Started

Prerequisites

  • Node.js
  • npm
  • MongoDB connection string
  • Cloudinary account
  • Gmail account or app password for Nodemailer
  • OpenAI API key for the idea generator

Backend Setup

cd backend
npm install

Create a .env file in backend/:

MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret

CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name
CLOUDINARY_API_KEY=your_cloudinary_api_key
CLOUDINARY_API_SECRET=your_cloudinary_api_secret

EMAIL_USER=your_gmail_address
EMAIL_PASSWORD=your_gmail_app_password

OPENAI_API_KEY=your_openai_api_key

Start the backend:

npm run server

The backend listens on:

http://localhost:5000

Note: the current backend script is "server": "nodemon server", while the app entry file in this repo is index.js. If the script does not start, update it to nodemon index.js or run:

npx nodemon index.js

Frontend Setup

cd frontend
npm install
npm run dev

The Vite dev server usually runs on:

http://localhost:5173

The frontend API base URL is currently hardcoded in frontend/src/context/StoreContext.jsx:

const url = `https://resoultpartnersbackend.onrender.com`

For local backend development, change it to:

const url = 'http://localhost:5000'

Also check frontend/src/pages/BlogIdeaGenerator/BlogIdeaGenerator.jsx, which currently posts to http://localhost:5001/api/idea/chatgpt. If your backend runs on port 5000, update that URL accordingly.

API Routes

Blog Routes

Base path: /api/blog

Method Endpoint Description
GET /blogs Get all blogs
POST /create Create a blog with an uploaded image
POST /update/:id Update a blog
POST /getsingle/:id Get one blog by ID
POST /like/:id Like a blog
POST /remove/:id Delete a blog

User Routes

Base path: /api/user

Method Endpoint Description
POST /register Register a new user and send verification email
POST /login Log in a user
GET /users Get all users
GET /verify?token=... Verify a user email

Idea Routes

Base path: /api/idea

Method Endpoint Description
POST /chatgpt Generate blog ideas for a topic

Example body:

{
  "topic": "web development"
}

Useful Scripts

Backend:

npm run server

Frontend:

npm run dev
npm run build
npm run lint
npm run preview

Notes

  • Blog images are uploaded through Cloudinary using multer-storage-cloudinary.
  • Users are stored in MongoDB with hashed passwords.
  • Email verification links are generated by the backend with JWT.
  • Some deployed URLs are hardcoded in the current codebase. Update them before running a fully local setup or deploying to a new host.

About

A full-stack blogging community platform built with React, Node.js, Express, and MongoDB, featuring user authentication, email verification, blog creation/editing, image uploads, likes, contact form, and AI-powered blog idea generation.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors