npm-networking/.github/copilot-instructions.md

917 B

blax-npm-networking

Overview

Plug-and-play API + WebSocket client for Vue/Nuxt apps. Framework-agnostic core with optional bindings.

Build

  • pnpm build — builds via tsup to dist/
  • dist/ is gitignored — never commit build artifacts
  • prepare script runs tsup automatically on git+https:// installs
  • Exports: . (core), ./vue, ./nuxt, ./axios

WebSocket

  • createWsClient() takes a URL and connects via native WebSocket
  • createFromNuxtConfig() reads runtimeConfig.public keys: WEBS_URL, WS_PROTOCOL, PUSHER_APP_KEY
  • App key default: websocket — generic identifier, same in all environments
  • URL format: {protocol}://{host}/app/{appKey}
  • Has built-in connection diagnostics: URL validation, 5s timeout for connection_established

Conventions

  • TypeScript strict mode
  • No environment-specific defaults — all config values should work across dev and prod