Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🛠️ Developer Community Platform

A full-stack web application where developers share, discover, and engage with technical knowledge.

📖 About

The Developer Community Platform is a full-stack web application designed for developers to share technical knowledge through blog posts. Users can create, browse, update, and delete posts, organize content with tags, interact through likes and comments, and discover content using search, filtering, sorting, and pagination. The backend follows a layered architecture — controllers, services, middleware, and MongoDB — while the frontend is built with Next.js and React using reusable components and responsive design.

✨ Features

🔐 Authentication & Security

  • User Registration & Login with JWT
  • Password hashing with bcrypt
  • Protected routes via Auth Middleware
  • Ownership authorization on posts and comments
  • Helmet security headers
  • CORS support
  • Centralized error handling

📝 Post Management

  • Create, Read, Update, Delete posts
  • Draft & Published status
  • Tag support for categorization
  • Author information embedded
  • Edit history tracking

🤝 Social Features

  • Like / Unlike posts (duplicate prevention)
  • Comment on posts
  • Update & Delete own comments
  • Comment ownership authorization

🔍 Advanced Query Features

Feature | Search -> GET /posts?search=node | Filter by Tag ->GET /posts?tag=javascript | Filter by Author -> GET /posts?author=userId | Pagination -> GET /posts?page=1&limit=10 | Sorting ->GET /posts?sort=-createdAt | Field Selection ->GET /posts?fields=title,author,tags

📚 API Documentation

  • Interactive Swagger UI at /api-docs
  • Full OpenAPI spec

🧪 Testing

  • Integration tests with Jest + Supertest

🏗️ Project Structure

DeveloperCommunityPlatform/
│
├── frontend/                     # Next.js + React
│   ├── components/
│   │   ├── Layout.js
│   │   ├── Navbar.js
│   │   ├── PostCard.js
│   │   ├── PostForm.js
│   │   ├── CommentCard.js
│   │   └── TagBadge.js
│   ├── pages/
│   │   ├── index.js              # Home — all posts
│   │   ├── create.js             # Create post
│   │   ├── post/[id].js          # Single post
│   │   └── tag/[tag].js          # Posts by tag
│   └── styles/
│
├── backend/                      # Node.js + Express
│   ├── src/
│   │   ├── config/
│   │   │   └── database.js       # MongoDB connection
│   │   ├── controllers/          # Business logic
│   │   ├── middlewares/          # Auth, validation, error handling
│   │   ├── models/               # Mongoose schemas
│   │   ├── routes/               # API route definitions
│   │   ├── services/             # Reusable service layer
│   │   ├── docs/                 # Swagger/OpenAPI spec
│   │   └── app.js                # Express app setup
│   ├── tests/                    # Jest + Supertest tests
│   ├── server.js                 # Entry point
│   ├── package.json
│   └── .env                      # Environment variables (not committed)
│
├── README.md
└── .gitignore

🚀 Getting Started

Prerequisites

1 — Clone the Repository

git clone https://github.com/ACM-JUIT/Team-1-DeveloperCommunityPlatform-.git
cd Team-1-DeveloperCommunityPlatform-

2 — Backend Setup

cd backend
npm install

Create a .env file inside the backend/ folder:

PORT=5000
MONGODB_URI=your_mongodb_connection_string
JWT_SECRET=your_secret_key
JWT_EXPIRES_IN=7d

⚠️ Never commit your .env file. It is already listed in .gitignore.

Start the backend:

npm run dev

Backend runs at → http://localhost:5000


3 — Frontend Setup

cd ../frontend
npm install
npm run dev

Frontend runs at → http://localhost:3000


📡 API Reference

Authentication

Method Endpoint Description Auth Required | POST -> /users/register Register a new user ❌ | POST -> /users/login Login and receive JWT ❌

Posts

Method Endpoint Description Auth Required | GET -> /posts Get all posts (supports filters) ❌ | GET -> /posts/:id Get a single post ❌ | POST -> /posts Create a new post ✅ | PUT -> /posts/:id Update a post (owner only) ✅ | DELETE -> /posts/:id Delete a post (owner only) ✅

Likes

Method Endpoint Description Auth Required | POST -> /posts/:id/like Like a post ✅ | DELETE -> /posts/:id/like Unlike a post ✅

Comments

Method Endpoint Description Auth Required | POST -> /posts/:id/comments (Add a comment) ✅ | GET -> /posts/:id/comments (Get all comments on a post ) ❌ | PUT -> /comments/:commentId (Update a comment (owner only)) ✅ | DELETE-> /comments/:commentId (Delete a comment (owner only)) ✅

Health Check

Method Endpoint Description |GET -> /health (Server health status)


📘 API Documentation

Interactive API docs are available via Swagger UI once the backend is running:

http://localhost:5000/api-docs

🧪 Running Tests

cd backend
npm test

Tests use Jest and Supertest for full integration coverage of all API endpoints.


🔒 Security Highlights

Feature                            Implementation 

| Password storage -> bcrypt hashing — plain text never stored | Auth tokens -> JWT with expiry (JWT_EXPIRES_IN) | Route protection -> Auth middleware on all write operations | Ownership checks -> Users can only modify their own content | HTTP headers -> Helmet middleware sets secure headers | Input validation -> Request validation middleware on all routes | ObjectId checks -> MongoDB ID format validated before DB queries | Error handling -> Centralized middleware — no stack traces in responses


🛠️ Tech Stack (Layerwise)

| Frontend -> Next.js, React.js, CSS Modules | Backend -> Node.js, Express.js | Database -> MongoDB, Mongoose ODM | Authentication -> JSON Web Token (JWT), bcrypt | Documentation -> Swagger UI, OpenAPI | Testing -> Jest, Supertest | Security -> Helmet, CORS


👥 Contributors

| Backend -> Rudra Pratap Singh | Frontend -> Namrta Thakur | Database & Models -> Mishthi Dutta


📄 License

This project was built as part of an academic team project at Jaypee University of Information Technology (JUIT) under the ACM Student Chapter.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages