npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pgdoc-cli

v1.0.3

Published

Beautiful HTML documentation generator for PostgreSQL commands

Readme

🐘 pgdoc - PostgreSQL Documentation Generator

A beautiful, modern CLI tool that generates interactive HTML documentation for PostgreSQL commands with a sleek dark theme.

License Node PostgreSQL

✨ Features

  • 🎨 Beautiful Dark Theme - Modern UI with Tailwind CSS dark mode
  • 📋 One-Click Copy - Copy any command example with a single click
  • 🔍 Comprehensive Coverage - 120+ PostgreSQL commands with real-world examples
  • 📱 Responsive Design - Works perfectly on desktop, tablet, and mobile
  • 🚀 Fast & Lightweight - Pure Node.js, no dependencies needed
  • 💡 Beginner Friendly - Clear descriptions and copy-paste ready examples

📸 Screenshots

Help Interal Advanced

📦 Installation

Global Installation (Recommended)

npm install -g pgdoc-cli
# Clone the repository
git clone https://github.com/mchinnappan100/pgdoc-cli.git
cd pgdoc-cli

# Make executable
chmod +x pgdoc.js

# Install globally
npm link

# Now use it anywhere!
pgdoc --help

Local Installation

# Clone the repository
git clone https://github.com/mchinnappan100/pgdoc-cli.git
cd pgdoc-cli

# Make executable
chmod +x pgdoc.js

# Run with node
node pgdoc.js --help

🚀 Quick Start

# Generate psql command line reference
pgdoc psql-help

# Generate internal psql commands reference
pgdoc psql-internal

# Generate advanced topics documentation
pgdoc advanced-topics

# Save to a specific file
pgdoc psql-internal -o postgres-reference.html

📚 Documentation Topics

1. psql-help - Command Line Options

Learn about all the command-line options available when launching psql:

  • Connection options (-h, -p, -U, -d)
  • Output format options (--csv, -H, -x)
  • General options (-c, -f, -l)
pgdoc psql-help

2. psql-internal - Interactive Shell Commands

Comprehensive guide to commands available inside the psql shell:

Database Operations

  • Creating, dropping, and altering databases
  • Connecting to databases
  • Listing databases

Schema & Tables

  • Table creation and modification
  • Column operations
  • Viewing table structures

User Management

  • Creating users and roles
  • Granting and revoking permissions
  • Managing user privileges

Indexing

  • Creating various types of indexes (B-tree, GIN, partial, expression)
  • Index maintenance and monitoring
  • Performance optimization

Extensions

  • Installing popular extensions (uuid-ossp, pg_trgm, PostGIS, hstore)
  • Managing extensions
  • Extension usage examples

Advanced Features

  • Foreign Keys & Constraints - Referential integrity
  • Views & Materialized Views - Data abstraction layers
  • Functions & Stored Procedures - PL/pgSQL programming
  • Triggers - Automatic actions on data changes
  • Sequences - Auto-incrementing values
  • Full-Text Search - Advanced text searching capabilities
  • JSON & JSONB - Working with JSON data
  • Arrays - Array data types and operations
  • Partitioning - Table partitioning strategies
  • CTEs - Common Table Expressions and recursive queries
  • Window Functions - Advanced analytical queries

Backup & Restore

  • pg_dump usage and options
  • pg_restore techniques
  • Database migration strategies

Monitoring & Maintenance

  • Performance monitoring
  • Table and index statistics
  • Connection management
  • Query optimization
pgdoc psql-internal

3. advanced-topics - Expert Level Features

Deep dive into advanced PostgreSQL capabilities:

  • Replication and high availability
  • Security and row-level policies
  • Performance tuning and optimization
  • Connection pooling and statistics
pgdoc advanced-topics

🎯 Usage Examples

Basic Usage

# Generate and open in browser
pgdoc psql-help

# Save to custom file
pgdoc psql-internal -o my-postgres-guide.html

# Generate all documentation
pgdoc psql-help -o psql-cli.html
pgdoc psql-internal -o psql-commands.html
pgdoc advanced-topics -o psql-advanced.html

Real-World Scenarios

For Beginners

# Start with command line basics
pgdoc psql-help

# Then learn internal commands
pgdoc psql-internal

For Developers

# Quick reference for daily work
pgdoc psql-internal -o quick-ref.html

# Keep it open in browser for easy access

For DBAs

# Complete reference guide
pgdoc psql-internal -o dba-guide.html
pgdoc advanced-topics -o performance-guide.html

📖 Command Categories

