A comprehensive Node.js Express API for RSS feed aggregation and content management. Udgibil enables users to discover, subscribe to, and manage RSS feeds while providing advanced search capabilities and content processing features.
Frontend Repository: udgibil-front
UD.GILIB is an ancient Sumerian word that translates to "news" in English.
The word is made up of two parts:
- UD = day, time, daily
- GILIB = (combined with UD to mean news/information)
Together, UD.GILIB literally means something like "daily information" or "news of the day" - which is essentially what we call "news" today.
- RSS Feed Management: Automatic feed discovery, parsing, and content extraction
- User Management: Google OAuth authentication with personalized collections
- Content Processing: Article extraction, sanitization, and processing
- Search & Discovery: Full-text search across feeds and articles
- Bookmark System: Save and organize favorite articles
- YouTube Integration: Support for YouTube RSS feeds
- Image Processing: Integration with ImageKit for image optimization
- Email Notifications: Postmark integration for transactional emails
- Admin Dashboard: Feed and user management capabilities
- API Documentation: RESTful API with comprehensive endpoints
- Runtime: Node.js (ES Modules)
- Framework: Express.js
- Database: MongoDB with connection pooling
- Authentication: Google OAuth 2.0 + JWT
- Feed Processing: Custom feed parser with fallback mechanisms
- Content Extraction: Cheerio, DOMPurify, HTML sanitization
- Image Service: ImageKit integration
- Email Service: SendGrid
- Date/Time: Luxon
- Validation: Custom validators and input sanitization
- Deployment: Docker support
- Node.js (v16 or higher)
- MongoDB (local or cloud instance)
- Google OAuth credentials
- ImageKit account (for image processing)
- SendGrid account (for emails)
-
Clone the repository
git clone <repository-url> cd udgibil-back
-
Install dependencies
npm install
-
Set up environment configuration
Copy the example environment files and configure them with your values:
# Copy example files cp bin/development.env.example bin/development.env cp bin/production.env.example bin/production.envThen edit the files with your actual configuration values:
bin/development.env- Development environment settingsbin/production.env- Production environment settings
Required Configuration:
MONGO_URI- MongoDB connection stringMONGO_DB- Database namePORT- Server port (defaults to 5188)- Google OAuth credentials (Client ID, Secret, API key)
- JWT secret key (use a strong, random string)
UDGIBIL_HOST- Main application host URLUDGIBIL_HOST_MOBILE- Mobile application host URL- External service API keys (SendGrid, ImageKit, etc.)
-
Set up MongoDB
Ensure MongoDB is running and create the required collections:
users- User accounts and preferencesfeeds- RSS feed metadataarticles- Processed articlesbookmarks- User bookmarksviews- Article view trackingsupport- Support ticketslogs- Application logs
npm start- Runs with
NODE_ENV=development - Uses nodemon for auto-restarting
- Enables CORS for local development
- Serves on port 5188 (default) or PORT environment variable
npm run prod- Runs with
NODE_ENV=production - Optimized for production deployment
- Serves on configured PORT
All protected endpoints require authentication via JWT token obtained through Google OAuth.
Public Endpoints (No Auth Required):
/auth/*- Authentication routes/cron/*- Scheduled task endpoints/shared/*- Shared content/land/*- Landing page APIs/sofeco/*- Sofeco integration
Protected Endpoints (Auth Required):
/feed/*- Feed management/articles/*- Article operations/user/*- User management/bookmarks/*- Bookmark operations/search/*- Search functionality/info/*- System information
GET /feed/url?url={rss-url} # Fetch and process RSS feed
GET /feed/discover # Discover feeds by category
POST /feed/subscribe # Subscribe to a feed
DELETE /feed/unsubscribe # Unsubscribe from feed
GET /articles # Get user's articles
GET /articles/feed/{feedId} # Get articles from specific feed
POST /articles/bookmark # Bookmark an article
GET /articles/{id} # Get specific article
GET /search/feeds?q={query} # Search feeds
GET /search/articles?q={query} # Search articles
GET /search/own?q={query} # Search user's subscribed feeds
GET /user/profile # Get user profile
PUT /user/profile # Update user profile
GET /user/collections # Get user's feed collections
POST /user/collections # Create new collection
GET /onboard # User onboarding endpoints
βββ app.js # Main application setup
βββ bin/
β βββ www.mjs # Server entry point
β βββ development.env # Development environment config
β βββ production.env # Production environment config
βββ controllers/ # Business logic controllers
β βββ articles.js
β βββ feeds.js
β βββ users.js
β βββ ...
βββ libs/ # Utility libraries
β βββ mongo.js # MongoDB handler
β βββ feedfetcher.js # RSS feed fetching
β βββ feedhandler.js # Feed processing
β βββ utils.js # Common utilities
β βββ ...
βββ middlewares/ # Express middlewares
β βββ authenticate.js # JWT authentication
βββ models/ # Data models
β βββ users.js
β βββ feed.js
β βββ articles.js
β βββ ...
βββ routes/ # API route definitions
β βββ auth.js
β βββ feeds.js
β βββ articles.js
β βββ ...
βββ public/ # Static files and data
βββ uploads/ # File uploads
βββ json/ # JSON data files
MongoDB Handler (libs/mongo.js)
- Singleton connection pattern
- Connection pooling with configurable limits
- Comprehensive query methods for all collections
- Aggregation pipeline support for complex searches
Feed Processing Pipeline
- URL Validation - Normalize and validate RSS URLs
- Feed Fetching - Primary axios request with ZenRows fallback
- Content Parsing - FeedParser processes RSS/Atom feeds
- Article Extraction - Content sanitization and processing
- Database Storage - Duplicate detection via MD5 hashing
- Metadata Enhancement - Automatic favicon and categorization
Authentication Flow
- Google OAuth 2.0 integration
- JWT token generation and validation
- User profile creation and management
- Session management with activity tracking
The project includes Docker configuration for containerized deployment:
# Build and run with docker-compose
docker-compose up -d
# Or build custom image
docker build -t udgibil-api .
docker run -p 5003:5003 udgibil-api- Service Name:
udgibil-api - Image:
booper/udgibil:api - Default Port: 5188
- Environment Configuration: Loads from
bin/{NODE_ENV}.env
- ES Modules (
import/exportsyntax) - Async/await for asynchronous operations
- Consistent error handling with try/catch blocks
- Input validation and sanitization
- Security best practices (no secrets in code)
Users Collection
{
_id: ObjectId,
name: String,
email: String,
googleId: String,
collections: Array, // Feed organization
bookmarks: Array, // Saved articles
preferences: Object, // User settings
createdAt: Date,
lastActivity: Date
}Feeds Collection
{
_id: ObjectId,
title: String,
description: String,
xmlUrl: String,
link: String,
image: Object,
language: String,
rating: Number,
followed: Number, // Follower count
available: Boolean,
lastUpdate: Date,
type: String // 'news', 'blog', 'udgibil'
}Articles Collection
{
_id: ObjectId,
feedId: ObjectId,
title: String,
content: String,
link: String,
pubDate: Date,
available: Boolean,
titleHash: String // For duplicate detection
}- Application Logs: Morgan HTTP request logging
- Error Tracking: Comprehensive error handling with stack traces
- Performance Monitoring: Connection pooling metrics
- Health Checks: Built-in health endpoint for monitoring
- Authentication: Google OAuth 2.0 + JWT tokens
- Input Validation: Request parameter validation and sanitization
- Content Security: HTML sanitization for user-generated content
- Rate Limiting: Configurable request timeouts
- Environment Security: Sensitive data in environment variables
- CORS: Configurable cross-origin resource sharing
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes following the existing code style
- Test your changes thoroughly
- Commit with descriptive messages
- Push to your fork and submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Create an issue in the GitHub repository
- Follow on Twitter: @Enkiboo
If this RSS reader has made your news consumption a little brighter (or saved you from doomscrolling), consider buying me a coffee! β Your support helps keep the servers running and the features flowing.
Every cup counts and keeps the ancient Sumerian news spirits happy! π°β¨
- GraphQL API implementation
- Real-time notifications via WebSockets
- Advanced analytics and reporting
- Mobile app API enhancements
- Content recommendation engine
- Multi-language support expansion
