A modern, responsive social news platform built with React. Users can browse articles, filter by topics, sort, vote, and comment โ similar to Reddit โ with a sleek, intuitive interface.
View the Deployed App: https://news-api-ly.netlify.app/
Northcoders News is a social news aggregation, content rating, and discussion website similar to Reddit. Users can:
- Browse Articles: View all articles with beautiful card-based layouts
- Filter by Topics: Explore articles by specific topics (coding, cooking, football, etc.)
- Sort & Filter: Sort articles by date, votes, or comment count in ascending/descending order
- Vote on Articles: Upvote or downvote articles with real-time feedback
- Read & Comment: View full articles and engage in discussions
- Responsive Design: Seamless experience across desktop, tablet, and mobile devices
- Modern UI: Glassmorphism effects and clean typography
- Figma-Inspired: Professional design system with consistent spacing and colors
- Accessibility: ARIA labels, keyboard navigation, and screen reader support
- Performance: Optimized with lazy loading and efficient state management
Backend API: https://github.com/Lauren21717/news-BE
- Frontend: React 18, React Router, JavaScript ES6+
- Styling: Tailwind CSS, CSS3
- API: RESTful API integration with custom fetch utilities
- State Management: React Hooks (useState, useEffect, useParams, useSearchParams)
- Build Tool: Vite
- Version Control: Git & GitHub
- Node.js: v18.0.0 or higher
- npm: v9.0.0 or higher
Check your Node version with:
node --versiongit clone https://github.com/Lauren21717/nc-news.git
cd nc-newsnpm installnpm run devNavigate to http://localhost:5173 to view the application.
nc-news/
โโโ public/
โ โโโ index.html
โโโ src/
โ โโโ components/
โ โ โโโ Header.jsx # Navigation header
โ โ โโโ ArticlesList.jsx # Main articles view with pagination
โ โ โโโ ArticleCard.jsx # Individual article preview
โ โ โโโ SingleArticle.jsx # Full article view
โ โ โโโ TopicsList.jsx # Topics overview page
โ โ โโโ TopicArticles.jsx # Topic-filtered articles
โ โ โโโ SortControls.jsx # Modern sorting interface
โ โ โโโ CommentsList.jsx # Comments display
โ โ โโโ CommentCard.jsx # Individual comment
โ โ โโโ AddComment.jsx # Comment form with validation
โ โ โโโ VotingButtons.jsx # Article voting with optimistic updates
โ โ โโโ NotFound.jsx # 404 error pages
โ โ โโโ ErrorBoundary.jsx # Error boundary component
โ โโโ utils/
โ โ โโโ api.js # API utilities and functions
โ โ โโโ validation.js # Form validation utilities
โ โโโ App.jsx # Main app component and routing
โ โโโ App.css # Global styles
โ โโโ main.jsx # React entry point
โโโ package.json
โโโ README.md
- Article Management: Browse, filter, and sort articles
- Topic Navigation: Filter articles by specific topics
- Real-time Voting: Upvote/downvote with optimistic UI updates
- Comment System: Add, view, and delete comments
- Pagination: Load more articles with infinite scroll
- Responsive Design: Mobile-first approach with Tailwind CSS
- Loading States: Skeleton loaders and smooth transitions
- Error Handling: User-friendly error pages with helpful actions
- Form Validation: Real-time validation with clear feedback
- URL State: Shareable URLs for sorted/filtered views
- Modern React Patterns: Hooks, component composition, custom hooks
- Performance Optimized: Lazy loading, debounced inputs, efficient re-renders
- Accessibility: WCAG compliant with semantic HTML and ARIA labels
- Error Boundaries: Graceful error handling and recovery
- Clean Code: Modular components with separation of concerns
- View All Articles: Homepage displays all articles in a responsive grid
- Filter by Topic: Click topic links to view articles from specific categories
- Sort Articles: Use the modern sort controls to organize by date, votes, or comments
- Load More: Click "Load More" to see additional articles
- Read Articles: Click any article title or "Read More" to view the full content
- Vote on Articles: Use the upvote/downvote buttons to rate articles
- Add Comments: Share your thoughts using the comment form
- Navigate: Use breadcrumb navigation and back links to explore
- 404 Pages: Custom error pages for missing articles, topics, or routes
- Network Issues: Retry buttons for failed requests
- Form Validation: Real-time feedback for comment submissions
# Start development server
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview
# Run linting
npm run lintThis frontend connects to a custom REST API with the following endpoints:
GET /api/articles- Fetch articles with sorting/filteringGET /api/articles/:article_id- Fetch single articleGET /api/articles/:article_id/comments- Fetch article commentsPOST /api/articles/:article_id/comments- Add new commentPATCH /api/articles/:article_id- Update article votesDELETE /api/comments/:comment_id- Delete commentGET /api/topics- Fetch all topics
Create a .env file in the root directory (if needed):
VITE_API_URL=https://your-api-url.com/apiUpdate the API base URL in src/utils/api.js:
const BASE_URL = 'https://your-api-url.com/api';- Primary: Green (#059669)
- Secondary: Gray tones for text and backgrounds
- Error: Red (#EF4444) for validation and errors
- Success: Green for confirmations
- Font Family: Inter (Google Fonts)
- Headings: Bold, large sizes with proper hierarchy
- Body Text: Clean, readable with good contrast
- Glassmorphism: Semi-transparent backgrounds with backdrop blur
- Card Design: Subtle shadows and rounded corners
- Buttons: Consistent hover states and transitions
- Forms: Clean inputs with validation styling
This is a portfolio project, but if you'd like to suggest improvements:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- User Authentication: Login/logout functionality
- User Profiles: Individual user pages and avatars
- Real-time Updates: WebSocket integration for live comments
- Advanced Filtering: Date ranges, multiple topic selection
- Dark Mode: Theme toggle for user preference
- Bookmarking: Save favorite articles
- Search: Full-text search across articles
- Social Sharing: Share articles on social media
- Placeholder images from Picsum may occasionally load slowly
- Optimistic comment updates may briefly show loading states on slow connections
This portfolio project was created as part of a Digital Skills Bootcamp in Software Engineering provided by Northcoders