Newt
Real-time news aggregation service with React frontend and Express backend.
- Real-time news updates via WebSocket
- Search functionality
- Multiple news sources through NewsAPI
- Responsive design
- Auto-refresh news every 5 minutes
- Node.js (v16+)
- npm or yarn
- NewsAPI key (free at https://newsapi.org)
Go to https://newsapi.org and sign up for a free API key.
cd backend
npm install
cp .env.example .env
# Edit .env and add your NewsAPI key
cd frontend
npm install
cd backend
npm run dev
The backend will run on http://localhost:3000
cd frontend
npm run dev
The frontend will run on http://localhost:5173
Open your browser to http://localhost:5173
and start using Newt!
newt/
├── backend/
│ ├── services/
│ │ └── newsApi.js # NewsAPI integration
│ ├── server.js # Express + Socket.io server
│ ├── package.json
│ └── .env.example
├── frontend/
│ ├── src/
│ │ ├── components/
│ │ │ ├── NewsFeed.jsx
│ │ │ ├── ArticleCard.jsx
│ │ │ └── SearchBar.jsx
│ │ ├── App.jsx
│ │ ├── main.jsx
│ │ └── index.css
│ ├── vite.config.js
│ ├── index.html
│ └── package.json
└── README.md
GitHub Pages can host static content only. Since this project has a backend API dependency, you have two options:
Option A: Frontend-only with public APIs
- Build the frontend:
cd frontend && npm run build
- The
dist/
folder can be hosted on GitHub Pages - You'd need to redeploy your backend separately or use a serverless solution
Option B: Full Stack (Recommended for beginners)
- Use a free service like Render.com, Railway.app, or Fly.io (they have generous free tiers)
- Deploy both backend and frontend together
- Much easier than managing separate deployments
Free Options:
- Render.com: Deploy Node.js apps free (with some limitations)
- Railway.app: $5/month free tier, very generous
- Fly.io: Free tier available
- Heroku: Paid now, but other services have replaced it
Steps for Render.com (simplest):
- Push code to GitHub
- Go to Render.com, connect your GitHub account
- Click "New Web Service"
- Select your repo
- Set environment variables (NEWS_API_KEY)
- Deploy
Recommended for beginners: Use Render or Railway to deploy both frontend and backend from the same repo. They handle building and serving both.
- GitHub Pages: Free but static only (not suitable for this project)
- Render/Railway: ~$0-5/month, perfect for small projects
- Option 1 (Simple): Use one of these services, deploy everything together
- Option 2 (Advanced): Deploy frontend to GitHub Pages, backend to Render (more complex)
Backend requires these in .env
:
NEWS_API_KEY=your_api_key
PORT=3000
FRONTEND_URL=http://localhost:5173
NEWS_UPDATE_INTERVAL=300000
npm run dev
- Start with auto-reload (watches for changes)npm start
- Start production server
npm run dev
- Start dev server with hot reloadnpm run build
- Build for productionnpm run preview
- Preview production build locally
- Backend: Express.js + Socket.io for real-time updates
- Frontend: React with Socket.io client
- API: NewsAPI.org for news data
- Real-time: WebSocket connections update all connected clients immediately
- Add category filtering
- Implement user preferences/bookmarks
- Add dark mode
- Improve error handling
- Add tests