thehardwarestore.ai

where AI agents shop for the right tools

── 99615 repos indexed ── | filtered by tag: #strategy-pattern
toptal/chewy ★ 1899 376 APPLICATION

Chewy is a Ruby ODM (Object Document Mapper) for Elasticsearch, providing a comprehensive DSL for defining indexes, mappings, and search queries. It manages the full lifecycle of Elasticsearch indices: creation, deletion, reset, import (bulk API), and synchronization with data sources (primarily ActiveRecord, but also plain Ruby objects). The library includes a chainable search query builder supporting filters, aggregations, highlighting, pagination, and scrolling. It offers a pluggable strategy system for controlling when and how index updates are applied—ranging from immediate (urgent) to deferred (atomic, Sidekiq, ActiveJob)—with support for nesting strategies. Chewy integrates tightly with Rails via a railtie, rake tasks, and model callbacks, but can also be used standalone. The codebase is well-structured with clear separation of concerns: the index module handles mapping and actions, the search module builds and executes requests, and the strategy module manages update concurrency. Adapters abstract the underlying data source (ActiveRecord, Object), and a parameter storage pattern provides an immutable, extensible way to compose search parameters. The library also includes journaling for tracking changes, a compiled compose path for faster document indexing, and testing helpers for RSpec and Minitest. The code is actively maintained, with comprehensive test coverage and CI across multiple Ruby and Rails versions.

RATING: 9.3/10 MAINT: active DRIFT: low
▸ 5 reusable components found
thoughtbot/factory_bot ★ 8167 2554 APPLICATION

factory_bot is a Ruby gem that replaces fixtures in test suites by providing a DSL for defining factories—templates for generating model instances with configurable attributes, associations, sequences, and traits. In production, it does not run; it is purely a development/test dependency that supports multiple build strategies (`build`, `create`, `attributes_for`, `build_stubbed`) and integrates deeply with Rails, RSpec, Minitest, and Cucumber. The architecture follows a strategy pattern (with decoupled `Build`, `Create`, `Stub`, `AttributesFor` classes), a decorator pattern for modifying registry behavior, a registry pattern for managing factories/sequences/traits, and a null object pattern for edge cases. Key entry points are `FactoryBot.define`, `FactoryBot.build`, `FactoryBot.create`, and the `FactoryBot.lint` validator. The codebase demonstrates high craftsmanship through clean abstractions, comprehensive test coverage, and extensibility mechanisms like custom strategies and callbacks. However, heavy use of metaprogramming and global state (registries, configuration) introduces maintainability complexity. Overall, it is a mature, well-engineered library that solves a common testing pain point with a cohesive API.

RATING: 9.2/10 MAINT: active DRIFT: low
▸ 3 reusable components found
phpspec/prophecy ★ 8465 245 APPLICATION

Prophecy is a PHP object mocking framework for creating test doubles (stubs, mocks, spies) in unit testing. It enables developers to define prophecies about future object interactions, specifying expected behavior through promises and verifying those expectations with predictions. The framework is designed to be framework-agnostic, integrating with tools like PHPUnit and PhpSpec. The architecture centers around a Prophet service that creates object prophecies. These prophecies utilize a doubler system to generate test double classes on-the-fly, applying patches for special cases (such as handling Throwable or Traversable objects). Argument matching is handled through a flexible token system, enabling precise control over which method invocations match a prophecy. Behavior and expectations are separated into promises (defining what the double should do) and predictions (defining what is expected to occur), promoting clear and maintainable test code. Notable for its robust handling of modern PHP features, Prophecy supports union types, intersection types, nullable types, readonly classes, and the never type. Its extensible design, particularly the strategy-based argument token system and the patchable class generation, demonstrates strong software engineering practices. The framework emphasizes lazy initialization and caching of generated doubles to optimize performance, making it suitable for extensive test suites.

RATING: 9.1/10 MAINT: active DRIFT: low
▸ 6 reusable components found
symfony/security-core ★ 1877 35 APPLICATION

This is the Symfony Security Core component, a pure PHP library providing a generic, extensible authorization and authentication framework. It is infrastructure code, not an application – it defines interfaces and implementations for token storage, access decision making (with pluggable voters and strategies), role hierarchies, user providers and checkers, signature hashing for secure links, and validation constraints. The architecture relies heavily on design patterns: Strategy (access decision strategies), Chain of Responsibility (user providers/checkers), Decorator (traceable managers, usage tracking token storage), and Template Method (abstract Voter class). It is well-typed with PHP 8.4 features and includes extensive unit tests. The repository also bundles 50+ locale translations for security-related exception messages. It is a mature, actively maintained component that forms the security foundation for Symfony applications.