The documentation covers 15+ major categories with 120+ commands:

  1. ✅ Database Operations
  2. ✅ Schema & Table Management
  3. ✅ User & Permission Control
  4. ✅ Index Management
  5. ✅ Extensions
  6. ✅ Backup & Restore
  7. ✅ Foreign Keys & Constraints
  8. ✅ Views & Materialized Views
  9. ✅ Functions & Stored Procedures
  10. ✅ Triggers
  11. ✅ Sequences
  12. ✅ Full-Text Search
  13. ✅ JSON/JSONB Operations
  14. ✅ Array Operations
  15. ✅ Table Partitioning
  16. ✅ CTEs & Recursive Queries
  17. ✅ Window Functions
  18. ✅ Advanced Queries
  19. ✅ Database Maintenance
  20. ✅ Monitoring & Statistics
  21. ✅ Import & Export
  22. ✅ Replication & HA
  23. ✅ Security & RLS
  24. ✅ Performance Tuning

🎨 Features Showcase

Interactive Code Examples

Every command includes a copy button that:

  • ✨ Provides instant visual feedback
  • 📋 Copies to clipboard with one click
  • ✅ Shows "Copied!" confirmation
  • 🎯 Handles complex multi-line SQL perfectly

Beautiful Dark Theme

  • 🌙 Easy on the eyes for long reading sessions
  • 💎 Modern glassmorphism effects
  • 🎨 Syntax-highlighted code blocks
  • 📐 Clean, organized layout

Responsive Design

  • 💻 Perfect on desktop monitors
  • 📱 Optimized for mobile devices
  • 🖥️ Great on tablets
  • 🔄 Adapts to any screen size

🛠️ Development

Project Structure

pgdoc-cli/
├── pgdoc.js           # Main CLI script
├── package.json       # Package configuration
├── README.md          # This file

Adding New Commands

Edit pgdoc.js and add commands to the appropriate section:

{
  name: 'Your Section',
  commands: [
    { 
      cmd: 'COMMAND NAME', 
      desc: 'Description', 
      example: 'SQL example here' 
    }
  ]
}

Customizing the Theme

The HTML template uses Tailwind CSS. Modify the color scheme in the generateHTML() function:

// Change primary color from blue to purple
text-blue-400 → text-purple-400
bg-blue-500 → bg-purple-500

📋 Requirements

  • Node.js >= 12.0.0
  • No external dependencies required!
  • Works on macOS, Linux, and Windows

🤝 Contributing

Contributions are welcome! Here's how you can help:

  1. 🍴 Fork the repository
  2. 🌿 Create a feature branch (git checkout -b feature/amazing-feature)
  3. ✍️ Commit your changes (git commit -m 'Add some amazing feature')
  4. 📤 Push to the branch (git push origin feature/amazing-feature)
  5. 🎉 Open a Pull Request

Ideas for Contributions

  • Add more PostgreSQL commands
  • Add search functionality
  • Add command categorization filters
  • Add bookmarking feature
  • Add dark/light theme toggle
  • Add export to PDF
  • Add internationalization (i18n)

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Built with ❤️ for the PostgreSQL community
  • Styled with Tailwind CSS
  • Inspired by the need for better PostgreSQL documentation tools

📞 Support

🔗 Useful Links

⭐ Star History

If you find this tool helpful, please consider giving it a star on GitHub!


Made with 🐘 and ☕ by PostgreSQL enthusiasts

Command Line Options

psql-help screenshot

Internal Commands

psql-internal screenshot

Advanced Topics

advanced-topics screenshot

🎓 Learning Path

Recommended order for learning PostgreSQL with pgdoc:

  1. Beginner → Start with pgdoc psql-help

    • Learn command-line options
    • Understand connection parameters
  2. Intermediate → Move to pgdoc psql-internal

    • Master database operations
    • Learn table and index management
    • Practice backup and restore
  3. Advanced → Explore pgdoc advanced-topics

    • Study replication strategies
    • Optimize performance
    • Implement security best practices

💡 Tips & Tricks

  • Quick Reference: Keep the HTML file open in a browser tab for instant access
  • Offline Use: Generated HTML files work completely offline
  • Team Sharing: Share generated HTML files with your team
  • Custom Builds: Modify the tool to include your organization's specific commands
  • CI/CD: Generate documentation as part of your deployment process

🔄 Changelog

Version 1.0.0 (Current)

  • ✨ Initial release
  • 📚 120+ PostgreSQL commands
  • 🎨 Beautiful dark theme
  • 📋 One-click copy functionality
  • 📱 Fully responsive design

Happy PostgreSQL querying! 🐘✨