Skip to content

theinhumaneme/social-network-webdev-final-project

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

133 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Social Network Frontend

A modern Next.js-based frontend for the Social Network application featuring real-time content discovery, user interactions, and admin controls.

πŸš€ Features

  • πŸ” Hybrid search (Internal MongoDB + External Hacker News via Algolia)
  • πŸ‘€ User authentication with role-based access control
  • πŸ“ Story and comment creation with rich text support
  • ❀️ Like/upvote system
  • πŸ”– Bookmark functionality
  • πŸ‘₯ Follow/unfollow users
  • 🚨 Content reporting system
  • πŸ‘¨β€πŸ’Ό Admin dashboard with moderation tools
  • πŸ“± Fully responsive design (mobile, tablet, desktop)

πŸ›  Tech Stack

  • Framework: Next.js 14 (React)
  • Language: TypeScript
  • Styling: Tailwind CSS
  • UI Components: shadcn/ui
  • State Management: Redux Toolkit
  • Icons: React Icons
  • Authentication: JWT (stored in cookies)

πŸ“¦ Installation

# Clone repository
git clone <repository-url>
cd social-network-frontend

# Install dependencies
npm install

# Set up environment variables
cp .env.example .env.local
# Edit .env.local with your configuration

# Run development server
npm run dev

# Build for production
npm run build
npm run start

🌍 Environment Variables

Create a .env.local file:

NEXT_PUBLIC_API_URL=http://localhost:3000
NEXT_PUBLIC_API_BASE_URL=http://localhost:3000

πŸ‘₯ User Roles & Permissions

πŸ”“ Unauthenticated User (Guest)

Can Access:

  • βœ… View all public stories
  • βœ… View all comments
  • βœ… Search and filter content
  • βœ… View user profiles
  • βœ… Browse by tags (story, job, ask_hn, show_hn)

Cannot Access:

  • ❌ Create stories or comments
  • ❌ Like/upvote content
  • ❌ Follow users
  • ❌ Bookmark content
  • ❌ Report content
  • ❌ Edit or delete anything

Available Actions:

  • Login
  • Register

πŸ”’ Authenticated User (USER)

All Guest Permissions +

Can:

  • βœ… Create stories (types: story, ask_hn, show_hn, poll)
  • βœ… Create comments and replies (depth limit: 1)
  • βœ… Edit own stories and comments
  • βœ… Delete own stories and comments
  • βœ… Like/unlike stories and comments
  • βœ… Follow/unfollow other users
  • βœ… Bookmark stories and comments
  • βœ… Report inappropriate content
  • βœ… Update own profile (bio, photo, location, website)
  • βœ… View own bookmarks and activity

Cannot:

  • ❌ Create job postings
  • ❌ Delete other users' content (unless admin)
  • ❌ Access admin dashboard
  • ❌ Block users or emails

πŸ’Ό Employer (EMPLOYER)

All Authenticated User Permissions +

Can:

  • βœ… Create job postings (type: job)
  • βœ… All USER role permissions

Special Features:

  • Job posts are labeled with "job" tag
  • Can manage own job listings

πŸ‘‘ Admin (ADMIN)

Full System Access

Can:

  • βœ… All USER and EMPLOYER permissions
  • βœ… Delete any story or comment
  • βœ… Block/unblock users
  • βœ… Block/unblock email addresses
  • βœ… View and manage all reports
  • βœ… Restore deleted content
  • βœ… View analytics dashboard
  • βœ… View problematic users list
  • βœ… View top contributors
  • βœ… Access admin panel

Admin Dashboard Features:

  • User management (block/unblock)
  • Content moderation (delete/restore)
  • Email blocking system
  • Report management
  • Analytics and statistics
  • Trending content monitoring

πŸ“± Key Features

🏠 Home Page

  • Front page stories (hybrid: internal + Hacker News)
  • Tag-based filtering (story, job, ask_hn, show_hn)
  • Search functionality
  • Sort by popularity or date
  • Responsive card layout

πŸ“ Story Details Page

  • Full story with metadata (author, points, time)
  • Share, edit, delete buttons (based on permissions)
  • Bookmark functionality
  • Report button
  • Comments section with nested replies (depth: 1)
  • Like/comment interactions
  • Responsive layout for all screen sizes

πŸ’¬ Comments System

  • Create top-level comments
  • Reply to comments (one level only)
  • Edit/delete own comments
  • Like comments
  • Icons for metadata (user, points, time)
  • Responsive threading

πŸ‘€ User Profile

  • View user's stories and comments
  • Follow/unfollow
  • Edit own profile (bio, photo, location, website)
  • View followers and following count
  • Bookmarks list (own profile only)

πŸ” Search & Discovery

  • Real-time search
  • Filter by tags
  • Sort options (relevance, date)
  • Combines internal and external (HN) results
  • Responsive results display

πŸ‘¨β€πŸ’Ό Admin Dashboard

  • User management table
  • Content moderation tools
  • Report queue with filtering
  • Email blocking interface
  • Analytics overview
  • Problematic users monitoring

🎨 UI Components

Icons Used Throughout

  • FaUser - Author/username
  • FaStar (yellow) - Points/likes
  • FaRegClock - Timestamps
  • FaCommentAlt - Comments count
  • FaExternalLinkAlt - External links
  • BiLike/BiSolidLike - Like buttons
  • Bookmark icon - Save functionality

Responsive Breakpoints

  • Mobile: < 640px (sm)
  • Tablet: 640px - 1024px (md/lg)
  • Desktop: > 1024px (xl)

πŸ“‚ Project Structure

src/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ (auth)/              # Authentication pages
β”‚   β”œβ”€β”€ admin/               # Admin dashboard
β”‚   β”œβ”€β”€ components/          # Shared components
β”‚   β”œβ”€β”€ context/             # React context (Auth)
β”‚   β”œβ”€β”€ details/[storyId]/   # Story detail pages
β”‚   β”œβ”€β”€ home/                # Home page
β”‚   β”œβ”€β”€ profile/             # User profiles
β”‚   β”œβ”€β”€ search/              # Search pages
β”‚   β”œβ”€β”€ services/            # API services
β”‚   β”œβ”€β”€ store/               # Redux store
β”‚   └── types/               # TypeScript types
β”œβ”€β”€ components/ui/           # shadcn/ui components
└── public/                  # Static assets

πŸ”‘ Key Pages & Routes

Route Description Auth Required
/ Landing page ❌
/home Main feed ❌
/details/[storyId] Story details ❌
/logIn Login page ❌
/register Registration ❌
/profile/[username] User profile ❌
/search Search results ❌
/admin Admin dashboard βœ… (Admin only)

🎯 Special Features

Comment Threading

  • Depth Limit: 1 (only one level of replies)
  • Top-level comments can have replies
  • Replies cannot have further replies
  • Reply button hidden at depth 1

Story Types

  • story: Regular posts
  • job: Job postings (EMPLOYER/ADMIN only)
  • ask_hn: Ask HN style posts
  • show_hn: Show HN style posts
  • poll: Polls

Hybrid Content System

  • Internal Stories: UUID format (e.g., abc-123-def)
  • External Stories: Numeric IDs (e.g., 12345)
  • External stories fetch metadata from Algolia
  • Comments for external stories are MongoDB-only

Responsive Design

  • Mobile-first approach
  • Stacked layouts on mobile
  • Horizontal layouts on desktop
  • Touch-friendly buttons on mobile
  • Optimized image loading

πŸ§ͺ Development

# Run development server
npm run dev

# Build for production
npm run build

# Start production server
npm run start

# Lint code
npm run lint

# Format code
npm run format

πŸš€ Deployment

Vercel (Recommended)

# Deploy to Vercel
vercel deploy

# Deploy to production
vercel --prod

Docker

docker build -t social-network-frontend .
docker run -p 3001:3001 social-network-frontend

πŸ”§ Configuration

Tailwind CSS

Custom configuration in tailwind.config.ts

  • Custom colors (cyan theme)
  • Responsive breakpoints
  • Custom animations

Redux Store

State management for:

  • User authentication
  • Profile data
  • Bookmarks
  • UI state

🎨 Design System

Color Palette

  • Primary: Cyan
  • Accent: Blue
  • Text: Gray
  • Background: White/Light Gray

Typography

  • Font: System font stack
  • Headings: Bold, larger sizes
  • Body: Regular, readable sizes

πŸ“„ License

MIT


πŸ‘₯ Team

  • Preethi Rajesh Yennemadi - Section 4 - Grad Student MSCS
  • Kalyana Ramanuja Swami Mudumby - Section 4 - Grad Student MSCS
  • Mrinal Srinath Setty - Section 4 - Grad Student MSCS

πŸ”— Links

About

Social Network: Web Development Final Project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 92.6%
  • JavaScript 4.0%
  • CSS 2.5%
  • Other 0.9%