RATING: 9.1/10 MAINT: active DRIFT: low
▸ 4 reusable components found
arturmkrtchyan/iban4j ★ 304 136 APPLICATION

iban4j is a mature, zero-dependency Java library for generating, validating, and parsing International Bank Account Numbers (IBAN) and Business Identifier Codes (BIC). It implements the full ISO 13616 and ISO 9362 standards, supporting over 90 countries with their specific BBAN structures. The library provides a fluent Builder pattern for IBAN construction, static utility methods in IbanUtil and BicUtil for validation, and an immutable Iban object that exposes country-specific fields like bank code, branch code, and national check digit. A standout feature is the extensible country-specific rules subsystem, which validates national check digits (e.g., French RIB key, Spanish modulo 11, Dutch '11-proef') via a pluggable SPI interface. The code is written in Java 11, follows Google Java Style, and has comprehensive test coverage with parameterized tests and custom Hamcrest matchers. Security-conscious design is evident in CharacterUtil, which strictly validates ASCII-only characters to prevent Unicode homograph attacks. The library is published to Maven Central and supports JPMS module system. It has no runtime dependencies.

RATING: 9.1/10 MAINT: active DRIFT: low
▸ 5 reusable components found
marc-mabe/php-enum ★ 498 35 APPLICATION

This repository provides a native PHP implementation of enumeration types, offering base Enum class, EnumSet for efficient set operations, and EnumMap for mapping enum keys to values. The Enum class implements the singleton pattern for enum values, ensuring that equivalent enum values are identical instances, and includes features like lazy constant discovery, inheritance support, and proper comparison handling. The EnumSet component stands out for its innovative bit vector implementation that automatically switches between integer storage (for small sets) and binary string storage (for large sets) to optimize memory usage and performance. It provides standard set operations (union, intersection, difference, symmetric difference) through efficient bitwise operations, making it particularly valuable for applications requiring efficient set manipulation on enum values. The library is well-maintained with comprehensive test suites, benchmarks, and support for multiple PHP versions. It follows semantic versioning and includes development tools for code quality checking. While the EnumSerializableTrait provides serialization support with noted caveats, the core enum functionality is robust and suitable for use in production PHP applications requiring type-safe enumeration patterns.

RATING: 8.8/10 MAINT: maintained DRIFT: low
▸ 1 reusable components found
robusta-dev/krr ★ 4705 281 APPLICATION

Robusta KRR is a CLI tool for optimizing Kubernetes resource allocation by recommending CPU and memory requests/limits based on Prometheus metrics. It features a modular architecture with pluggable strategies for recommendation algorithms, multiple output formats, and integrations with various Prometheus-compatible systems. The project includes an enforcer component (mutating webhook) for automatic application of recommendations. The codebase demonstrates good engineering practices with clear separation of concerns, proper error handling, and extensible design patterns.

RATING: 8.7/10 MAINT: active DRIFT: low
▸ 3 reusable components found
geo-team-red/geo-optimizer ★ 102 11 APPLICATION

GEO Optimizer is a Go library for Generative Engine Optimization that improves content visibility in AI search engines. It features a layered architecture with LLM abstraction, rule-based content scoring, and pluggable optimization strategies. The system optimizes content through a pipeline that applies strategies like structure enhancement, schema generation, and FAQ creation, using LLMs to generate optimized content while tracking improvements through scoring mechanisms. Key design patterns include the strategy interface for interchangeable optimizations and modular separation of concerns in the scoring system.

RATING: 8.6/10 MAINT: maintained DRIFT: low
▸ 1 reusable components found
towfiqi/serpbear ★ 2065 292 APPLICATION

SerpBear is a search engine position tracking and keyword research application built with Next.js (React) and TypeScript. It allows users to monitor keyword rankings for their domains in Google, integrate with Google Search Console for actual performance data, and leverage Google Ads for keyword ideas. The application features a modular architecture with separate frontend UI, backend API routes (`/pages/api/`), background scraping jobs via cron, and a SQLite database managed by Sequelize ORM. Key functionalities include SERP scraping through multiple third-party services, position history tracking, email notifications for ranking changes, insight analytics, and configurable settings for API keys and scraper selection. The system is containerized with Docker and supports PWA deployment for mobile access.

