A modern Next.js web application for viewing and managing RSS feeds, email summaries, and news articles from a PostgreSQL database.
- Unified Feed View: Display RSS feeds, email threads, and news articles in one place
- Authentication: Secure user authentication with NextAuth.js
- Subscription Management: Subscribe to specific sources, authors, or threads
- Advanced Search: Full-text search with filters by type and date range
- Bilingual Summaries: View summaries in both English and Chinese
- Responsive Design: Mobile-friendly interface built with Tailwind CSS
- Modern UI: Built with shadcn/ui components
- Frontend: Next.js 14 (App Router)
- Language: TypeScript
- Database: PostgreSQL with node-postgres
- Authentication: NextAuth.js with credentials provider
- UI Components: shadcn/ui + Radix UI
- Styling: Tailwind CSS
- Icons: Lucide React
- Node.js 18.17 or higher
- PostgreSQL database with existing tables:
rss_feedsemail_feedsnews_feeds
- Clone the repository:
git clone <repository-url>
cd pgnexus- Install dependencies:
npm install- Set up environment variables:
cp .env.local.example .env.localEdit .env.local and configure:
DATABASE_URL=postgresql://user:password@localhost:5432/dbname
NEXTAUTH_SECRET=<generate-with-openssl-rand-base64-32>
NEXTAUTH_URL=http://localhost:3000- Run database migrations:
npm run migrateThis will create the users and user_subscriptions tables.
Start the development server:
npm run devOpen http://localhost:3000 in your browser.
The application expects these tables to exist in your PostgreSQL database:
rss_feeds
id- Serial primary keytitle- Article titlelink- Article URLdescription- Article descriptionpubdate- Publication dateauthor- Feed authorsummary_english- English summarysummary_chinese- Chinese summarycreated_at- Record creation timestamp
email_feeds
id- Serial primary keythreadid- Email thread identifiersubject- Email subjectlastactivity- Last activity datesummary_english- English summarysummary_chinese- Chinese summarycreated_at- Record creation timestamp
news_feeds
id- Serial primary keytitle- Article titleurl- Article URLsource- News sourcepublishdate- Publication datesummary_english- English summarysummary_chinese- Chinese summarycreated_at- Record creation timestamp
users
id- Serial primary keyemail- Unique email addresspassword_hash- Bcrypt password hashname- Optional user namecreated_at- Account creation timestamp
user_subscriptions
id- Serial primary keyuser_id- Foreign key to usersfeed_type- Type: 'rss', 'email', or 'news'source_identifier- Author/threadId/sourcecreated_at- Subscription creation timestamp
pgnexus/
├── app/ # Next.js App Router
│ ├── api/ # API routes
│ │ ├── auth/ # Authentication endpoints
│ │ ├── feeds/ # Feed endpoints
│ │ ├── subscriptions/ # Subscription CRUD
│ │ └── sources/ # Available sources
│ ├── dashboard/ # Dashboard pages
│ ├── login/ # Login page
│ └── signup/ # Signup page
├── components/ # React components
│ ├── ui/ # shadcn/ui components
│ ├── feeds/ # Feed components
│ ├── subscriptions/ # Subscription components
│ └── dashboard/ # Dashboard components
├── lib/ # Utilities and helpers
│ ├── db/ # Database queries
│ ├── types/ # TypeScript types
│ └── utils/ # Utility functions
├── migrations/ # SQL migrations
└── scripts/ # Build scripts
- Start the application
- Navigate to the signup page
- Create an account with email and password
- You'll be automatically logged in
- Dashboard: View all feeds in chronological order
- Show All / Subscribed: Toggle between all feeds and subscribed sources
- Search: Use filters to search by keyword, type, and date range
- Go to Subscriptions page
- Browse available sources by category (RSS, Email, News)
- Check/uncheck sources to subscribe/unsubscribe
- Click "Save Changes" to apply
- Enter keywords in the search box
- Select feed type (All, RSS, Email, News)
- Optionally set date range
- Click Search or press Enter
POST /api/auth/signup- Create new userPOST /api/auth/signin- Sign inPOST /api/auth/signout- Sign out
GET /api/feeds- Get all feeds (with pagination)GET /api/feeds/search- Search feeds
GET /api/subscriptions- Get user subscriptionsPOST /api/subscriptions- Add subscriptionDELETE /api/subscriptions- Remove subscription
GET /api/sources- Get all available sources
| Variable | Description | Required |
|---|---|---|
DATABASE_URL |
PostgreSQL connection string | Yes |
NEXTAUTH_SECRET |
Secret for JWT signing | Yes |
NEXTAUTH_URL |
Application URL | Yes |
NODE_ENV |
Environment (development/production) | No |
- Build the application:
npm run build- Start production server:
npm start- Set production
DATABASE_URL - Generate secure
NEXTAUTH_SECRET - Set correct
NEXTAUTH_URL - Run migrations on production database
- Configure SSL/HTTPS
- Set up monitoring and logging
- Passwords are hashed with bcryptjs (10 rounds)
- JWT sessions expire after 30 days
- SQL injection protection via parameterized queries
- XSS protection via React's built-in escaping
- CSRF protection via NextAuth.js
- Database connection pooling (max 20 connections)
- Indexes on frequently queried columns
- Pagination for large result sets
- Optimistic UI updates for subscriptions
- Verify
DATABASE_URLis correct - Ensure PostgreSQL is running
- Check firewall/network settings
- Check database credentials
- Verify PostgreSQL version compatibility
- Review migration logs for SQL errors
- Verify
NEXTAUTH_SECRETis set - Check
NEXTAUTH_URLmatches your domain - Clear browser cookies and try again
This project was created as a full-stack demonstration. Feel free to fork and customize for your needs.
MIT License - See LICENSE file for details