quotifyapi
v1.4.2
Published
A beautiful, fast, and reliable quote API with comprehensive documentation
Maintainers
Readme
💬 Quotify API
A beautiful, fast, and reliable quote API that provides inspirational quotes across multiple categories. Built with Express.js and designed for performance, it's perfect for developers building applications that need motivational content.
⚠️ Important Copyright Notice
Quotify API does not own, create, or claim ownership of any quotes provided through this service. All quotes are the intellectual property of their respective authors, creators, and copyright holders. This API serves as a collection and distribution platform only.
Please respect the original authors' rights and ensure proper attribution when using these quotes in your applications.
✨ Features
- 🚀 Fast & Reliable - Built with Express.js and optimized for performance
- 🛡️ Secure - Rate limiting, security headers, and abuse protection
- 📚 Rich Content - Multiple categories: happy, sad, love, motivational, wisdom
- 🌐 Easy Integration - Simple REST API with comprehensive documentation
- 📱 Responsive Design - Beautiful documentation website included
- 🎯 CLI Tool - Command-line interface for quick access
- 📊 Statistics - Detailed quote counts and category information
🚀 Quick Start
Install as NPM Package
npm install quotifyapiUse in Your Code
The SDK supports both Offline Mode (using bundled local quotes) and Online Mode (querying the live Quote API server).
Offline Mode (No API key required)
const { getRandomQuote, getRandomQuoteByType } = require('quotifyapi');
// Get a random quote from any category
const randomQuote = getRandomQuote();
console.log(randomQuote.text); // "Life is what happens when you're busy making other plans."
console.log(randomQuote.author); // "John Lennon"
// Get a motivational quote
const motivationalQuote = getRandomQuoteByType('motivational');
console.log(motivationalQuote.text); // "The only way to do great work is to love what you do."Online Mode (Requires API key)
const { ApiClient } = require('quotifyapi');
// Initialize the API client
const client = new ApiClient('your_api_key_here');
async function getOnlineQuotes() {
try {
// Get a random quote
const quote = await client.getRandomQuote();
console.log(`${quote.text} — ${quote.author}`);
// Get a quote by category
const wisdomQuote = await client.getRandomQuoteByType('wisdom');
console.log(`${wisdomQuote.text} — ${wisdomQuote.author}`);
} catch (error) {
console.error('Error fetching quotes:', error.message);
}
}
getOnlineQuotes();CLI Usage
# Get a random quote
npx quotifyapi random
# Get a specific category
npx quotifyapi type motivational
npx quotifyapi type love
# Show available categories
npx quotifyapi types
# Show statistics
npx quotifyapi stats
# Get help
npx quotifyapi helpNote: The CLI requires authentication. If the
QUOTIFY_API_KEYenvironment variable is not configured, the CLI will interactively prompt you to input your API key when running commands in a terminal.
🚀 GitHub Actions & CI/CD
This project uses GitHub Actions for automated testing, quality checks, and deployment. The following workflows are configured:
🔄 Automated Workflows
- Test & Quality Check - Runs on every push and pull request
- Deploy to Vercel - Automatically deploys to staging, manual approval for production
- Release Management - Creates GitHub releases and publishes to npm on version tags
- Dependabot - Automatically checks for dependency updates weekly
📋 Required GitHub Secrets
To enable automatic deployment, add these secrets to your repository:
| Secret Name | Description | How to Get |
|-------------|-------------|------------|
| VERCEL_TOKEN | Vercel deployment token | Vercel Account Settings |
| ORG_ID | Vercel team/organization ID | Vercel Dashboard → Settings → General |
| PROJECT_ID | Vercel project ID | Vercel Project Dashboard → Settings → General |
| NPM_TOKEN | NPM publish token (optional) | NPM Account Settings |
🏗️ Workflow Details
- Matrix Testing: Tests against Node.js 16.x, 18.x, and 20.x
- Security Audits: Runs
npm auditto check for vulnerabilities - Quality Gates: All tests must pass before deployment
- Automatic Releases: Push a tag like
v1.2.1to trigger a release
For detailed setup instructions, see DEPLOYMENT.md.
🌐 API Endpoints
Base URL
https://quotify.dazzelr.techGet Random Quote
GET /apiResponse:
{
"quote": {
"text": "Life is what happens when you're busy making other plans.",
"author": "John Lennon"
},
"type": "random",
"timestamp": "2025-01-15T10:30:00.000Z"
}Get Quote by Category
GET /api?type=motivationalAvailable Categories:
happy- Uplifting and joyful quotessad- Thoughtful and reflective quoteslove- Romantic and affectionate quotesmotivational- Inspirational and encouraging quoteswisdom- Philosophical and insightful quotes
Get Available Categories
GET /api/typesResponse:
{
"availableTypes": ["happy", "sad", "love", "motivational", "wisdom"],
"total": 5
}Get Statistics
GET /api/statsResponse:
{
"message": "Quote statistics by category",
"counts": {
"happy": 25,
"sad": 20,
"love": 30,
"motivational": 35,
"wisdom": 15,
"total": 125
}
}🛡️ Security
Quotify API includes multiple layers of security protections:
XSS Protection
All dynamic content rendered in the documentation site and admin dashboard is sanitized through a global escapeHTML function. This prevents cross-site scripting attacks from malicious data in API responses, user names, or error messages.
Standardized Error Responses
All API endpoints return a consistent error format, making it easy to handle errors programmatically:
{
"success": false,
"error": "Validation error",
"message": "All fields are required"
}In production mode, internal server errors (500) are masked to prevent information leakage:
{
"error": "Error",
"message": "Something went wrong on the server"
}In development mode, full error details including stack traces are returned for debugging.
Additional Protections
- 🔒 Helmet - Security headers (CSP, HSTS, X-Frame-Options, etc.)
- 🔑 JWT Authentication - Secure token-based API access
- 🛡️ Rate Limiting - Protection against abuse and DDoS
- 🔐 Payment Signature Verification - Razorpay HMAC validation
- 🚫 Input Validation - All user inputs are validated before processing
🛡️ Rate Limits
To ensure fair usage and protect against abuse, the following rate limits are enforced:
- General Requests: 1,000 requests per 15 minutes
- API Endpoints: 500 requests per 15 minutes
- Strict Limit: 50 requests per minute (additional protection)
Rate Limit Headers
The API includes rate limit information in response headers:
RateLimit-Limit- Maximum requests per windowRateLimit-Remaining- Remaining requests in current windowRateLimit-Reset- Time when the rate limit resets
🏗️ Installation & Setup
Option 1: Use as NPM Package (Recommended)
npm install quote-apiOption 2: Self-Hosted
# Clone the repository
git clone https://github.com/tanishq-sa/Quotifyapi
cd quotifyapi
# Install dependencies
npm install
# Start the server
npm start
# For development with auto-reload
npm run devThe API will be available at https://quotify.dazzelr.tech
📚 Documentation Website
A beautiful, interactive documentation website is included and automatically served at the root URL when you run the server. Features include:
- 📖 Comprehensive API documentation
- 🧪 Interactive API tester
- 💻 Code examples in multiple languages
- 📱 Responsive design
- 🎨 Modern dark theme
- ⌨️ Keyboard shortcuts
Visit https://quotify.dazzelr.tech to explore the documentation.
🔧 Configuration
Environment Variables
PORT=3000 # Server port (default: 3000)
NODE_ENV=production # Environment modeCustomization
You can easily add your own quotes by editing the files in the quotes/ directory:
// quotes/custom.js
module.exports = [
{
text: "Your custom quote here",
author: "Your Name"
}
// ... more quotes
];Then update quotes.js to include your new category.
🚀 Deployment
Vercel (Recommended)
The project includes vercel.json for easy deployment to Vercel:
npm install -g vercel
vercelOther Platforms
The API works on any Node.js hosting platform:
- Heroku
- Railway
- DigitalOcean App Platform
- AWS Lambda (with serverless framework)
📦 Package Structure
quotifyapi/
├── server.js # Express server with global error handler
├── quotes.js # Quote management functions
├── auth.js # Authentication & passport config
├── database-adapter.js # Database abstraction layer
├── cli.js # Command-line interface
├── config/
│ └── plan-limits.js # Rate limit plans
├── routes/ # API route modules
│ ├── admin.js # Admin management endpoints
│ ├── auth.js # OAuth & login endpoints
│ ├── contact.js # Contact form handler
│ ├── payments.js # Razorpay payment routes
│ ├── quotes.js # Quote API endpoints
│ └── user.js # User profile endpoints
├── quotes/ # Quote data files
│ ├── happy.js
│ ├── sad.js
│ ├── love.js
│ ├── motivational.js
│ └── wisdom.js
├── public/ # Documentation website
│ ├── index.html
│ ├── admin.html # Admin dashboard (XSS-safe)
│ └── script.js # Frontend with escapeHTML protection
├── package.json
├── README.md
├── DEPLOYMENT.md
├── SECURE_ENV_GUIDE.md
├── RAZORPAY_SETUP.md
├── EMAIL_SETUP.md
└── vercel.json🤝 Contributing
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Adding Quotes
To add new quotes:
- Add your quotes to the appropriate category file in
quotes/ - Follow the existing format:
{ text: "Quote text", author: "Author name" } - Submit a pull request
Adding Categories
To add new quote categories:
- Create a new file in
quotes/(e.g.,quotes/philosophy.js) - Update
quotes.jsto include your new category - Submit a pull request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- Express.js - Web framework
- Inter Font - Beautiful typography
- Prism.js - Syntax highlighting
- Community - For inspiration and feedback
📞 Support
- 🐛 Issues: GitHub Issues
- 📖 Documentation: API Docs
- 💬 Discussions: GitHub Discussions
🌟 Star History
Made with ❤️ by Tanishq Saini
If this project helps you, please give it a ⭐️!