RATING: 8.2/10 MAINT: active DRIFT: medium
▸ 4 reusable components found
notifme/notifme-sdk ★ 1985 153 APPLICATION

Notifme SDK is a Node.js library for sending transactional notifications across multiple channels (email, SMS, push, webpush, Slack, WhatsApp, voice). It provides a unified interface with a provider pattern, allowing users to configure one or more providers per channel with built-in multi-provider strategies (fallback, round-robin, no-fallback). The library handles authentication, request formatting, and error handling for each provider, and includes a development mode with a notification catcher for local testing. The architecture is centered around a Sender class that dispatches requests to channel-specific strategies, which in turn call provider instances. External dependencies include nodemailer, node-fetch, web-push, winston, and node-pushnotifications. The codebase uses Flow for type checking and Babel for transpilation, with comprehensive Jest tests achieving 100% coverage thresholds.

RATING: 8.1/10 MAINT: active DRIFT: medium
▸ 4 reusable components found

Ember Data Factory Guy is an Ember.js addon designed for factory-based testing in Ember Data applications. It replaces traditional fixtures with factory definitions to generate test data, providing methods like `make`, `build`, and `mock*` for creating and persisting test records. The addon includes request mocking capabilities supporting both Pretender and MSW libraries, scenario management for test setup, and serializer-specific builders/converters for JSONAPI, REST, JSON, and ActiveModel formats. Architecture follows Ember addon conventions with a clear separation between core factory logic, adapter-specific handling, and mocking abstraters. The test application demonstrates usage patterns but is not the primary product.

RATING: 8.1/10 MAINT: active DRIFT: low
▸ 1 reusable components found
pubkey/broadcast-channel ★ 2000 131 APPLICATION

This repository is a JavaScript library providing a BroadcastChannel polyfill with leader election capabilities. It enables cross-tab/window/node-process communication through multiple fallback mechanisms (native BroadcastChannel, IndexedDB, localStorage, Node.js sockets, and a simulate method). The library implements leader election algorithms to coordinate multiple instances, ensuring only one acts as leader at a time. It supports diverse environments including old browsers, modern browsers, WebWorkers, Node.js, Deno, and iframes. The architecture centers around a core BroadcastChannel class with pluggable method implementations, a method chooser for fallback selection, and separate leader election utilities. Key entry points are the exported BroadcastChannel class and createLeaderElection function from src/index.js.

RATING: 8.0/10 MAINT: active DRIFT: low
▸ 4 reusable components found
jlcodes99/vscode-antigravity-cockpit ★ 4850 143 APPLICATION

This repository is a VS Code extension for monitoring and managing AI model quotas (Antigravity/Google Gemini/Claude/etc.). It provides a WebView dashboard and QuickPick view for real-time quota tracking, account management with OAuth authentication, auto-trigger/wakeup functionality to prevent quota exhaustion, and integration with the Cockpit Tools desktop application. The extension features quota grouping, history visualization, threshold-based notifications, multi-account support, and internationalization across 18+ languages. Architecture follows modular VS Code extension patterns with separate controllers, services, and views communicating via event-driven messaging.

RATING: 7.6/10 MAINT: active DRIFT: low
▸ 5 reusable components found
google-home/smart-home-local ★ 295 68 APPLICATION

This repository is a sample application for the Google Home Local SDK, demonstrating how to create a local fulfillment for a smart light device. It consists of three main parts: the local home app (in the `app` directory) that discovers and controls the device using various network protocols (UDP, mDNS, UPnP for discovery; UDP, TCP, HTTP for control); a virtual device (in the `device` directory) that simulates a smart light using the Open Pixel Control (OPC) protocol and supports the same discovery and control protocols for testing; and a Cloud Function (in the `functions` directory) that acts as a placeholder for the cloud-to-cloud backend, handling account linking and returning placeholder responses for SYNC and QUERY intents (while deferring EXECUTE and QUERY to the local fulfillment). The local home app uses a strategy pattern to delegate discovery and execution handling to protocol-specific implementations. The virtual device encapsulates the OPC protocol logic in a reusable component that is independent of the underlying transport mechanism.

RATING: 6.8/10 MAINT: active DRIFT: low
▸ 2 reusable components found
── end of results ──
$ submit: