Skip to main content

CouchDB OpenAPI scheme generator

Project description

๐Ÿš€ CouchDB OpenAPI Scheme Generator

OpenAPI specification generator for CouchDB - Perfect for developing and debugging applications using CouchDB as a backend

GitHub stars GitHub forks GitHub watchers GitHub issues GitHub pull requests

License Python Version PyPI version PyPI downloads Docker OpenAPI

GitHub repo size GitHub code size in bytes GitHub last commit GitHub contributors

Views Visitor Badge


๐Ÿ“‹ Table of Contents


โœจ Features

Feature Description Status
๐Ÿณ Docker Support Quick CouchDB deployment with Docker Compose โœ… Ready
๐Ÿ“„ OpenAPI 3.0 Modern OpenAPI specification generator โœ… Ready
๐Ÿ”ง CLI Tool Easy-to-use command-line interface โœ… Ready
๐Ÿ“Š JSON/YAML Support for both JSON and YAML output formats โœ… Ready
๐Ÿ” Authentication Optional authentication support (most endpoints are public) โœ… Ready
โšก Fast Setup Get started in minutes โœ… Ready
๐Ÿ“š Comprehensive API Coverage Full coverage of CouchDB API endpoints according to official documentation โœ… Ready
๐ŸŽฏ Server Endpoints Complete server management endpoints (tasks, cluster, nodes, etc.) โœ… Ready
๐Ÿ—„๏ธ Database Operations Full database management (shards, security, compaction, etc.) โœ… Ready
๐Ÿ“ Design Documents Complete design document endpoints (views, search, show, list, update) โœ… Ready
๐Ÿ”€ Partitioned Databases Support for partitioned database operations โœ… Ready
๐Ÿ“‹ Local Documents Support for local (non-replicating) documents โœ… Ready

๐ŸŽฏ Description

This project has been updated for more convenient work with CouchDB and includes:

  • ๐Ÿณ Updated Docker Compose configuration for quick CouchDB deployment
  • ๐Ÿ“„ Modern OpenAPI specification generator for CouchDB API
  • ๐Ÿ› ๏ธ Utilities and tools for interacting with the CouchDB server
  • ๐Ÿš€ Production-ready setup with best practices
  • ๐Ÿ“š Comprehensive API coverage - The OpenAPI specification includes all major CouchDB API endpoints according to the official CouchDB documentation

๐Ÿ“‹ Supported API Endpoints

The generated OpenAPI specification includes comprehensive coverage of CouchDB API:

  • Server Endpoints (18+ endpoints): Server information, active tasks, cluster setup, database updates, membership, scheduler, node management, statistics, Prometheus metrics, UUID generation, resharding, and more
  • Database Endpoints (20+ endpoints): Database operations, design documents, bulk operations, indexes, shards, compaction, security, purging, revision management, and more
  • Document Endpoints: Full CRUD operations for documents and attachments
  • Design Document Endpoints (12+ endpoints): Views, search indexes, nouveau indexes, show/list/update functions, URL rewriting, and more
  • Partitioned Database Endpoints (5 endpoints): Partition information, queries, and views
  • Local Documents Endpoints (3 endpoints): Local document operations (non-replicating)
  • User Endpoints: User management in the _users database

๐Ÿ“ฆ Requirements

  • ๐Ÿ Python 3.11 or higher
  • ๐Ÿ“ฆ Package manager (optional): pip, uv, pipx, or uvx

๐Ÿš€ Quick Start

Option 1: Using uvx (Recommended - No Installation Required)

# Generate OpenAPI specification directly without installation
uvx couchdb-openapi-scheme-generator

That's it! ๐ŸŽ‰ Your OpenAPI specification will be generated in couchdb-openapi.json

Option 2: Install from PyPI

# Install using pip
pip install couchdb-openapi-scheme-generator

# Or using uv
uv pip install couchdb-openapi-scheme-generator

# Or using pipx (for isolated installation)
pipx install couchdb-openapi-scheme-generator

# Then run
couchdb-openapi-scheme-generator

Option 3: Development Setup

# 1. Clone the repository
git clone https://github.com/SasukeSagara/CouchDB-OpenAPI-scheme-generator.git
cd couchdb-openapi-scheme-generator

# 2. Install dependencies
uv sync

# 3. Run the generator
uv run openapi_generator.py

๐Ÿ’ป Installation

๐Ÿ“ฆ Install from PyPI

The package is available on PyPI. You can install it using any Python package manager:

Using pip

pip install couchdb-openapi-scheme-generator

Using uv

uv pip install couchdb-openapi-scheme-generator

Using pipx (Isolated Installation)

pipx install couchdb-openapi-scheme-generator

๐Ÿš€ Using uvx (No Installation Required)

You can use the package directly without installation using uvx:

uvx couchdb-openapi-scheme-generator

This will automatically download and run the latest version from PyPI.

๐Ÿ”ง Development Installation

If you want to contribute or modify the code:

# 1. Clone the repository
git clone https://github.com/SasukeSagara/CouchDB-OpenAPI-scheme-generator.git
cd couchdb-openapi-scheme-generator

# 2. Install dependencies using uv
uv sync

# For development dependencies
uv sync --dev

๐Ÿ“– Usage

๐Ÿณ Starting CouchDB

Start CouchDB using Docker Compose:

docker-compose up -d

CouchDB will be available at http://localhost:5984

โš ๏ธ Important: Change the password in .env before using in production!

๐Ÿ“„ Generating OpenAPI Specification

Generate the OpenAPI specification for CouchDB API using one of the following methods:

Method 1: Using uvx (Recommended)

# Basic usage (local server, no authentication required)
uvx couchdb-openapi-scheme-generator

# With URL specified (authentication optional)
uvx couchdb-openapi-scheme-generator \
  --url http://localhost:5984

# With URL and credentials (only if server requires authentication)
uvx couchdb-openapi-scheme-generator \
  --url http://localhost:5984 \
  --username admin \
  --password your_password

# With custom output file
uvx couchdb-openapi-scheme-generator --output couchdb-api.json

# Generate in YAML format
uvx couchdb-openapi-scheme-generator \
  --format yaml \
  --output couchdb-api.yaml

Method 2: Using Installed Package

If you installed the package using pip, uv, or pipx:

# Basic usage (no authentication required for most servers)
couchdb-openapi-scheme-generator

# With URL only
couchdb-openapi-scheme-generator --url http://localhost:5984

# With all options (authentication only if required)
couchdb-openapi-scheme-generator \
  --url http://localhost:5984 \
  --username admin \
  --password your_password \
  --format json \
  --output my-couchdb-api.json

Method 3: Development Mode

If you cloned the repository and installed dependencies:

# Using uv run
uv run openapi_generator.py

# Or directly with Python
python openapi_generator.py

๐Ÿ“‹ Parameters

Parameter Short Description Default
--url -u CouchDB server URL http://localhost:5984
--username - Username for authentication (optional) -
--password - Password for authentication (optional) -
--output -o Output file name couchdb-openapi.json
--format -f Output format (json or yaml) json

๐Ÿ’ก Note: Authentication is optional for most operations. The generator first attempts to connect without authentication, as most CouchDB endpoints (including server info) are publicly accessible. If your server requires authentication, you can provide credentials using --username and --password parameters.

๐Ÿ“š Generated Specification

The generated OpenAPI specification includes:

  • โœ… 60+ API endpoints covering all major CouchDB operations
  • โœ… Complete request/response schemas for all endpoints
  • โœ… Query parameters and path parameters properly documented
  • โœ… Authentication support via Basic Auth (optional - most endpoints are public)
  • โœ… Error responses with appropriate HTTP status codes
  • โœ… Compatible with Swagger UI, Postman, Insomnia, and other OpenAPI tools

๐Ÿ“ Important: Most of the information in the OpenAPI specification is statically defined and does not require a connection to the CouchDB server. The generator only queries the server to retrieve the CouchDB version for inclusion in the specification metadata. If the server is not accessible or requires authentication, you can still generate a complete specification (version will be set to "unknown").

The specification is based on the official CouchDB API documentation and includes endpoints for:

  • Server management and monitoring
  • Database operations and administration
  • Document CRUD operations
  • Design documents and views
  • Search and indexing
  • Partitioned databases
  • Local documents
  • User management

๐ŸŽฎ Running the Application

After installation, you can run the generator using:

# If installed via pip/pipx/uv
couchdb-openapi-scheme-generator

# Or using uvx (no installation needed)
uvx couchdb-openapi-scheme-generator

# Or in development mode
uv run openapi_generator.py

๐Ÿ—๏ธ Project Structure

CouchDB-OpenAPI-scheme-generator/
โ”œโ”€โ”€ ๐Ÿ“ couchdb-data/          # CouchDB data (Docker volume)
โ”œโ”€โ”€ ๐Ÿ“ couchdb-etc/           # CouchDB configuration
โ”œโ”€โ”€ ๐Ÿ“„ docker-compose.yml     # Docker Compose configuration
โ”œโ”€โ”€ ๐Ÿ“„ main.py                # Main application file
โ”œโ”€โ”€ ๐Ÿ“„ openapi_generator.py   # OpenAPI specification generator
โ”œโ”€โ”€ ๐Ÿ“„ pyproject.toml         # Python project configuration
โ”œโ”€โ”€ ๐Ÿ“„ uv.lock                # Dependency lock file
โ”œโ”€โ”€ ๐Ÿ“„ .env                   # Environment variables (create this)
โ”œโ”€โ”€ ๐Ÿ“„ .gitignore             # Git ignore rules
โ”œโ”€โ”€ ๐Ÿ“„ LICENSE                # MIT License
โ””โ”€โ”€ ๐Ÿ“„ README.md              # This file

๐Ÿ› ๏ธ Development

Setting Up Development Environment

  1. Clone the repository:

    git clone https://github.com/SasukeSagara/CouchDB-OpenAPI-scheme-generator.git
    cd couchdb-openapi-scheme-generator
    
  2. Install development dependencies:

    uv sync --dev
    
  3. Create .env file:

    cp .env.example .env  # If you have an example file
    # Or create manually with:
    # COUCHDB_USER=admin
    # COUCHDB_PASSWORD=your_secure_password
    
  4. Start CouchDB:

    docker-compose up -d
    
  5. Run tests (if available):

    uv run pytest
    

Code Style

This project follows PEP 8 style guidelines. Consider using:

  • black for code formatting
  • flake8 or ruff for linting
  • mypy for type checking

๐Ÿค Contributing

Contributions are welcome! ๐ŸŽ‰

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

Contribution Guidelines

  • ๐Ÿ“ Follow the existing code style
  • โœ… Add tests for new features
  • ๐Ÿ“– Update documentation as needed
  • ๐Ÿ› Report bugs using GitHub Issues
  • ๐Ÿ’ก Suggest enhancements using GitHub Discussions

๐Ÿ“ License

This project is distributed under the MIT License. See the LICENSE file for details.

License: MIT


โญ Show Your Support

If you find this project helpful, please consider:

  • โญ Starring this repository
  • ๐Ÿด Forking this repository
  • ๐Ÿ› Reporting bugs
  • ๐Ÿ’ก Suggesting new features
  • ๐Ÿ“– Improving documentation
  • ๐Ÿค Contributing code

Made with โค๏ธ by SasukeSagara

GitHub Open Source

โญ Star this repo if you find it useful! โญ

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

couchdb_openapi_scheme_generator-1.2.0.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file couchdb_openapi_scheme_generator-1.2.0.tar.gz.

File metadata

File hashes

Hashes for couchdb_openapi_scheme_generator-1.2.0.tar.gz
Algorithm Hash digest
SHA256 ce7811750523288ebca80458571bda2ba0b48af347d0113c4fe852cc7383d69f
MD5 c8b27aac600ef8a111296433e9263093
BLAKE2b-256 1b8b3741a7f8a23247d3ddbe862980a9b089a5c5b98b8a75c53863b43a0a82f6

See more details on using hashes here.

File details

Details for the file couchdb_openapi_scheme_generator-1.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for couchdb_openapi_scheme_generator-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3ba45c640668908cb069d4e807e1db8facbaf3607f7f708de810f927a689901c
MD5 c8bd9b959c5bf0038c9e81fdbd091fad
BLAKE2b-256 14873355561b0a7e1109528eec87203e5790c0805ec0d2f03c08a6f3e8b81de4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page