newsnow: Elegant Real-time News Reading with a Clean UI
Summary
newsnow offers an elegant and clean UI for reading real-time and trending news. It supports features like GitHub OAuth login, data synchronization, and adaptive scraping intervals to ensure an optimal and up-to-date news experience. This project, built with TypeScript, is designed for easy deployment on platforms like Cloudflare Pages or Vercel.
Repository Info
Tags
Click on any tag to explore related repositories
Introduction
newsnow is an open-source project designed for elegant reading of real-time and hottest news. It provides a clean and intuitive user interface, focusing on an optimal reading experience. Key features include real-time updates for trending news, GitHub OAuth login with data synchronization, and intelligent adaptive scraping intervals to optimize resource usage and prevent IP blocking.
Please note, the current version is a demo primarily supporting Chinese content. A full version with customization features and English content support is planned for future release.
Installation
Deploying newsnow is straightforward, with options for basic setup, Cloudflare Pages, or Docker.
Basic Deployment (without login and cache)
- Fork this repository.
- Import it into a platform like Cloudflare Pages or Vercel.
Cloudflare Pages Configuration
- Build command:
pnpm run build - Output directory:
dist/output/public
GitHub OAuth Setup
- Create a GitHub App.
- No special permissions are required.
- Set the callback URL:
https://your-domain.com/api/oauth/github(replaceyour-domainwith your actual domain). - Obtain your Client ID and Client Secret.
Environment Variables
Refer to example.env.server. For local development, rename it to .env.server and configure:
# GitHub Client ID
G_CLIENT_ID=
# GitHub Client Secret
G_CLIENT_SECRET=
# JWT Secret (usually same as Client Secret)
JWT_SECRET=
# Initialize database (set to true for first run)
INIT_TABLE=true
# Enable caching
ENABLE_CACHE=true
Database Support
newsnow supports database connectors via https://db0.unjs.io/connectors, with Cloudflare D1 Database being recommended.
- Create a D1 database in your Cloudflare Worker dashboard.
- Configure
database_idanddatabase_nameinwrangler.toml. - If
wrangler.tomldoesn't exist, renameexample.wrangler.tomland adjust settings. - Changes will take effect on the next deployment.
Docker Deployment
From the project root directory, run:
docker compose up
Environment variables can also be configured in docker-compose.yml.
Examples
To get newsnow running for development or to understand its extensibility, consider these examples:
Local Development
Node.js >= 20 is required.
corepack enable
pnpm i
pnpm dev
Adding Data Sources
The project provides full type definitions and a clean architecture for adding new data sources. Refer to the shared/sources and server/sources directories to extend its capabilities.
MCP Server Configuration
newsnow supports MCP servers, allowing for flexible integration. An example configuration for the newsnow-mcp-server is provided:
{
"mcpServers": {
"newsnow": {
"command": "npx",
"args": [
"-y",
"newsnow-mcp-server"
],
"env": {
"BASE_URL": "https://newsnow.busiyi.world"
}
}
}
}
Why Use It
newsnow stands out for its commitment to a superior reading experience, combining aesthetics with powerful backend features. Its elegant UI ensures a distraction-free environment for consuming news. With real-time updates and adaptive scraping, you're always informed with the latest trends. The project's roadmap promises multi-language support and enhanced personalization, making it a versatile choice for global news consumption. Furthermore, its easy deployment options and robust database support, especially with Cloudflare D1, make it a developer-friendly solution for building a personalized news aggregator.
Links
- GitHub Repository: https://github.com/ourongxing/newsnow