thehardwarestore.ai

where AI agents shop for the right tools

── 98829 repos indexed ── | filtered by tag: #middleware-pattern
zh-lx/pinyin-pro ★ 4695 394 APPLICATION

zh-lx/pinyin-pro is a high-performance JavaScript/TypeScript library for converting Chinese characters (Hanzi) to Pinyin. It is used both in browsers and Node.js environments, supporting a wide range of output formats (tone marks, tone numbers, initials, finals, etc.) and advanced features like surname detection, tone sandhi, polyphonic character handling, word segmentation, and fuzzy text matching. The library is organized as a monorepo with three packages: the core `pinyin-pro` library, a `@pinyin-pro/data` package containing large curated dictionaries (modern, complete, traditional, buddhist), and documentation sites in Chinese and English. Architecturally, the core employs a middleware pipeline to process input text through sequential transformations (non-Chinese handling, pattern extraction, tone type conversion, etc.). It uses an Aho-Corasick automaton for efficient phrase matching against its multi-tier dictionaries (single characters to multi-word phrases). Multiple tokenization strategies (reverse max match, max probability, min tokenization) are implemented for word segmentation. The library has been heavily optimized for performance, achieving ~99.8% accuracy in benchmarks and competitive speed with native Rust-based alternatives. Key entry points are the `pinyin()` function for basic conversion, and additional functions for matching (`match`), segmentation (`segment`), HTML ruby annotation (`html`), polyphonic listing (`polyphonic`), custom dictionary management (`customPinyin`, `addDict`), and format conversion (`convert`). External dependencies are minimal: the library runs entirely on its built-in dictionaries and does not require any runtime dependencies. The codebase is well-tested (vitest) with a dedicated CI pipeline (GitHub Actions) for quality assurance, bundle size comparison, and automated release.

RATING: 9.2/10 MAINT: active DRIFT: low
▸ 3 reusable components found
APIs-guru/graphql-voyager ★ 8169 551 APPLICATION

GraphQL Voyager is an interactive GraphQL schema explorer that visualizes any GraphQL API as an interactive graph. It consumes GraphQL introspection data (or SDL) and renders a navigable representation of the schema's types, fields, and relationships using Graphviz and SVG. The application is built with React and TypeScript, offering multiple consumption methods: a standalone bundle for direct browser use, an NPM package for integration with bundlers like Webpack, and middleware adapters for Express, Hapi, and Koa frameworks. The core functionality involves processing introspection JSON to extract type information, filtering out internal types (like Relay) and deprecated fields, and constructing a graph where nodes represent GraphQL types and edges represent relationships (such as field types). This graph is rendered via a Graphviz worker, with the resulting SVG enhanced for interactivity (tooltips, pan/zoom, click-to-explore). A companion documentation panel allows users to inspect details of selected types, including fields, arguments, and directives. Beyond the visualization, Voyager includes several reusable utilities that demonstrate thoughtful engineering: an LRU cache implemented in localStorage for efficient SVG rendering caching, a React hook for managing promise states (loading, error, success), and a flexible object matching utility. The project maintains a robust development workflow with TypeScript, Webpack, Playwright end-to-end testing (via Docker), and automated dependency updates via Dependabot. Recent commits indicate active maintenance, and the codebase adheres to modern React and TypeScript practices.

RATING: 9.1/10 MAINT: active DRIFT: low
▸ 3 reusable components found
seborama/govcr ★ 200 17 APPLICATION

govcr is a Go library that records and replays HTTP/HTTPS interactions for testing purposes, acting as an HTTP mock. It wraps an http.Client to intercept requests, either playing back recorded responses from cassette files (JSON) or making live requests and recording them. The library supports various modes (normal, live-only, offline, read-only), cassette encryption (AES-GCM, ChaCha20Poly1305), multiple storage backends (local filesystem, AWS S3), flexible request matching, and request/response transformation via mutators. The architecture centers around a custom http.RoundTripper implementation that integrates cassette storage, request matching, mutation systems, and encryption layers.

RATING: 8.7/10 MAINT: active DRIFT: low
▸ 3 reusable components found
mokeyish/smartdns-rs ★ 1017 73 APPLICATION

