A sophisticated, enterprise-grade API service that generates intelligent Wikipedia article summaries using GitHub AI (GPT-4o). Built with modern architecture patterns, comprehensive security, and production-ready features for scalable deployment.
Perfect for researchers, content creators, businesses, and developers who need high-quality automated summaries with advanced features like batch processing, multiple summary styles, and comprehensive analytics.
- GitHub AI Integration: Leverages GitHub marketplace
gpt-4omodel for superior quality - Multiple Summary Styles: Bullet points, paragraphs, academic, technical, and simplified formats
- Wikipedia Integration: Direct article fetching and processing from Wikipedia
- Batch Processing: Generate multiple summaries in a single request (Premium+)
- Real-time Health Monitoring: Comprehensive API and service health checks
- Smart Caching: Redis-based caching for improved performance and cost efficiency
- Dual Authentication: JWT tokens and API key authentication
- Role-based Access Control: Admin, premium, and standard user roles with granular permissions
- Account Security: Automatic account locking, login attempt tracking, password policies
- Rate Limiting: Intelligent throttling based on subscription tiers with burst handling
- Input Validation: Comprehensive request validation and sanitization using Joi
- Security Headers: Helmet.js integration for OWASP compliance
- Tiered Pricing Plans: Free, Basic, Premium, Enterprise with feature differentiation
- Usage Tracking: Detailed API call analytics, token consumption, and cost tracking
- Flexible Billing: Ready for Stripe payment integration with webhook support
- Admin Dashboard: Complete user and revenue management interface
- API Key Management: Secure key generation, rotation, and permission scoping
- Comprehensive Logging: Winston-based logging with daily rotation and structured format
- Performance Metrics: Response times, success rates, error tracking with percentiles
- Health Endpoints: Service status, dependency monitoring, and diagnostic information
- Usage Analytics: Detailed consumption patterns, user behavior, and performance insights
- Real-time Monitoring: Live system metrics and alerting capabilities
- RESTful API Design: Clean, intuitive endpoint structure following REST principles
- Comprehensive Documentation: Interactive API documentation with examples
- Docker Ready: Complete containerization setup for development and production
- Testing Framework: Jest-based test suite with 90%+ coverage and CI/CD ready
- Development Tools: Hot reload, debugging support, migration tools, and seed scripts
- Node.js 18+
- MongoDB 5.0+
- GitHub AI Token (Get yours here)
- Redis (optional, for caching)
# Clone repository
git clone https://github.com/yourusername/wikipedia-summary-generator.git
cd wikipedia-summary-generator
# Start with Docker Compose
docker-compose up -d
# View logs
docker-compose logs -f api# Clone and install
git clone https://github.com/yourusername/wikipedia-summary-generator.git
cd wikipedia-summary-generator
npm install
# Configure environment
cp .env.example .env
# Edit .env with your configuration
# Initialize database
npm run db:migrate
npm run db:seed
# Start development server
npm run dev# Health check
curl http://localhost:3000/api/v1/health
# Generate your first summary
curl -X POST http://localhost:3000/api/v1/summary \
-H "Content-Type: application/json" \
-d '{"title": "Artificial Intelligence", "style": "bullet"}'βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β API Gateway Layer β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Express.js Server β Middleware Stack β Rate Limiting β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Authentication Layer β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β JWT Handler β API Key Auth β Role-Based Access β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Business Logic Layer β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Summary Service β User Service β Admin Service β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Data Layer β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β MongoDB β Redis Cache β File Storage β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β External Services β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β GitHub AI β Wikipedia API β Stripe (Optional)β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
https://your-domain.com/api/v1
Authorization: Bearer <your-jwt-token>X-API-Key: <your-api-key>POST /api/v1/summary
Content-Type: application/json
Authorization: Bearer <token>
{
"title": "Artificial Intelligence",
"style": "bullet|paragraph|academic|technical|simple",
"maxLength": 500,
"language": "en"
}Response:
{
"success": true,
"data": {
"title": "Artificial Intelligence",
"summary": "β’ AI is the simulation of human intelligence processes...",
"style": "bullet",
"length": 425,
"tokensUsed": 150,
"sourceUrl": "https://en.wikipedia.org/wiki/Artificial_Intelligence",
"generatedAt": "2024-01-15T10:30:00Z"
},
"usage": {
"tokensUsed": 150,
"remainingTokens": 850,
"resetDate": "2024-01-16T00:00:00Z"
}
}POST /api/v1/summary/batch
Authorization: Bearer <token>
{
"articles": [
{"title": "Machine Learning", "style": "bullet"},
{"title": "Neural Networks", "style": "paragraph"}
],
"options": {
"maxLength": 300,
"parallel": true
}
}POST /api/v1/auth/register
Content-Type: application/json
{
"name": "John Doe",
"email": "john@example.com",
"password": "SecurePass123!",
"plan": "basic"
}POST /api/v1/auth/login
Content-Type: application/json
{
"email": "john@example.com",
"password": "SecurePass123!"
}POST /api/v1/auth/api-key
Authorization: Bearer <token>
{
"name": "Production API Key",
"permissions": ["summary:read", "summary:write"],
"rateLimit": 1000
}GET /api/v1/admin/users?page=1&limit=50
POST /api/v1/admin/users/:id/status
GET /api/v1/admin/analytics/overview
GET /api/v1/admin/analytics/revenueGET /api/v1/health
GET /api/v1/health/detailed
GET /api/v1/admin/system/metrics| Feature | Free | Basic | Premium | Enterprise |
|---|---|---|---|---|
| Monthly Requests | 1,000 | 10,000 | 100,000 | Unlimited |
| Rate Limit | 10/min | 100/min | 1,000/min | Custom |
| Batch Processing | β | β (5 max) | β (25 max) | β (Unlimited) |
| Summary Styles | Basic | All | All + Custom | All + Custom |
| Priority Support | β | Priority | Dedicated | |
| Analytics Dashboard | Basic | Standard | Advanced | Enterprise |
| API Keys | 1 | 3 | 10 | Unlimited |
| SLA | None | 99% | 99.9% | 99.99% |
| Price | Free | $9/month | $49/month | Custom |
| Variable | Description | Default | Required |
|---|---|---|---|
NODE_ENV |
Environment mode | development | β |
PORT |
Server port | 3000 | β |
API_VERSION |
API version | v1 | β |
| Variable | Description | Default | Required |
|---|---|---|---|
MONGODB_URI |
MongoDB connection string | - | β |
MONGODB_TEST_URI |
Test database connection | - | β |
REDIS_URL |
Redis connection string | - | β |
| Variable | Description | Default | Required |
|---|---|---|---|
GITHUB_AI_TOKEN |
GitHub AI API token | - | β |
GITHUB_AI_MODEL |
AI model to use | gpt-4o | β |
GITHUB_AI_ENDPOINT |
AI service endpoint | - | β |
| Variable | Description | Default | Required |
|---|---|---|---|
JWT_SECRET |
JWT signing secret | - | β |
JWT_EXPIRE |
JWT expiration time | 24h | β |
BCRYPT_ROUNDS |
Password hashing rounds | 12 | β |
The application automatically creates optimized indexes for:
- User authentication (email, apiKey)
- API call tracking (user, timestamp, endpoint)
- Pricing plans (plan, status)
- Performance optimization
# Run all pending migrations
npm run db:migrate
# Create new migration
npm run db:migrate:create add-new-feature
# Rollback last migration
npm run db:migrate:rollback# Seed all data
npm run db:seed
# Seed specific collections
npm run db:seed -- --users --pricing# Start all services
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose downServices included:
- API Server: Node.js application
- MongoDB: Database with initialization scripts
- Redis: Caching and session storage
- Mongo Express: Database admin interface
# Production deployment
docker-compose -f docker-compose.prod.yml up -dProduction features:
- Optimized Docker images
- Health checks and restart policies
- Resource limits and security constraints
- Logging and monitoring integration
# Setup
heroku create your-app-name
heroku addons:create mongolab:sandbox
heroku addons:create heroku-redis:hobby-dev
# Configure environment
heroku config:set GITHUB_AI_TOKEN=your-token
heroku config:set JWT_SECRET=your-secret
heroku config:set NODE_ENV=production
# Deploy
git push heroku mainrailway login
railway init
railway add
railway deploynpm install -g vercel
vercelUse the provided Dockerfile with AWS ECS for scalable container deployment:
# AWS Task Definition
{
"family": "wikipedia-summary-api",
"networkMode": "awsvpc",
"cpu": "256",
"memory": "512",
"containerDefinitions": [{
"name": "api",
"image": "your-registry/wikipedia-summary:latest",
"portMappings": [{
"containerPort": 3000,
"protocol": "tcp"
}]
}]
}az container create \
--resource-group myResourceGroup \
--name wikipedia-summary-api \
--image your-registry/wikipedia-summary:latest \
--environment-variables GITHUB_AI_TOKEN=xxx# Build and deploy
gcloud builds submit --tag gcr.io/PROJECT-ID/wikipedia-summary
gcloud run deploy --image gcr.io/PROJECT-ID/wikipedia-summary# Install dependencies
npm install
# Start development server with hot reload
npm run dev
# Run in watch mode
npm run dev:watch| Script | Description |
|---|---|
npm start |
Production server |
npm run dev |
Development with hot reload |
npm run dev:watch |
Development with file watching |
npm test |
Run test suite |
npm run test:watch |
Tests in watch mode |
npm run test:coverage |
Coverage report |
npm run lint |
ESLint checking |
npm run lint:fix |
Fix ESLint issues |
npm run db:migrate |
Database migrations |
npm run db:seed |
Seed sample data |
npm run docker:build |
Build Docker image |
npm run docker:run |
Run Docker container |
# Run all tests
npm test
# Run with coverage report
npm run test:coverage
# Run specific test files
npm test -- auth.test.js
# Run tests matching pattern
npm test -- --grep "authentication"tests/
βββ unit/
β βββ models/ # Model unit tests
β βββ services/ # Service unit tests
β βββ middleware/ # Middleware tests
β βββ utils/ # Utility function tests
βββ integration/
β βββ auth.test.js # Authentication flow tests
β βββ summary.test.js # Summary generation tests
β βββ admin.test.js # Admin functionality tests
β βββ health.test.js # Health check tests
βββ fixtures/
β βββ users.json # Test user data
β βββ articles.json # Sample articles
β βββ responses.json # Expected responses
βββ helpers/
βββ testSetup.js # Test environment setup
βββ mockData.js # Mock data generators
βββ apiHelpers.js # API testing utilities
# Load testing
npm run test:load
# Memory leak detection
npm run test:memory
# Stress testing
npm run test:stress{
"extends": ["eslint:recommended", "node"],
"rules": {
"no-console": "warn",
"no-unused-vars": "error",
"semi": ["error", "always"],
"quotes": ["error", "single"]
}
}{
"semi": true,
"trailingComma": "es5",
"singleQuote": true,
"printWidth": 80,
"tabWidth": 2
}GET /api/v1/health
GET /api/v1/health/detailed
GET /api/v1/admin/system/status{
"status": "healthy",
"timestamp": "2024-01-15T10:30:00Z",
"uptime": 86400,
"services": {
"database": {
"status": "healthy",
"responseTime": 12,
"lastCheck": "2024-01-15T10:30:00Z"
},
"github_ai": {
"status": "healthy",
"responseTime": 245,
"lastCheck": "2024-01-15T10:30:00Z"
},
"redis": {
"status": "healthy",
"responseTime": 3,
"lastCheck": "2024-01-15T10:30:00Z"
}
},
"metrics": {
"requests_per_minute": 125,
"error_rate": 0.02,
"average_response_time": 180
}
}- Structured Logging: JSON format for easy parsing
- Log Levels: error, warn, info, http, verbose, debug, silly
- File Rotation: Daily rotation with compression
- Multiple Transports: Console, file, and external services
{
"timestamp": "2024-01-15T10:30:00Z",
"level": "info",
"message": "Summary generated successfully",
"requestId": "req_123456",
"userId": "user_789",
"endpoint": "/api/v1/summary",
"responseTime": 245,
"tokensUsed": 150
}- Response Times: P50, P95, P99 percentiles
- Throughput: Requests per second/minute
- Error Rates: 4xx, 5xx error percentages
- Token Usage: GitHub AI consumption tracking
- Database Performance: Query execution times
- Cache Hit Rates: Redis cache effectiveness
Access comprehensive analytics at /admin/analytics:
- Real-time system metrics
- User activity patterns
- Revenue and usage trends
- Performance bottlenecks
- Error frequency analysis
- Password Policies: Minimum length, complexity requirements
- Account Locking: Automatic lockout after failed attempts
- JWT Security: Secure token generation and validation
- API Key Security: Encrypted storage and rotation capabilities
- Request Validation: Joi schema validation for all inputs
- SQL Injection Prevention: Parameterized queries with Mongoose
- XSS Protection: Input sanitization and output encoding
- Rate Limiting: DDoS protection and abuse prevention
- HTTPS Only: TLS encryption for all communications
- Security Headers: Helmet.js for OWASP compliance
- CORS Configuration: Restricted cross-origin requests
- Environment Separation: Isolated configurations per environment
- Use HTTPS in production
- Rotate secrets regularly
- Monitor access logs
- Update dependencies
- Use environment separation
- Enable audit logging
- Configure firewalls
- Set up monitoring alerts
- Regular Updates: Automated dependency updates
- Security Scanning: Continuous vulnerability assessment
- Penetration Testing: Regular security audits
- Incident Response: Defined security incident procedures
- GDPR Compliance: User data protection and privacy
- Data Encryption: At-rest and in-transit encryption
- Data Retention: Configurable retention policies
- Right to Deletion: User data removal capabilities
We welcome contributions from the community! Here's how to get started:
- Fork the repository on GitHub
- Clone your fork locally
- Create a feature branch (
git checkout -b feature/amazing-feature) - Setup your development environment
- Make your changes
- Test your changes thoroughly
- Commit with conventional commit format
- Push to your fork
- Submit a pull request
- ESLint: Follow the provided configuration
- Prettier: Use for consistent formatting
- Naming: Use camelCase for variables, PascalCase for classes
- Comments: Document complex logic and public APIs
type(scope): description
feat(auth): add API key rotation functionality
fix(summary): resolve timeout issue with long articles
docs(api): update authentication examples
test(integration): add batch processing tests
- Unit Tests: Test individual functions and modules
- Integration Tests: Test API endpoints and workflows
- Coverage: Maintain >90% test coverage
- Performance: Include performance regression tests
- All tests pass (
npm test) - Code coverage maintained
- ESLint and Prettier checks pass
- Documentation updated
- CHANGELOG.md updated
- Automated Checks: CI/CD pipeline validation
- Code Review: Maintainer review for quality and standards
- Testing: Manual testing of new features
- Documentation: Verify documentation completeness
- Merge: Approved PRs merged to main branch
Include:
- Environment: OS, Node.js version, dependencies
- Steps to Reproduce: Clear reproduction steps
- Expected vs Actual: What should happen vs what happens
- Logs: Relevant error messages and stack traces
Include:
- Use Case: Why is this feature needed?
- Proposed Solution: How should it work?
- Alternatives: Other approaches considered
- Impact: Who benefits from this feature?
- Issues: Report bugs and request features
- Discussions: Community Q&A and ideas
- Wiki: Additional documentation and guides
Tag your questions with wikipedia-summary-api for community support.
Join our community server for real-time discussions and support.
- Community: GitHub issues and community forums
- Basic: Email support with 48-hour response time
- Premium: Priority email support with 24-hour response
- Enterprise: Dedicated support with SLA guarantees
- Custom Integration: Tailored API integration assistance
- Performance Optimization: System tuning and scaling guidance
- Training: Team training and best practices workshops
- Consulting: Architecture and implementation consulting
- General Support: support@wikisummaryapi.com
- Enterprise Sales: enterprise@wikisummaryapi.com
- Security Issues: security@wikisummaryapi.com
- Partnership: partnerships@wikisummaryapi.com
This project is licensed under the MIT License - see the LICENSE file for details.
This project is free for commercial use under the MIT license. For enterprise support and additional features, contact our sales team.
- GitHub AI: For providing state-of-the-art AI models
- Wikipedia: For the incredible knowledge database
- MongoDB: For reliable and scalable data storage
- Redis: For high-performance caching solutions
- All contributors who have made this project possible
- The Node.js and JavaScript communities
- Testing and development tool maintainers
- Documentation and tutorial creators
- Beta testers who provided valuable feedback
- Security researchers who responsibly disclosed vulnerabilities
- Community members who contributed feature ideas and improvements
Made with β€οΈ by the Wikipedia Summary API Team
Website β’ Documentation β’ API Status β’ Blog