$ account nuxt-modules
This is a Nuxt module for device detection that provides a reactive `$device` object and `useDevice()` composable. It determines device type (mobile, tablet, desktop), operating system (iOS, Android, Windows, macOS, Linux), browser (Chrome, Firefox, Edge, Safari, Samsung), and crawler status by parsing the User-Agent header and/or CDN-provided headers (Amazon CloudFront, Cloudflare). The core detection logic is encapsulated in `src/runtime/generateFlags.ts`, which is a standalone, well-tested function. The module is built for Nuxt 3+ (ESM-only) and uses `crawler-user-agents` for crawler detection with a build-time generated regex for performance. The codebase is small, focused, and demonstrates good engineering practices with clean separation of concerns, comprehensive tests, and proper use of Nuxt module APIs.
This is a Nuxt 3 module that integrates Apollo GraphQL client into Nuxt applications. It provides a flexible configuration system for defining multiple Apollo clients with HTTP and WebSocket endpoints, authentication token management, and SSR support. The module auto-imports composables like useAsyncQuery, useQuery, useMutation, and useSubscription, and provides hooks for custom authentication and error handling. It also supports hot module replacement for Apollo client configuration files. The architecture uses Nuxt's module system (defineNuxtModule) to hook into the build process. It reads client configurations from nuxt.config or external files, generates runtime templates, and sets up a Nuxt plugin that creates ApolloClient instances with appropriate links (HTTP, WebSocket, auth, error). The composables layer provides SSR-friendly async query wrappers and authentication helpers. WebSocket support includes a restartable client for reconnection. Key entry points are src/module.ts (module setup), src/runtime/plugin.ts (client creation and plugin), and src/runtime/composables.ts (user-facing composables). External dependencies include @apollo/client, @vue/apollo-composable, graphql-ws, and @nuxt/kit.
This is a Nuxt 3 module that integrates Cloudflare Turnstile, a privacy-focused CAPTCHA alternative. It provides a Vue component (`<NuxtTurnstile>`) for client-side rendering of the Turnstile widget, a composable (`useScriptCloudflareTurnstile`) for script loading via `@nuxt/scripts`, and a server-side utility (`verifyTurnstileToken`) for token validation in Nitro endpoints. The module automatically handles script injection, token refresh, and exposes a reset method. It also supports an optional validation endpoint at `/_turnstile/validate`. The architecture follows the standard Nuxt module pattern: `src/module.ts` registers components, composables, and server handlers. External dependencies include Cloudflare's Turnstile API, `@nuxt/scripts`, `@nuxt/kit`, `defu`, and `pathe`. The codebase is well-structured, typed, and includes end-to-end tests with Playwright.