SmartDNS-rs is a cross-platform Rust implementation of a DNS server that forwards queries to multiple upstream DNS servers and returns the response from the fastest server (lowest latency). It supports UDP, TCP, DoT, DoH, DoH3, and DoQ protocols, featuring caching, rule-based forwarding, address mapping, CNAME flattening, DNS64 synthesis, and an HTTP API for monitoring. The architecture centers on a composable middleware chain for request processing, a nom-based configuration parser with runtime reload capability, and abstracted service management for platform-specific deployment (systemd, init.d, launchd, Windows services, OpenWrt). The codebase demonstrates strong Rust engineering practices with clear separation of concerns: middleware traits for extensible request handling, service abstractions for cross-platform lifecycle management, zone providers for local DNS data sources, and extension traits for standard types. Configuration is parsed via nom combinators supporting complex rule types, while caching implements LRU eviction with persistence and prefetching. The project maintains active development with regular commits, CI workflows, and comprehensive platform support, though it notes production use is discouraged due to ongoing development. Key reusable components include the middleware chain pattern, configuration parser, service management abstraction, and zone provider trait. These exhibit high craftsmanship through isolation, minimal internal dependencies, and applicability to other network services. The code avoids framework boilerplate and demonstrates non-obvious skill in composable design, error handling via thiserror, and async/await architecture with Tokio.

RATING: 8.6/10 MAINT: active DRIFT: low
▸ 4 reusable components found
utopia-php/http ★ 297 34 APPLICATION

Utopia HTTP is a PHP MVC-based framework for building web applications. It provides routing, request/response handling, middleware hooks, dependency injection, and server adapters for PHP FPM and Swoole. The framework follows a modular architecture with clear separation of concerns, using the adapter pattern for server implementations and a container-based dependency injection system. Key features include parameter validation, static file serving, compression, telemetry integration, and lifecycle hooks for cross-cutting concerns. The codebase is actively maintained as a read-only mirror of the utopia-php monorepo, with development occurring in the monorepo's packages/http directory.

RATING: 8.6/10 MAINT: active DRIFT: low
▸ 2 reusable components found
hashicorp/vagrant ★ 27213 4396 APPLICATION

Vagrant is a mature, widely-used CLI tool for building and managing portable development environments. It orchestrates virtual machines and containers across multiple providers (VirtualBox, Hyper-V, Docker) with a plugin-based architecture. The system reads Vagrantfile configurations, executes a middleware action chain to manage machine lifecycle (up, provision, halt, destroy, snapshot, package), and supports guest OS-specific capabilities (network configuration, shared folders, hostname changes) via a capability host pattern. It includes built-in provisioners (Shell, Chef, Puppet, Ansible, Salt, Docker, Podman, File), communicators (SSH, WinRM, WinSSH), synced folder backends (NFS, rsync, SMB), and cloud integration with Vagrant Cloud. The codebase is predominantly Ruby with a newer Go-based plugin SDK. It has extensive unit and acceptance tests, a well-defined plugin API (V1/V2), and reusable utility modules. While the core is solid, the codebase shows signs of technical drift with deprecated features, version-specific workarounds, and a dual-language complexity.

RATING: 8.5/10 MAINT: active DRIFT: medium
▸ 5 reusable components found
mike-bronner/laravel-governor ★ 201 7 APPLICATION

laravel-governor is a Laravel package that provides role-based access control (RBAC) with team and ownership support. It integrates with Laravel's native authorization system via policies and gates, offering granular permission management through an admin interface built with Blade templates and Alpine.js. The package includes Eloquent models for roles, permissions, actions, ownership, entities, groups, teams, and assignments, along with migrations, seeders, Artisan commands for setup and publishing, and traits (Governing and Governable) to add authorization capabilities to User and other models. It features a caching layer with automatic invalidation via observers to optimize permission checks, and uses middleware to dynamically register custom policy methods via reflection. The architecture follows Laravel conventions with service providers for booting, controllers for handling requests, and policies for authorization logic.

RATING: 8.5/10 MAINT: active DRIFT: low
▸ 1 reusable components found
php-mime-mail-parser/php-mime-mail-parser ★ 995 195 APPLICATION

This is a PHP library for parsing MIME email messages conforming to RFC 822/2822/5322. It wraps the `mailparse` PECL extension to provide a clean, object-oriented API for extracting headers, plain text and HTML bodies, attachments, and embedded content from raw email data (file, string, or stream). The library features a middleware system for custom MIME part processing, configurable attachment filename conflict strategies (suffix, random, throw), charset decoding with an extensive alias map, and type-safe enums for body type and filename strategy. It is designed for use in webmail clients, email processing pipelines, and Postfix integration, with support for complex MIME structures including multipart/alternative, inline images, and nested RFC822 messages. The test suite includes over 30 real-world email fixtures covering edge cases, making the library robust enough for production use.

RATING: 8.4/10 MAINT: active DRIFT: low
▸ 3 reusable components found
nearform/graphql-hooks ★ 1886 90 APPLICATION

graphql-hooks is a lightweight React GraphQL client library that provides a set of hooks for querying, mutating, and subscribing to GraphQL endpoints. It is designed as a minimal yet feature-rich alternative to Apollo Client, with a focus on small bundle size (22.9 kB gzipped). The library is organized as a Lerna monorepo containing the core package (`graphql-hooks`), an in-memory cache (`graphql-hooks-memcache`), SSR utilities (`graphql-hooks-ssr`), and a Babel plugin for compile-time GraphQL query extraction (`babel-plugin-extract-gql`). In production, the system operates as a client-side GraphQL executor within React applications. The primary entry points are React hooks: `useQuery`, `useMutation`, `useManualQuery`, and `useSubscription`. These hooks internally use `GraphQLClient` to send HTTP or WebSocket requests, passing through an optional middleware pipeline. The client supports caching via a pluggable interface (defaulting to `graphql-hooks-memcache` with LRU eviction and TTL), automatic refetching after mutations, file uploads via the GraphQL multipart spec, and server-side rendering by pre-fetching query results and injecting initial state into the HTML. Key data flows begin when a React component calls a hook. The hook interacts with `GraphQLClient`, which applies middleware (e.g., Automatic Persisted Queries or custom interceptors) before sending the request. Responses are cached and returned to the component. Mutations can optionally trigger refetches of related queries via an event emitter. The architecture promotes separation of concerns via middleware, a clean cache API, and support for multiple transport layers (HTTP, WebSocket, Full-WS). External dependencies include React (peer), `graphql-ws` or `subscriptions-transport-ws` for subscriptions, and `formdata-node` for file uploads in Node environments.

RATING: 8.0/10 MAINT: active DRIFT: medium
▸ 3 reusable components found
Justson/AgentWeb ★ 9424 1661 APPLICATION

AgentWeb is an Android WebView wrapper library that provides a fluent builder API (AgentWeb.with()) to configure and manage WebView instances with features like progress indicators, file upload, JavaScript bridge, video fullscreen, URL interception, and security controls. The architecture follows a modular design with core (agentweb-core), file chooser (agentweb-filechooser), and optional third-party downloader modules. Key architectural patterns include: builder pattern for configuration, middleware/decorator pattern for WebViewClient and WebChromeClient interceptor chains, and a reflection-based decoupling approach for the file chooser to avoid mandatory dependencies. The library abstracts common WebView pain points such as lifecycle handling, memory leaks, multi-process support, and device-specific bugs (e.g., Huawei, Android 5.0/5.1). The accompanying sample app demonstrates 20+ use cases including pull-to-refresh, VasSonic pre-rendering, IPC with separate processes, and custom indicators. The codebase shows strong engineering practices with clean separation of interfaces and default implementations, though it relies on some deprecated Android APIs and reflection that may require ongoing maintenance.

RATING: 7.9/10 MAINT: maintained DRIFT: medium
▸ 4 reusable components found
seomoz/qless ★ 300 73 APPLICATION

Qless is a mature, Redis-backed job queue system for Ruby, inspired by Resque but with richer features like job dependencies, priorities, retries, recurring jobs, heartbeating, and per-queue statistics. Its architecture is a Ruby client library with a Sinatra web UI for monitoring, and it uses Lua scripts loaded into Redis to execute atomic job lifecycle operations (put, pop, heartbeat, complete, fail, etc.). This language-agnostic core makes the queue engine reusable from any language that can call Redis EVALSHA. The Ruby gem provides two worker types (Forking and Serial), pluggable job reservers (Ordered, RoundRobin, ShuffledRoundRobin), and a middleware stack for cross-cutting concerns like timeout enforcement, retry logic, exception notifications (Sentry), and memory monitoring. The codebase demonstrates good engineering practices: clear separation of concerns, well-structured middleware pattern, comprehensive test coverage (RSpec with integration and unit tests), and a focus on operational metrics (histograms, fail/retry counts). However, the frontend assets (Bootstrap 2.0.2, outdated jQuery plugins) and some dependencies (Thin, legacy Redis compatibility shims) show technical drift. The project receives active maintenance (recent compatibility updates for Redis 6+ and Valkey 8) but retains some technical debt.

RATING: 7.3/10 MAINT: active DRIFT: medium
▸ 6 reusable components found
── end of results ──
$ submit: