@wazir-dev/cli 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +111 -0
- package/CHANGELOG.md +14 -0
- package/CONTRIBUTING.md +101 -0
- package/LICENSE +21 -0
- package/README.md +314 -0
- package/assets/composition-engine.mmd +34 -0
- package/assets/demo-script.sh +17 -0
- package/assets/logo-dark.svg +14 -0
- package/assets/logo.svg +14 -0
- package/assets/pipeline.mmd +39 -0
- package/assets/record-demo.sh +51 -0
- package/docs/README.md +51 -0
- package/docs/adapters/context-mode.md +60 -0
- package/docs/concepts/architecture.md +87 -0
- package/docs/concepts/artifact-model.md +60 -0
- package/docs/concepts/composition-engine.md +36 -0
- package/docs/concepts/indexing-and-recall.md +160 -0
- package/docs/concepts/observability.md +41 -0
- package/docs/concepts/roles-and-workflows.md +59 -0
- package/docs/concepts/terminology-policy.md +27 -0
- package/docs/getting-started/01-installation.md +78 -0
- package/docs/getting-started/02-first-run.md +102 -0
- package/docs/getting-started/03-adding-to-project.md +15 -0
- package/docs/getting-started/04-host-setup.md +15 -0
- package/docs/guides/ci-integration.md +15 -0
- package/docs/guides/creating-skills.md +15 -0
- package/docs/guides/expertise-module-authoring.md +15 -0
- package/docs/guides/hook-development.md +15 -0
- package/docs/guides/memory-and-learnings.md +34 -0
- package/docs/guides/multi-host-export.md +15 -0
- package/docs/guides/troubleshooting.md +101 -0
- package/docs/guides/writing-custom-roles.md +15 -0
- package/docs/plans/2026-03-15-cli-pipeline-integration-design.md +592 -0
- package/docs/plans/2026-03-15-cli-pipeline-integration-plan.md +598 -0
- package/docs/plans/2026-03-15-docs-enforcement-plan.md +238 -0
- package/docs/readmes/INDEX.md +99 -0
- package/docs/readmes/features/expertise/README.md +171 -0
- package/docs/readmes/features/exports/README.md +222 -0
- package/docs/readmes/features/hooks/README.md +103 -0
- package/docs/readmes/features/hooks/loop-cap-guard.md +133 -0
- package/docs/readmes/features/hooks/post-tool-capture.md +121 -0
- package/docs/readmes/features/hooks/post-tool-lint.md +130 -0
- package/docs/readmes/features/hooks/pre-compact-summary.md +122 -0
- package/docs/readmes/features/hooks/pre-tool-capture-route.md +100 -0
- package/docs/readmes/features/hooks/protected-path-write-guard.md +128 -0
- package/docs/readmes/features/hooks/session-start.md +119 -0
- package/docs/readmes/features/hooks/stop-handoff-harvest.md +125 -0
- package/docs/readmes/features/roles/README.md +157 -0
- package/docs/readmes/features/roles/clarifier.md +152 -0
- package/docs/readmes/features/roles/content-author.md +190 -0
- package/docs/readmes/features/roles/designer.md +193 -0
- package/docs/readmes/features/roles/executor.md +184 -0
- package/docs/readmes/features/roles/learner.md +210 -0
- package/docs/readmes/features/roles/planner.md +182 -0
- package/docs/readmes/features/roles/researcher.md +164 -0
- package/docs/readmes/features/roles/reviewer.md +184 -0
- package/docs/readmes/features/roles/specifier.md +162 -0
- package/docs/readmes/features/roles/verifier.md +215 -0
- package/docs/readmes/features/schemas/README.md +178 -0
- package/docs/readmes/features/skills/README.md +63 -0
- package/docs/readmes/features/skills/brainstorming.md +96 -0
- package/docs/readmes/features/skills/debugging.md +148 -0
- package/docs/readmes/features/skills/design.md +120 -0
- package/docs/readmes/features/skills/prepare-next.md +109 -0
- package/docs/readmes/features/skills/run-audit.md +159 -0
- package/docs/readmes/features/skills/scan-project.md +109 -0
- package/docs/readmes/features/skills/self-audit.md +176 -0
- package/docs/readmes/features/skills/tdd.md +137 -0
- package/docs/readmes/features/skills/using-skills.md +92 -0
- package/docs/readmes/features/skills/verification.md +120 -0
- package/docs/readmes/features/skills/writing-plans.md +104 -0
- package/docs/readmes/features/tooling/README.md +320 -0
- package/docs/readmes/features/workflows/README.md +186 -0
- package/docs/readmes/features/workflows/author.md +181 -0
- package/docs/readmes/features/workflows/clarify.md +154 -0
- package/docs/readmes/features/workflows/design-review.md +171 -0
- package/docs/readmes/features/workflows/design.md +169 -0
- package/docs/readmes/features/workflows/discover.md +162 -0
- package/docs/readmes/features/workflows/execute.md +173 -0
- package/docs/readmes/features/workflows/learn.md +167 -0
- package/docs/readmes/features/workflows/plan-review.md +165 -0
- package/docs/readmes/features/workflows/plan.md +170 -0
- package/docs/readmes/features/workflows/prepare-next.md +167 -0
- package/docs/readmes/features/workflows/review.md +169 -0
- package/docs/readmes/features/workflows/run-audit.md +191 -0
- package/docs/readmes/features/workflows/spec-challenge.md +159 -0
- package/docs/readmes/features/workflows/specify.md +160 -0
- package/docs/readmes/features/workflows/verify.md +177 -0
- package/docs/readmes/packages/README.md +50 -0
- package/docs/readmes/packages/ajv.md +117 -0
- package/docs/readmes/packages/context-mode.md +118 -0
- package/docs/readmes/packages/gray-matter.md +116 -0
- package/docs/readmes/packages/node-test.md +137 -0
- package/docs/readmes/packages/yaml.md +112 -0
- package/docs/reference/configuration-reference.md +159 -0
- package/docs/reference/expertise-index.md +52 -0
- package/docs/reference/git-flow.md +43 -0
- package/docs/reference/hooks.md +87 -0
- package/docs/reference/host-exports.md +50 -0
- package/docs/reference/launch-checklist.md +172 -0
- package/docs/reference/marketplace-listings.md +76 -0
- package/docs/reference/release-process.md +34 -0
- package/docs/reference/roles-reference.md +77 -0
- package/docs/reference/skills.md +33 -0
- package/docs/reference/templates.md +29 -0
- package/docs/reference/tooling-cli.md +94 -0
- package/docs/truth-claims.yaml +222 -0
- package/expertise/PROGRESS.md +63 -0
- package/expertise/README.md +18 -0
- package/expertise/antipatterns/PROGRESS.md +56 -0
- package/expertise/antipatterns/backend/api-design-antipatterns.md +1271 -0
- package/expertise/antipatterns/backend/auth-antipatterns.md +1195 -0
- package/expertise/antipatterns/backend/caching-antipatterns.md +622 -0
- package/expertise/antipatterns/backend/database-antipatterns.md +1038 -0
- package/expertise/antipatterns/backend/index.md +24 -0
- package/expertise/antipatterns/backend/microservices-antipatterns.md +850 -0
- package/expertise/antipatterns/code/architecture-antipatterns.md +919 -0
- package/expertise/antipatterns/code/async-antipatterns.md +622 -0
- package/expertise/antipatterns/code/code-smells.md +1186 -0
- package/expertise/antipatterns/code/dependency-antipatterns.md +1209 -0
- package/expertise/antipatterns/code/error-handling-antipatterns.md +1360 -0
- package/expertise/antipatterns/code/index.md +27 -0
- package/expertise/antipatterns/code/naming-and-abstraction.md +1118 -0
- package/expertise/antipatterns/code/state-management-antipatterns.md +1076 -0
- package/expertise/antipatterns/code/testing-antipatterns.md +1053 -0
- package/expertise/antipatterns/design/accessibility-antipatterns.md +1136 -0
- package/expertise/antipatterns/design/dark-patterns.md +1121 -0
- package/expertise/antipatterns/design/index.md +22 -0
- package/expertise/antipatterns/design/ui-antipatterns.md +1202 -0
- package/expertise/antipatterns/design/ux-antipatterns.md +680 -0
- package/expertise/antipatterns/frontend/css-layout-antipatterns.md +691 -0
- package/expertise/antipatterns/frontend/flutter-antipatterns.md +1827 -0
- package/expertise/antipatterns/frontend/index.md +23 -0
- package/expertise/antipatterns/frontend/mobile-antipatterns.md +573 -0
- package/expertise/antipatterns/frontend/react-antipatterns.md +1128 -0
- package/expertise/antipatterns/frontend/spa-antipatterns.md +1235 -0
- package/expertise/antipatterns/index.md +31 -0
- package/expertise/antipatterns/performance/index.md +20 -0
- package/expertise/antipatterns/performance/performance-antipatterns.md +1013 -0
- package/expertise/antipatterns/performance/premature-optimization.md +623 -0
- package/expertise/antipatterns/performance/scaling-antipatterns.md +785 -0
- package/expertise/antipatterns/process/ai-coding-antipatterns.md +853 -0
- package/expertise/antipatterns/process/code-review-antipatterns.md +656 -0
- package/expertise/antipatterns/process/deployment-antipatterns.md +920 -0
- package/expertise/antipatterns/process/index.md +23 -0
- package/expertise/antipatterns/process/technical-debt-antipatterns.md +647 -0
- package/expertise/antipatterns/security/index.md +20 -0
- package/expertise/antipatterns/security/secrets-antipatterns.md +849 -0
- package/expertise/antipatterns/security/security-theater.md +843 -0
- package/expertise/antipatterns/security/vulnerability-patterns.md +801 -0
- package/expertise/architecture/PROGRESS.md +70 -0
- package/expertise/architecture/data/caching-architecture.md +671 -0
- package/expertise/architecture/data/data-consistency.md +574 -0
- package/expertise/architecture/data/data-modeling.md +536 -0
- package/expertise/architecture/data/event-streams-and-queues.md +634 -0
- package/expertise/architecture/data/index.md +25 -0
- package/expertise/architecture/data/search-architecture.md +663 -0
- package/expertise/architecture/data/sql-vs-nosql.md +708 -0
- package/expertise/architecture/decisions/architecture-decision-records.md +640 -0
- package/expertise/architecture/decisions/build-vs-buy.md +616 -0
- package/expertise/architecture/decisions/index.md +23 -0
- package/expertise/architecture/decisions/monolith-to-microservices.md +790 -0
- package/expertise/architecture/decisions/technology-selection.md +616 -0
- package/expertise/architecture/distributed/cap-theorem-and-tradeoffs.md +800 -0
- package/expertise/architecture/distributed/circuit-breaker-bulkhead.md +741 -0
- package/expertise/architecture/distributed/consensus-and-coordination.md +796 -0
- package/expertise/architecture/distributed/distributed-systems-fundamentals.md +564 -0
- package/expertise/architecture/distributed/idempotency-and-retry.md +796 -0
- package/expertise/architecture/distributed/index.md +25 -0
- package/expertise/architecture/distributed/saga-pattern.md +797 -0
- package/expertise/architecture/foundations/architectural-thinking.md +460 -0
- package/expertise/architecture/foundations/coupling-and-cohesion.md +770 -0
- package/expertise/architecture/foundations/design-principles-solid.md +649 -0
- package/expertise/architecture/foundations/domain-driven-design.md +719 -0
- package/expertise/architecture/foundations/index.md +25 -0
- package/expertise/architecture/foundations/separation-of-concerns.md +472 -0
- package/expertise/architecture/foundations/twelve-factor-app.md +797 -0
- package/expertise/architecture/index.md +34 -0
- package/expertise/architecture/integration/api-design-graphql.md +638 -0
- package/expertise/architecture/integration/api-design-grpc.md +804 -0
- package/expertise/architecture/integration/api-design-rest.md +892 -0
- package/expertise/architecture/integration/index.md +25 -0
- package/expertise/architecture/integration/third-party-integration.md +795 -0
- package/expertise/architecture/integration/webhooks-and-callbacks.md +1152 -0
- package/expertise/architecture/integration/websockets-realtime.md +791 -0
- package/expertise/architecture/mobile-architecture/index.md +22 -0
- package/expertise/architecture/mobile-architecture/mobile-app-architecture.md +780 -0
- package/expertise/architecture/mobile-architecture/mobile-backend-for-frontend.md +670 -0
- package/expertise/architecture/mobile-architecture/offline-first.md +719 -0
- package/expertise/architecture/mobile-architecture/push-and-sync.md +782 -0
- package/expertise/architecture/patterns/cqrs-event-sourcing.md +717 -0
- package/expertise/architecture/patterns/event-driven.md +797 -0
- package/expertise/architecture/patterns/hexagonal-clean-architecture.md +870 -0
- package/expertise/architecture/patterns/index.md +27 -0
- package/expertise/architecture/patterns/layered-architecture.md +736 -0
- package/expertise/architecture/patterns/microservices.md +753 -0
- package/expertise/architecture/patterns/modular-monolith.md +692 -0
- package/expertise/architecture/patterns/monolith.md +626 -0
- package/expertise/architecture/patterns/plugin-architecture.md +735 -0
- package/expertise/architecture/patterns/serverless.md +780 -0
- package/expertise/architecture/scaling/database-scaling.md +615 -0
- package/expertise/architecture/scaling/feature-flags-and-rollouts.md +757 -0
- package/expertise/architecture/scaling/horizontal-vs-vertical.md +606 -0
- package/expertise/architecture/scaling/index.md +24 -0
- package/expertise/architecture/scaling/multi-tenancy.md +800 -0
- package/expertise/architecture/scaling/stateless-design.md +787 -0
- package/expertise/backend/embedded-firmware.md +625 -0
- package/expertise/backend/go.md +853 -0
- package/expertise/backend/index.md +24 -0
- package/expertise/backend/java-spring.md +448 -0
- package/expertise/backend/node-typescript.md +625 -0
- package/expertise/backend/python-fastapi.md +724 -0
- package/expertise/backend/rust.md +458 -0
- package/expertise/backend/solidity.md +711 -0
- package/expertise/composition-map.yaml +443 -0
- package/expertise/content/foundations/content-modeling.md +395 -0
- package/expertise/content/foundations/editorial-standards.md +449 -0
- package/expertise/content/foundations/index.md +24 -0
- package/expertise/content/foundations/microcopy.md +455 -0
- package/expertise/content/foundations/terminology-governance.md +509 -0
- package/expertise/content/index.md +34 -0
- package/expertise/content/patterns/accessibility-copy.md +518 -0
- package/expertise/content/patterns/index.md +24 -0
- package/expertise/content/patterns/notification-content.md +433 -0
- package/expertise/content/patterns/sample-content.md +486 -0
- package/expertise/content/patterns/state-copy.md +439 -0
- package/expertise/design/PROGRESS.md +58 -0
- package/expertise/design/disciplines/dark-mode-theming.md +577 -0
- package/expertise/design/disciplines/design-systems.md +595 -0
- package/expertise/design/disciplines/index.md +25 -0
- package/expertise/design/disciplines/information-architecture.md +800 -0
- package/expertise/design/disciplines/interaction-design.md +788 -0
- package/expertise/design/disciplines/responsive-design.md +552 -0
- package/expertise/design/disciplines/usability-testing.md +516 -0
- package/expertise/design/disciplines/user-research.md +792 -0
- package/expertise/design/foundations/accessibility-design.md +796 -0
- package/expertise/design/foundations/color-theory.md +797 -0
- package/expertise/design/foundations/iconography.md +795 -0
- package/expertise/design/foundations/index.md +26 -0
- package/expertise/design/foundations/motion-and-animation.md +653 -0
- package/expertise/design/foundations/rtl-design.md +585 -0
- package/expertise/design/foundations/spacing-and-layout.md +607 -0
- package/expertise/design/foundations/typography.md +800 -0
- package/expertise/design/foundations/visual-hierarchy.md +761 -0
- package/expertise/design/index.md +32 -0
- package/expertise/design/patterns/authentication-flows.md +474 -0
- package/expertise/design/patterns/content-consumption.md +789 -0
- package/expertise/design/patterns/data-display.md +618 -0
- package/expertise/design/patterns/e-commerce.md +1494 -0
- package/expertise/design/patterns/feedback-and-states.md +642 -0
- package/expertise/design/patterns/forms-and-input.md +819 -0
- package/expertise/design/patterns/gamification.md +801 -0
- package/expertise/design/patterns/index.md +31 -0
- package/expertise/design/patterns/microinteractions.md +449 -0
- package/expertise/design/patterns/navigation.md +800 -0
- package/expertise/design/patterns/notifications.md +705 -0
- package/expertise/design/patterns/onboarding.md +700 -0
- package/expertise/design/patterns/search-and-filter.md +601 -0
- package/expertise/design/patterns/settings-and-preferences.md +768 -0
- package/expertise/design/patterns/social-and-community.md +748 -0
- package/expertise/design/platforms/desktop-native.md +612 -0
- package/expertise/design/platforms/index.md +25 -0
- package/expertise/design/platforms/mobile-android.md +825 -0
- package/expertise/design/platforms/mobile-cross-platform.md +983 -0
- package/expertise/design/platforms/mobile-ios.md +699 -0
- package/expertise/design/platforms/tablet.md +794 -0
- package/expertise/design/platforms/web-dashboard.md +790 -0
- package/expertise/design/platforms/web-responsive.md +550 -0
- package/expertise/design/psychology/behavioral-nudges.md +449 -0
- package/expertise/design/psychology/cognitive-load.md +1191 -0
- package/expertise/design/psychology/error-psychology.md +778 -0
- package/expertise/design/psychology/index.md +22 -0
- package/expertise/design/psychology/persuasive-design.md +736 -0
- package/expertise/design/psychology/user-mental-models.md +623 -0
- package/expertise/design/tooling/open-pencil.md +266 -0
- package/expertise/frontend/angular.md +1073 -0
- package/expertise/frontend/desktop-electron.md +546 -0
- package/expertise/frontend/flutter.md +782 -0
- package/expertise/frontend/index.md +27 -0
- package/expertise/frontend/native-android.md +409 -0
- package/expertise/frontend/native-ios.md +490 -0
- package/expertise/frontend/react-native.md +1160 -0
- package/expertise/frontend/react.md +808 -0
- package/expertise/frontend/vue.md +1089 -0
- package/expertise/humanize/domain-rules-code.md +79 -0
- package/expertise/humanize/domain-rules-content.md +67 -0
- package/expertise/humanize/domain-rules-technical-docs.md +56 -0
- package/expertise/humanize/index.md +35 -0
- package/expertise/humanize/self-audit-checklist.md +87 -0
- package/expertise/humanize/sentence-patterns.md +218 -0
- package/expertise/humanize/vocabulary-blacklist.md +105 -0
- package/expertise/i18n/PROGRESS.md +65 -0
- package/expertise/i18n/advanced/accessibility-and-i18n.md +28 -0
- package/expertise/i18n/advanced/bidirectional-text-algorithm.md +38 -0
- package/expertise/i18n/advanced/complex-scripts.md +30 -0
- package/expertise/i18n/advanced/performance-and-i18n.md +27 -0
- package/expertise/i18n/advanced/testing-i18n.md +28 -0
- package/expertise/i18n/content/content-adaptation.md +23 -0
- package/expertise/i18n/content/locale-specific-formatting.md +23 -0
- package/expertise/i18n/content/machine-translation-integration.md +28 -0
- package/expertise/i18n/content/translation-management.md +29 -0
- package/expertise/i18n/foundations/date-time-calendars.md +67 -0
- package/expertise/i18n/foundations/i18n-architecture.md +272 -0
- package/expertise/i18n/foundations/locale-and-language-tags.md +79 -0
- package/expertise/i18n/foundations/numbers-currency-units.md +61 -0
- package/expertise/i18n/foundations/pluralization-and-gender.md +109 -0
- package/expertise/i18n/foundations/string-externalization.md +236 -0
- package/expertise/i18n/foundations/text-direction-bidi.md +241 -0
- package/expertise/i18n/foundations/unicode-and-encoding.md +86 -0
- package/expertise/i18n/index.md +38 -0
- package/expertise/i18n/platform/backend-i18n.md +31 -0
- package/expertise/i18n/platform/flutter-i18n.md +148 -0
- package/expertise/i18n/platform/native-android-i18n.md +36 -0
- package/expertise/i18n/platform/native-ios-i18n.md +36 -0
- package/expertise/i18n/platform/react-i18n.md +103 -0
- package/expertise/i18n/platform/web-css-i18n.md +81 -0
- package/expertise/i18n/rtl/arabic-specific.md +175 -0
- package/expertise/i18n/rtl/hebrew-specific.md +149 -0
- package/expertise/i18n/rtl/rtl-animations-and-transitions.md +111 -0
- package/expertise/i18n/rtl/rtl-forms-and-input.md +161 -0
- package/expertise/i18n/rtl/rtl-fundamentals.md +211 -0
- package/expertise/i18n/rtl/rtl-icons-and-images.md +181 -0
- package/expertise/i18n/rtl/rtl-layout-mirroring.md +252 -0
- package/expertise/i18n/rtl/rtl-navigation-and-gestures.md +107 -0
- package/expertise/i18n/rtl/rtl-testing-and-qa.md +147 -0
- package/expertise/i18n/rtl/rtl-typography.md +160 -0
- package/expertise/index.md +113 -0
- package/expertise/index.yaml +216 -0
- package/expertise/infrastructure/cloud-aws.md +597 -0
- package/expertise/infrastructure/cloud-gcp.md +599 -0
- package/expertise/infrastructure/cybersecurity.md +816 -0
- package/expertise/infrastructure/database-mongodb.md +447 -0
- package/expertise/infrastructure/database-postgres.md +400 -0
- package/expertise/infrastructure/devops-cicd.md +787 -0
- package/expertise/infrastructure/index.md +27 -0
- package/expertise/performance/PROGRESS.md +50 -0
- package/expertise/performance/backend/api-latency.md +1204 -0
- package/expertise/performance/backend/background-jobs.md +506 -0
- package/expertise/performance/backend/connection-pooling.md +1209 -0
- package/expertise/performance/backend/database-query-optimization.md +515 -0
- package/expertise/performance/backend/index.md +23 -0
- package/expertise/performance/backend/rate-limiting-and-throttling.md +971 -0
- package/expertise/performance/foundations/algorithmic-complexity.md +954 -0
- package/expertise/performance/foundations/caching-strategies.md +489 -0
- package/expertise/performance/foundations/concurrency-and-parallelism.md +847 -0
- package/expertise/performance/foundations/index.md +24 -0
- package/expertise/performance/foundations/measuring-and-profiling.md +440 -0
- package/expertise/performance/foundations/memory-management.md +964 -0
- package/expertise/performance/foundations/performance-budgets.md +1314 -0
- package/expertise/performance/index.md +31 -0
- package/expertise/performance/infrastructure/auto-scaling.md +1059 -0
- package/expertise/performance/infrastructure/cdn-and-edge.md +1081 -0
- package/expertise/performance/infrastructure/index.md +22 -0
- package/expertise/performance/infrastructure/load-balancing.md +1081 -0
- package/expertise/performance/infrastructure/observability.md +1079 -0
- package/expertise/performance/mobile/index.md +23 -0
- package/expertise/performance/mobile/mobile-animations.md +544 -0
- package/expertise/performance/mobile/mobile-memory-battery.md +416 -0
- package/expertise/performance/mobile/mobile-network.md +452 -0
- package/expertise/performance/mobile/mobile-rendering.md +599 -0
- package/expertise/performance/mobile/mobile-startup-time.md +505 -0
- package/expertise/performance/platform-specific/flutter-performance.md +647 -0
- package/expertise/performance/platform-specific/index.md +22 -0
- package/expertise/performance/platform-specific/node-performance.md +1307 -0
- package/expertise/performance/platform-specific/postgres-performance.md +1366 -0
- package/expertise/performance/platform-specific/react-performance.md +1403 -0
- package/expertise/performance/web/bundle-optimization.md +1239 -0
- package/expertise/performance/web/image-and-media.md +636 -0
- package/expertise/performance/web/index.md +24 -0
- package/expertise/performance/web/network-optimization.md +1133 -0
- package/expertise/performance/web/rendering-performance.md +1098 -0
- package/expertise/performance/web/ssr-and-hydration.md +918 -0
- package/expertise/performance/web/web-vitals.md +1374 -0
- package/expertise/quality/accessibility.md +985 -0
- package/expertise/quality/evidence-based-verification.md +499 -0
- package/expertise/quality/index.md +24 -0
- package/expertise/quality/ml-model-audit.md +614 -0
- package/expertise/quality/performance.md +600 -0
- package/expertise/quality/testing-api.md +891 -0
- package/expertise/quality/testing-mobile.md +496 -0
- package/expertise/quality/testing-web.md +849 -0
- package/expertise/security/PROGRESS.md +54 -0
- package/expertise/security/agentic-identity.md +540 -0
- package/expertise/security/compliance-frameworks.md +601 -0
- package/expertise/security/data/data-encryption.md +364 -0
- package/expertise/security/data/data-privacy-gdpr.md +692 -0
- package/expertise/security/data/database-security.md +1171 -0
- package/expertise/security/data/index.md +22 -0
- package/expertise/security/data/pii-handling.md +531 -0
- package/expertise/security/foundations/authentication.md +1041 -0
- package/expertise/security/foundations/authorization.md +603 -0
- package/expertise/security/foundations/cryptography.md +1001 -0
- package/expertise/security/foundations/index.md +25 -0
- package/expertise/security/foundations/owasp-top-10.md +1354 -0
- package/expertise/security/foundations/secrets-management.md +1217 -0
- package/expertise/security/foundations/secure-sdlc.md +700 -0
- package/expertise/security/foundations/supply-chain-security.md +698 -0
- package/expertise/security/index.md +31 -0
- package/expertise/security/infrastructure/cloud-security-aws.md +1296 -0
- package/expertise/security/infrastructure/cloud-security-gcp.md +1376 -0
- package/expertise/security/infrastructure/container-security.md +721 -0
- package/expertise/security/infrastructure/incident-response.md +1295 -0
- package/expertise/security/infrastructure/index.md +24 -0
- package/expertise/security/infrastructure/logging-and-monitoring.md +1618 -0
- package/expertise/security/infrastructure/network-security.md +1337 -0
- package/expertise/security/mobile/index.md +23 -0
- package/expertise/security/mobile/mobile-android-security.md +1218 -0
- package/expertise/security/mobile/mobile-binary-protection.md +1229 -0
- package/expertise/security/mobile/mobile-data-storage.md +1265 -0
- package/expertise/security/mobile/mobile-ios-security.md +1401 -0
- package/expertise/security/mobile/mobile-network-security.md +1520 -0
- package/expertise/security/smart-contract-security.md +594 -0
- package/expertise/security/testing/index.md +22 -0
- package/expertise/security/testing/penetration-testing.md +1258 -0
- package/expertise/security/testing/security-code-review.md +1765 -0
- package/expertise/security/testing/threat-modeling.md +1074 -0
- package/expertise/security/testing/vulnerability-scanning.md +1062 -0
- package/expertise/security/web/api-security.md +586 -0
- package/expertise/security/web/cors-and-headers.md +433 -0
- package/expertise/security/web/csrf.md +562 -0
- package/expertise/security/web/file-upload.md +1477 -0
- package/expertise/security/web/index.md +25 -0
- package/expertise/security/web/injection.md +1375 -0
- package/expertise/security/web/session-management.md +1101 -0
- package/expertise/security/web/xss.md +1158 -0
- package/exports/README.md +17 -0
- package/exports/hosts/claude/.claude/agents/clarifier.md +42 -0
- package/exports/hosts/claude/.claude/agents/content-author.md +63 -0
- package/exports/hosts/claude/.claude/agents/designer.md +55 -0
- package/exports/hosts/claude/.claude/agents/executor.md +55 -0
- package/exports/hosts/claude/.claude/agents/learner.md +51 -0
- package/exports/hosts/claude/.claude/agents/planner.md +53 -0
- package/exports/hosts/claude/.claude/agents/researcher.md +43 -0
- package/exports/hosts/claude/.claude/agents/reviewer.md +54 -0
- package/exports/hosts/claude/.claude/agents/specifier.md +47 -0
- package/exports/hosts/claude/.claude/agents/verifier.md +71 -0
- package/exports/hosts/claude/.claude/commands/author.md +42 -0
- package/exports/hosts/claude/.claude/commands/clarify.md +38 -0
- package/exports/hosts/claude/.claude/commands/design-review.md +46 -0
- package/exports/hosts/claude/.claude/commands/design.md +44 -0
- package/exports/hosts/claude/.claude/commands/discover.md +37 -0
- package/exports/hosts/claude/.claude/commands/execute.md +48 -0
- package/exports/hosts/claude/.claude/commands/learn.md +38 -0
- package/exports/hosts/claude/.claude/commands/plan-review.md +42 -0
- package/exports/hosts/claude/.claude/commands/plan.md +39 -0
- package/exports/hosts/claude/.claude/commands/prepare-next.md +37 -0
- package/exports/hosts/claude/.claude/commands/review.md +40 -0
- package/exports/hosts/claude/.claude/commands/run-audit.md +41 -0
- package/exports/hosts/claude/.claude/commands/spec-challenge.md +41 -0
- package/exports/hosts/claude/.claude/commands/specify.md +38 -0
- package/exports/hosts/claude/.claude/commands/verify.md +37 -0
- package/exports/hosts/claude/.claude/settings.json +34 -0
- package/exports/hosts/claude/CLAUDE.md +19 -0
- package/exports/hosts/claude/export.manifest.json +38 -0
- package/exports/hosts/claude/host-package.json +67 -0
- package/exports/hosts/codex/AGENTS.md +19 -0
- package/exports/hosts/codex/export.manifest.json +38 -0
- package/exports/hosts/codex/host-package.json +41 -0
- package/exports/hosts/cursor/.cursor/hooks.json +16 -0
- package/exports/hosts/cursor/.cursor/rules/wazir-core.mdc +19 -0
- package/exports/hosts/cursor/export.manifest.json +38 -0
- package/exports/hosts/cursor/host-package.json +42 -0
- package/exports/hosts/gemini/GEMINI.md +19 -0
- package/exports/hosts/gemini/export.manifest.json +38 -0
- package/exports/hosts/gemini/host-package.json +41 -0
- package/hooks/README.md +18 -0
- package/hooks/definitions/loop_cap_guard.yaml +21 -0
- package/hooks/definitions/post_tool_capture.yaml +24 -0
- package/hooks/definitions/pre_compact_summary.yaml +19 -0
- package/hooks/definitions/pre_tool_capture_route.yaml +19 -0
- package/hooks/definitions/protected_path_write_guard.yaml +19 -0
- package/hooks/definitions/session_start.yaml +19 -0
- package/hooks/definitions/stop_handoff_harvest.yaml +20 -0
- package/hooks/loop-cap-guard +17 -0
- package/hooks/post-tool-lint +36 -0
- package/hooks/protected-path-write-guard +17 -0
- package/hooks/session-start +41 -0
- package/llms-full.txt +2355 -0
- package/llms.txt +43 -0
- package/package.json +79 -0
- package/roles/README.md +20 -0
- package/roles/clarifier.md +42 -0
- package/roles/content-author.md +63 -0
- package/roles/designer.md +55 -0
- package/roles/executor.md +55 -0
- package/roles/learner.md +51 -0
- package/roles/planner.md +53 -0
- package/roles/researcher.md +43 -0
- package/roles/reviewer.md +54 -0
- package/roles/specifier.md +47 -0
- package/roles/verifier.md +71 -0
- package/schemas/README.md +24 -0
- package/schemas/accepted-learning.schema.json +20 -0
- package/schemas/author-artifact.schema.json +156 -0
- package/schemas/clarification.schema.json +19 -0
- package/schemas/design-artifact.schema.json +80 -0
- package/schemas/docs-claim.schema.json +18 -0
- package/schemas/export-manifest.schema.json +20 -0
- package/schemas/hook.schema.json +67 -0
- package/schemas/host-export-package.schema.json +18 -0
- package/schemas/implementation-plan.schema.json +19 -0
- package/schemas/proposed-learning.schema.json +19 -0
- package/schemas/research.schema.json +18 -0
- package/schemas/review.schema.json +29 -0
- package/schemas/run-manifest.schema.json +18 -0
- package/schemas/spec-challenge.schema.json +18 -0
- package/schemas/spec.schema.json +20 -0
- package/schemas/usage.schema.json +102 -0
- package/schemas/verification-proof.schema.json +29 -0
- package/schemas/wazir-manifest.schema.json +173 -0
- package/skills/README.md +40 -0
- package/skills/brainstorming/SKILL.md +77 -0
- package/skills/debugging/SKILL.md +50 -0
- package/skills/design/SKILL.md +61 -0
- package/skills/dispatching-parallel-agents/SKILL.md +128 -0
- package/skills/executing-plans/SKILL.md +70 -0
- package/skills/finishing-a-development-branch/SKILL.md +169 -0
- package/skills/humanize/SKILL.md +123 -0
- package/skills/init-pipeline/SKILL.md +124 -0
- package/skills/prepare-next/SKILL.md +20 -0
- package/skills/receiving-code-review/SKILL.md +123 -0
- package/skills/requesting-code-review/SKILL.md +105 -0
- package/skills/requesting-code-review/code-reviewer.md +108 -0
- package/skills/run-audit/SKILL.md +197 -0
- package/skills/scan-project/SKILL.md +41 -0
- package/skills/self-audit/SKILL.md +153 -0
- package/skills/subagent-driven-development/SKILL.md +154 -0
- package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +26 -0
- package/skills/subagent-driven-development/implementer-prompt.md +102 -0
- package/skills/subagent-driven-development/spec-reviewer-prompt.md +61 -0
- package/skills/tdd/SKILL.md +23 -0
- package/skills/using-git-worktrees/SKILL.md +163 -0
- package/skills/using-skills/SKILL.md +95 -0
- package/skills/verification/SKILL.md +22 -0
- package/skills/wazir/SKILL.md +463 -0
- package/skills/writing-plans/SKILL.md +30 -0
- package/skills/writing-skills/SKILL.md +157 -0
- package/skills/writing-skills/anthropic-best-practices.md +122 -0
- package/skills/writing-skills/persuasion-principles.md +50 -0
- package/templates/README.md +20 -0
- package/templates/artifacts/README.md +10 -0
- package/templates/artifacts/accepted-learning.md +19 -0
- package/templates/artifacts/accepted-learning.template.json +12 -0
- package/templates/artifacts/author.md +74 -0
- package/templates/artifacts/author.template.json +19 -0
- package/templates/artifacts/clarification.md +21 -0
- package/templates/artifacts/clarification.template.json +12 -0
- package/templates/artifacts/execute-notes.md +19 -0
- package/templates/artifacts/implementation-plan.md +21 -0
- package/templates/artifacts/implementation-plan.template.json +11 -0
- package/templates/artifacts/learning-proposal.md +19 -0
- package/templates/artifacts/next-run-handoff.md +21 -0
- package/templates/artifacts/plan-review.md +19 -0
- package/templates/artifacts/proposed-learning.template.json +12 -0
- package/templates/artifacts/research.md +21 -0
- package/templates/artifacts/research.template.json +12 -0
- package/templates/artifacts/review-findings.md +19 -0
- package/templates/artifacts/review.template.json +11 -0
- package/templates/artifacts/run-manifest.template.json +8 -0
- package/templates/artifacts/spec-challenge.md +19 -0
- package/templates/artifacts/spec-challenge.template.json +11 -0
- package/templates/artifacts/spec.md +21 -0
- package/templates/artifacts/spec.template.json +12 -0
- package/templates/artifacts/verification-proof.md +19 -0
- package/templates/artifacts/verification-proof.template.json +11 -0
- package/templates/examples/accepted-learning.example.json +14 -0
- package/templates/examples/author.example.json +152 -0
- package/templates/examples/clarification.example.json +15 -0
- package/templates/examples/docs-claim.example.json +8 -0
- package/templates/examples/export-manifest.example.json +7 -0
- package/templates/examples/host-export-package.example.json +11 -0
- package/templates/examples/implementation-plan.example.json +17 -0
- package/templates/examples/proposed-learning.example.json +13 -0
- package/templates/examples/research.example.json +15 -0
- package/templates/examples/research.example.md +6 -0
- package/templates/examples/review.example.json +17 -0
- package/templates/examples/run-manifest.example.json +9 -0
- package/templates/examples/spec-challenge.example.json +14 -0
- package/templates/examples/spec.example.json +21 -0
- package/templates/examples/verification-proof.example.json +21 -0
- package/templates/examples/wazir-manifest.example.yaml +65 -0
- package/templates/task-definition-schema.md +99 -0
- package/tooling/README.md +20 -0
- package/tooling/src/adapters/context-mode.js +50 -0
- package/tooling/src/capture/command.js +376 -0
- package/tooling/src/capture/store.js +99 -0
- package/tooling/src/capture/usage.js +270 -0
- package/tooling/src/checks/branches.js +50 -0
- package/tooling/src/checks/brand-truth.js +110 -0
- package/tooling/src/checks/changelog.js +231 -0
- package/tooling/src/checks/command-registry.js +36 -0
- package/tooling/src/checks/commits.js +102 -0
- package/tooling/src/checks/docs-drift.js +103 -0
- package/tooling/src/checks/docs-truth.js +201 -0
- package/tooling/src/checks/runtime-surface.js +156 -0
- package/tooling/src/cli.js +116 -0
- package/tooling/src/command-options.js +56 -0
- package/tooling/src/commands/validate.js +320 -0
- package/tooling/src/doctor/command.js +91 -0
- package/tooling/src/export/command.js +77 -0
- package/tooling/src/export/compiler.js +498 -0
- package/tooling/src/guards/loop-cap-guard.js +52 -0
- package/tooling/src/guards/protected-path-write-guard.js +67 -0
- package/tooling/src/index/command.js +152 -0
- package/tooling/src/index/storage.js +1061 -0
- package/tooling/src/index/summarizers.js +261 -0
- package/tooling/src/loaders.js +18 -0
- package/tooling/src/project-root.js +22 -0
- package/tooling/src/recall/command.js +225 -0
- package/tooling/src/schema-validator.js +30 -0
- package/tooling/src/state-root.js +40 -0
- package/tooling/src/status/command.js +71 -0
- package/wazir.manifest.yaml +135 -0
- package/workflows/README.md +19 -0
- package/workflows/author.md +42 -0
- package/workflows/clarify.md +38 -0
- package/workflows/design-review.md +46 -0
- package/workflows/design.md +44 -0
- package/workflows/discover.md +37 -0
- package/workflows/execute.md +48 -0
- package/workflows/learn.md +38 -0
- package/workflows/plan-review.md +42 -0
- package/workflows/plan.md +39 -0
- package/workflows/prepare-next.md +37 -0
- package/workflows/review.md +40 -0
- package/workflows/run-audit.md +41 -0
- package/workflows/spec-challenge.md +41 -0
- package/workflows/specify.md +38 -0
- package/workflows/verify.md +37 -0
|
@@ -0,0 +1,804 @@
|
|
|
1
|
+
# API Design — gRPC — Architecture Expertise Module
|
|
2
|
+
|
|
3
|
+
> gRPC is a high-performance RPC framework using Protocol Buffers for serialization and HTTP/2 for transport. It is the optimal choice for internal service-to-service communication where performance, type safety, and streaming matter, but poorly suited for browser clients and public-facing APIs where developer discoverability and tooling maturity are paramount.
|
|
4
|
+
|
|
5
|
+
> **Category:** Integration
|
|
6
|
+
> **Complexity:** Moderate
|
|
7
|
+
> **Applies when:** Internal service-to-service communication in microservices, high-performance APIs, streaming data pipelines, polyglot service environments requiring type-safe contracts
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## What This Is (and What It Isn't)
|
|
12
|
+
|
|
13
|
+
### The RPC Paradigm
|
|
14
|
+
|
|
15
|
+
gRPC is a **Remote Procedure Call** framework, not a resource-oriented architecture. This is a fundamentally different mental model from REST. In REST, you think in nouns: `GET /users/42`, `POST /orders`. In gRPC, you think in verbs: `GetUser(GetUserRequest)`, `CreateOrder(CreateOrderRequest)`. The client calls a method on a remote server as if it were a local function call. The framework handles serialization, transport, and deserialization transparently.
|
|
16
|
+
|
|
17
|
+
Google created the general-purpose RPC infrastructure **Stubby** around 2001 to connect microservices across its data centers. By 2015, Google open-sourced the next generation as gRPC. Nearly all of Google's internal APIs run on this lineage. The "g" has no fixed meaning — it changes with each release (Google, good, green, groovy, etc.).
|
|
18
|
+
|
|
19
|
+
### The Three Pillars
|
|
20
|
+
|
|
21
|
+
**Protocol Buffers (protobuf)** — The serialization format. You define your data structures and service interfaces in `.proto` files using a language-neutral schema definition language. The `protoc` compiler generates strongly-typed client and server code in your target language. Protobuf uses a binary wire format that is roughly 3x smaller than equivalent JSON and significantly faster to parse. Field identification uses integer tags rather than string keys, which is why protobuf payloads are compact but not human-readable.
|
|
22
|
+
|
|
23
|
+
**HTTP/2** — The transport layer. HTTP/2 provides multiplexed streams over a single TCP connection, header compression (HPACK), and full-duplex communication. gRPC leverages all of these: multiple RPC calls can share one connection without head-of-line blocking at the application layer, metadata is compressed efficiently, and both client and server can push data simultaneously. This is a hard dependency — gRPC cannot run over HTTP/1.1 (gRPC-Web works around this, discussed later).
|
|
24
|
+
|
|
25
|
+
**Code Generation** — The developer experience. From a single `.proto` file, the toolchain generates idiomatic client stubs and server interfaces in Go, Java, Python, C++, C#, Node.js, Ruby, Dart, Kotlin, Swift, and others. The generated code handles serialization, connection management, and error propagation. Teams write business logic against generated interfaces, not raw HTTP handlers.
|
|
26
|
+
|
|
27
|
+
### The Four Communication Patterns
|
|
28
|
+
|
|
29
|
+
gRPC supports four RPC types, each matching different interaction needs:
|
|
30
|
+
|
|
31
|
+
**Unary RPC** — One request, one response. The classic request-response pattern. The client sends a single `Request` message and receives a single `Response` message. This covers 80%+ of service-to-service calls: fetching a user, creating an order, validating a token.
|
|
32
|
+
|
|
33
|
+
**Server Streaming RPC** — One request, stream of responses. The client sends a single request and receives a stream of messages back. The server writes messages until it signals completion. Use cases: downloading a large dataset in chunks, subscribing to a feed of updates, streaming search results as they become available.
|
|
34
|
+
|
|
35
|
+
**Client Streaming RPC** — Stream of requests, one response. The client sends a stream of messages and receives a single response when done. Use cases: uploading a file in chunks, sending a batch of sensor readings, aggregating client-side events.
|
|
36
|
+
|
|
37
|
+
**Bidirectional Streaming RPC** — Stream of requests, stream of responses. Both sides send streams of messages independently. The two streams operate independently — the client and server can read and write in any order. Use cases: real-time chat, collaborative editing, ride-hailing location tracking where the driver streams GPS coordinates and the server streams trip cost updates.
|
|
38
|
+
|
|
39
|
+
### What gRPC Is Not
|
|
40
|
+
|
|
41
|
+
**Not REST with different encoding.** REST is resource-oriented with uniform interface constraints (GET, PUT, DELETE on URIs). gRPC is procedure-oriented with custom method signatures. They solve different design problems. Trying to design gRPC services "like REST" — defining `GetResource`, `UpdateResource`, `DeleteResource` for every entity — misses the point. gRPC services should model operations, not resources.
|
|
42
|
+
|
|
43
|
+
**Not a replacement for all HTTP APIs.** gRPC excels at internal machine-to-machine communication. It is a poor fit for APIs consumed directly by web browsers, third-party developers, or systems where human-readable payloads and curl-ability matter.
|
|
44
|
+
|
|
45
|
+
**Not inherently simpler than REST.** The code generation and type safety reduce runtime errors, but the tooling setup (protoc, plugins, buf), schema management, and binary debugging add complexity that REST/JSON avoids entirely.
|
|
46
|
+
|
|
47
|
+
**Not a message queue.** gRPC streaming provides real-time data flow over persistent connections, but it does not provide message durability, replay, fan-out, or backpressure in the way Kafka, RabbitMQ, or NATS do. If a consumer disconnects, messages are lost unless the application builds its own replay logic.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## When to Use It
|
|
52
|
+
|
|
53
|
+
### The Qualifying Conditions
|
|
54
|
+
|
|
55
|
+
Apply gRPC when **two or more** of these are true:
|
|
56
|
+
|
|
57
|
+
**Internal service-to-service communication.** This is the primary use case. When services talk to each other within a controlled infrastructure — same data center, same Kubernetes cluster, same VPC — gRPC's binary protocol, connection reuse, and type-safe contracts provide substantial advantages over REST/JSON. Google, Netflix, Uber, Dropbox, Square, Spotify, Cisco, LinkedIn, Datadog, and CockroachDB all use gRPC for internal service communication at scale.
|
|
58
|
+
|
|
59
|
+
**High-throughput, low-latency requirements.** Benchmarks consistently show gRPC delivering 2.5x to 10x higher throughput than equivalent REST/JSON endpoints, depending on payload size. For small payloads (~1 KB), the improvement is approximately 5.5x. For larger payloads (~1 MB), gRPC achieves roughly 10x throughput improvement. Latency measurements show REST averaging ~250ms where gRPC delivers ~25ms for equivalent operations. The protobuf payload is approximately one-third the size of the same data in JSON. gRPC keeps TCP connections alive across requests, avoiding the overhead of repeated connection establishment that REST incurs.
|
|
60
|
+
|
|
61
|
+
**Polyglot service environment.** When your microservices are written in Go, Java, Python, and Node.js, maintaining consistent API contracts across languages is a real problem. A single `.proto` file generates type-safe client and server code for all languages. The contract is enforced at compile time, not at runtime through documentation and hope. Square replaced their custom RPC solution with gRPC specifically because of its open support for multiple platforms.
|
|
62
|
+
|
|
63
|
+
**Streaming data requirements.** If your system needs real-time data flow — location tracking, live dashboards, sensor data ingestion, event streaming — gRPC's native streaming support is substantially simpler than bolting WebSocket or SSE onto a REST API. The streaming is defined in the proto schema, type-safe, and works identically across all supported languages.
|
|
64
|
+
|
|
65
|
+
**Strong contract enforcement.** In organizations where API contract breakage causes production incidents, protobuf's schema evolution rules provide compile-time and tooling-level guarantees that REST/JSON cannot match. Tools like `buf breaking` detect backward-incompatible changes before they merge.
|
|
66
|
+
|
|
67
|
+
### Real-World Contexts Where This Pays Off
|
|
68
|
+
|
|
69
|
+
**Netflix** uses gRPC to manage service-to-service communication across its microservice-heavy architecture. Their migration to gRPC improved performance of high-throughput systems including playback and metadata services. The type-safe contracts reduced a class of runtime integration errors that were common with their previous REST-based approach.
|
|
70
|
+
|
|
71
|
+
**Square** collaborated directly with Google to replace all uses of their custom RPC solution with gRPC. The demonstrated performance of the protocol and the ability to customize and adapt it to their network requirements were cited as primary motivations.
|
|
72
|
+
|
|
73
|
+
**Datadog** runs a large gRPC mesh for internal service communication. Their engineering blog documents the operational lessons of running gRPC at scale, including load balancing challenges and the importance of proper deadline propagation.
|
|
74
|
+
|
|
75
|
+
**Ride-hailing applications** (Uber, Lyft) use bidirectional streaming for real-time location tracking. The driver's app streams GPS coordinates to the server; the server streams back trip cost estimates, route updates, and rider information. This interaction pattern maps naturally to gRPC bidirectional streaming.
|
|
76
|
+
|
|
77
|
+
**Financial systems** use gRPC for low-latency trade execution, real-time price feeds (server streaming), and order submission pipelines where microseconds matter and type-safe contracts prevent costly data parsing errors.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## When NOT to Use It
|
|
82
|
+
|
|
83
|
+
This section is as important as the previous one. gRPC is frequently adopted as a blanket replacement for REST without evaluating whether the trade-offs are appropriate, producing debugging friction, tooling gaps, and justified frustration.
|
|
84
|
+
|
|
85
|
+
### The Disqualifying Conditions
|
|
86
|
+
|
|
87
|
+
**Browser clients without a proxy layer.** It is not possible to directly call a gRPC service from a browser. Browsers do not provide the level of control over HTTP/2 required to support a gRPC client. gRPC-Web exists as a workaround but requires either a translating proxy (Envoy, Caddy) or use of Connect-RPC, which adds infrastructure complexity. gRPC-Web also does not support client streaming or bidirectional streaming from browsers — only unary and server streaming are available. If your primary consumers are web browsers, REST or GraphQL are simpler and more capable choices.
|
|
88
|
+
|
|
89
|
+
**Public APIs needing developer discoverability.** Third-party developers expect to explore an API with curl, Postman, or a browser. They expect human-readable JSON responses, self-documenting error messages, and the ability to test endpoints without installing a code generation toolchain. gRPC's binary protocol, required proto files, and specialized tooling (grpcurl, Buf Studio, BloomRPC) create a barrier to entry that is inappropriate for public developer ecosystems. Every major public API — Stripe, Twilio, GitHub, AWS — uses REST or GraphQL for its external interface, even when the internal implementation runs on gRPC.
|
|
90
|
+
|
|
91
|
+
**Simple CRUD applications with thin logic.** If your service is fundamentally reading rows, writing rows, and returning them — with no streaming, no polyglot requirements, and no extreme performance demands — gRPC adds setup complexity (protoc, code generation pipelines, proto file management) without proportional benefit. A REST/JSON API with OpenAPI documentation serves this use case with less friction.
|
|
92
|
+
|
|
93
|
+
**Small teams with limited infrastructure expertise.** gRPC requires teams to manage proto file repositories, code generation pipelines, HTTP/2-aware load balancers, and binary debugging tools. A team of three developers building a monolithic application does not benefit from this overhead. REST frameworks (Express, FastAPI, Spring Boot) provide a dramatically simpler path from zero to working API.
|
|
94
|
+
|
|
95
|
+
**Debugging and observability are critical and tooling is immature.** Binary payloads are not human-readable. You cannot inspect a gRPC call with browser DevTools, read it in access logs, or paste it into a curl command. Every debugging session requires decoding protobuf payloads into JSON or another readable format, which requires access to the `.proto` files. Teams accustomed to `curl | jq` workflows will experience significant friction. The ecosystem of debugging tools exists (grpcurl, gRPC reflection, Buf Studio) but is substantially less mature than REST/JSON tooling.
|
|
96
|
+
|
|
97
|
+
**Integration with legacy systems expecting HTTP/1.1.** Many enterprise systems, API gateways, CDNs, and WAFs are designed for HTTP/1.1 with JSON payloads. Introducing gRPC into an environment where the network infrastructure does not support HTTP/2 end-to-end creates proxy translation layers and operational complexity that negates the performance benefits.
|
|
98
|
+
|
|
99
|
+
### The "Just Use REST" Test
|
|
100
|
+
|
|
101
|
+
If **all** of the following are true, gRPC is adding complexity without commensurate value:
|
|
102
|
+
|
|
103
|
+
- Your consumers are web browsers or third-party developers
|
|
104
|
+
- You have fewer than 10 services communicating
|
|
105
|
+
- Your latency requirements are above 50ms
|
|
106
|
+
- You are using a single programming language
|
|
107
|
+
- You have no streaming requirements
|
|
108
|
+
- Your team has no prior gRPC experience
|
|
109
|
+
|
|
110
|
+
In this scenario, REST/JSON with OpenAPI documentation will serve you better with a fraction of the setup cost.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## How It Works
|
|
115
|
+
|
|
116
|
+
### Protocol Buffer Definition
|
|
117
|
+
|
|
118
|
+
Everything starts with the `.proto` file. This is the contract — the single source of truth for your API:
|
|
119
|
+
|
|
120
|
+
```protobuf
|
|
121
|
+
syntax = "proto3";
|
|
122
|
+
|
|
123
|
+
package order.v1;
|
|
124
|
+
|
|
125
|
+
option go_package = "github.com/myorg/order/v1;orderv1";
|
|
126
|
+
|
|
127
|
+
// Service definition — the verbs
|
|
128
|
+
service OrderService {
|
|
129
|
+
// Unary — one request, one response
|
|
130
|
+
rpc CreateOrder(CreateOrderRequest) returns (CreateOrderResponse);
|
|
131
|
+
rpc GetOrder(GetOrderRequest) returns (Order);
|
|
132
|
+
|
|
133
|
+
// Server streaming — subscribe to order status updates
|
|
134
|
+
rpc WatchOrderStatus(WatchOrderStatusRequest) returns (stream OrderStatusUpdate);
|
|
135
|
+
|
|
136
|
+
// Client streaming — batch upload line items
|
|
137
|
+
rpc UploadLineItems(stream LineItem) returns (UploadLineItemsResponse);
|
|
138
|
+
|
|
139
|
+
// Bidirectional streaming — live order negotiation
|
|
140
|
+
rpc NegotiateOrder(stream NegotiationMessage) returns (stream NegotiationMessage);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Message definitions — the nouns
|
|
144
|
+
message CreateOrderRequest {
|
|
145
|
+
string customer_id = 1;
|
|
146
|
+
repeated LineItem items = 2;
|
|
147
|
+
Address shipping_address = 3;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
message CreateOrderResponse {
|
|
151
|
+
string order_id = 1;
|
|
152
|
+
google.protobuf.Timestamp created_at = 2;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
message Order {
|
|
156
|
+
string order_id = 1;
|
|
157
|
+
string customer_id = 2;
|
|
158
|
+
repeated LineItem items = 3;
|
|
159
|
+
OrderStatus status = 4;
|
|
160
|
+
google.protobuf.Timestamp created_at = 5;
|
|
161
|
+
google.protobuf.Timestamp updated_at = 6;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
message LineItem {
|
|
165
|
+
string product_id = 1;
|
|
166
|
+
int32 quantity = 2;
|
|
167
|
+
int64 price_cents = 3; // Use integers for money, never floats
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
enum OrderStatus {
|
|
171
|
+
ORDER_STATUS_UNSPECIFIED = 0; // Always have a zero-value default
|
|
172
|
+
ORDER_STATUS_PENDING = 1;
|
|
173
|
+
ORDER_STATUS_CONFIRMED = 2;
|
|
174
|
+
ORDER_STATUS_SHIPPED = 3;
|
|
175
|
+
ORDER_STATUS_DELIVERED = 4;
|
|
176
|
+
ORDER_STATUS_CANCELLED = 5;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
message Address {
|
|
180
|
+
string street = 1;
|
|
181
|
+
string city = 2;
|
|
182
|
+
string state = 3;
|
|
183
|
+
string zip_code = 4;
|
|
184
|
+
string country = 5;
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Code Generation Pipeline
|
|
189
|
+
|
|
190
|
+
The `protoc` compiler (or modern alternatives like `buf generate`) processes `.proto` files and produces language-specific code:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
# Traditional protoc approach
|
|
194
|
+
protoc --go_out=. --go-grpc_out=. proto/order/v1/order.proto
|
|
195
|
+
|
|
196
|
+
# Modern buf approach (recommended)
|
|
197
|
+
buf generate proto/order/v1
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
The generated code includes:
|
|
201
|
+
- **Server interfaces** — abstract methods your service must implement
|
|
202
|
+
- **Client stubs** — ready-to-use clients with type-safe method signatures
|
|
203
|
+
- **Message types** — structs/classes for every message with serialization built in
|
|
204
|
+
- **Marshaling/unmarshaling** — binary encoding/decoding handled transparently
|
|
205
|
+
|
|
206
|
+
### Channel and Stub Model
|
|
207
|
+
|
|
208
|
+
gRPC clients communicate through **channels** — abstracted connections to a server endpoint. A channel handles connection establishment, reconnection, load balancing, and multiplexing. You create a channel once and reuse it for the lifetime of your application.
|
|
209
|
+
|
|
210
|
+
**Stubs** are generated client wrappers that use a channel to make RPC calls. There are typically two flavors: blocking (synchronous) and async (non-blocking/future-based).
|
|
211
|
+
|
|
212
|
+
```go
|
|
213
|
+
// Go server implementation
|
|
214
|
+
type orderServer struct {
|
|
215
|
+
orderv1.UnimplementedOrderServiceServer
|
|
216
|
+
store OrderStore
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
func (s *orderServer) CreateOrder(
|
|
220
|
+
ctx context.Context,
|
|
221
|
+
req *orderv1.CreateOrderRequest,
|
|
222
|
+
) (*orderv1.CreateOrderResponse, error) {
|
|
223
|
+
// Validate
|
|
224
|
+
if req.CustomerId == "" {
|
|
225
|
+
return nil, status.Error(codes.InvalidArgument, "customer_id is required")
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// Business logic
|
|
229
|
+
order, err := s.store.Create(ctx, req)
|
|
230
|
+
if err != nil {
|
|
231
|
+
return nil, status.Errorf(codes.Internal, "failed to create order: %v", err)
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
return &orderv1.CreateOrderResponse{
|
|
235
|
+
OrderId: order.ID,
|
|
236
|
+
CreatedAt: timestamppb.Now(),
|
|
237
|
+
}, nil
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Server streaming implementation
|
|
241
|
+
func (s *orderServer) WatchOrderStatus(
|
|
242
|
+
req *orderv1.WatchOrderStatusRequest,
|
|
243
|
+
stream orderv1.OrderService_WatchOrderStatusServer,
|
|
244
|
+
) error {
|
|
245
|
+
for update := range s.store.Subscribe(req.OrderId) {
|
|
246
|
+
if err := stream.Send(update); err != nil {
|
|
247
|
+
return err
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return nil
|
|
251
|
+
}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
```go
|
|
255
|
+
// Go client usage
|
|
256
|
+
conn, err := grpc.Dial("order-service:50051",
|
|
257
|
+
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
|
258
|
+
grpc.WithUnaryInterceptor(otelgrpc.UnaryClientInterceptor()),
|
|
259
|
+
)
|
|
260
|
+
if err != nil {
|
|
261
|
+
log.Fatalf("failed to connect: %v", err)
|
|
262
|
+
}
|
|
263
|
+
defer conn.Close()
|
|
264
|
+
|
|
265
|
+
client := orderv1.NewOrderServiceClient(conn)
|
|
266
|
+
|
|
267
|
+
// Unary call with deadline
|
|
268
|
+
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
|
269
|
+
defer cancel()
|
|
270
|
+
|
|
271
|
+
resp, err := client.CreateOrder(ctx, &orderv1.CreateOrderRequest{
|
|
272
|
+
CustomerId: "cust-123",
|
|
273
|
+
Items: []*orderv1.LineItem{
|
|
274
|
+
{ProductId: "prod-456", Quantity: 2, PriceCents: 1999},
|
|
275
|
+
},
|
|
276
|
+
})
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Interceptors (Middleware)
|
|
280
|
+
|
|
281
|
+
gRPC interceptors are the equivalent of HTTP middleware. They wrap RPC calls to add cross-cutting concerns: logging, authentication, metrics, tracing, rate limiting.
|
|
282
|
+
|
|
283
|
+
```go
|
|
284
|
+
// Unary server interceptor for logging
|
|
285
|
+
func loggingInterceptor(
|
|
286
|
+
ctx context.Context,
|
|
287
|
+
req interface{},
|
|
288
|
+
info *grpc.UnaryServerInfo,
|
|
289
|
+
handler grpc.UnaryHandler,
|
|
290
|
+
) (interface{}, error) {
|
|
291
|
+
start := time.Now()
|
|
292
|
+
resp, err := handler(ctx, req)
|
|
293
|
+
duration := time.Since(start)
|
|
294
|
+
|
|
295
|
+
log.Printf("method=%s duration=%s error=%v",
|
|
296
|
+
info.FullMethod, duration, err)
|
|
297
|
+
return resp, err
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// Chain multiple interceptors
|
|
301
|
+
server := grpc.NewServer(
|
|
302
|
+
grpc.ChainUnaryInterceptor(
|
|
303
|
+
authInterceptor,
|
|
304
|
+
loggingInterceptor,
|
|
305
|
+
metricsInterceptor,
|
|
306
|
+
recoveryInterceptor,
|
|
307
|
+
),
|
|
308
|
+
grpc.ChainStreamInterceptor(
|
|
309
|
+
streamAuthInterceptor,
|
|
310
|
+
streamLoggingInterceptor,
|
|
311
|
+
),
|
|
312
|
+
)
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### Deadline Propagation
|
|
316
|
+
|
|
317
|
+
Deadlines are one of the most important reliability patterns in gRPC. Unlike traditional timeouts that apply to a single network hop, gRPC deadlines propagate across service boundaries. A deadline set by the initial caller travels through your entire microservice chain, ensuring that no downstream service wastes resources on a request that has already timed out upstream.
|
|
318
|
+
|
|
319
|
+
```
|
|
320
|
+
Client (deadline=5s) → Service A (4.8s remaining) → Service B (4.2s remaining) → Service C
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
If Service C receives a request with 0.3s remaining, it can immediately return `DEADLINE_EXCEEDED` rather than starting expensive work that the caller has already abandoned. In Go and Java, deadline propagation is enabled by default when you pass the incoming context to outgoing calls.
|
|
324
|
+
|
|
325
|
+
**Best practice: always set a deadline.** A missing deadline means a failed server can cause a client to hang indefinitely, which cascades into resource exhaustion across the call chain.
|
|
326
|
+
|
|
327
|
+
### Error Model and Status Codes
|
|
328
|
+
|
|
329
|
+
gRPC defines 16 canonical status codes (compared to HTTP's ~70). Each code has specific semantics:
|
|
330
|
+
|
|
331
|
+
| Code | Name | When to Use |
|
|
332
|
+
|---|---|---|
|
|
333
|
+
| 0 | `OK` | Success |
|
|
334
|
+
| 1 | `CANCELLED` | Client cancelled the request |
|
|
335
|
+
| 2 | `UNKNOWN` | Unknown error (avoid overusing — be specific) |
|
|
336
|
+
| 3 | `INVALID_ARGUMENT` | Client sent bad input |
|
|
337
|
+
| 4 | `DEADLINE_EXCEEDED` | Operation timed out |
|
|
338
|
+
| 5 | `NOT_FOUND` | Requested entity does not exist |
|
|
339
|
+
| 6 | `ALREADY_EXISTS` | Entity already exists (e.g., duplicate create) |
|
|
340
|
+
| 7 | `PERMISSION_DENIED` | Caller lacks permission (authenticated but unauthorized) |
|
|
341
|
+
| 8 | `RESOURCE_EXHAUSTED` | Rate limit exceeded, quota exhausted |
|
|
342
|
+
| 9 | `FAILED_PRECONDITION` | System not in required state for operation |
|
|
343
|
+
| 10 | `ABORTED` | Concurrency conflict (e.g., read-modify-write conflict) |
|
|
344
|
+
| 11 | `OUT_OF_RANGE` | Operation attempted past valid range |
|
|
345
|
+
| 12 | `UNIMPLEMENTED` | Method not implemented |
|
|
346
|
+
| 13 | `INTERNAL` | Internal server error |
|
|
347
|
+
| 14 | `UNAVAILABLE` | Service is temporarily unavailable (safe to retry) |
|
|
348
|
+
| 15 | `DATA_LOSS` | Unrecoverable data loss or corruption |
|
|
349
|
+
| 16 | `UNAUTHENTICATED` | Missing or invalid authentication credentials |
|
|
350
|
+
|
|
351
|
+
**Rich error details:** gRPC supports attaching structured error details beyond the status code and message. Use `google.rpc.Status` with `google.rpc.ErrorInfo`, `google.rpc.BadRequest`, `google.rpc.RetryInfo` to communicate specific failure information to clients.
|
|
352
|
+
|
|
353
|
+
### Load Balancing
|
|
354
|
+
|
|
355
|
+
gRPC's persistent HTTP/2 connections create a load balancing challenge. A standard Layer 4 (TCP) load balancer distributes connections, not requests — once a connection is established, all RPCs on that connection go to the same backend. With long-lived gRPC connections, this produces severe imbalance.
|
|
356
|
+
|
|
357
|
+
**Proxy-based (L7) load balancing:** A Layer 7 proxy (Envoy, Linkerd, Istio) understands the gRPC protocol and distributes individual RPCs across backends. The proxy maintains connections to all backends and routes each RPC independently. This is the simplest approach but adds a network hop and a single point of failure.
|
|
358
|
+
|
|
359
|
+
**Client-side load balancing:** The client is aware of multiple backends and selects one per RPC. The client gets endpoint lists from a service registry (DNS, Consul, etcd, xDS) and implements the load balancing algorithm locally. This eliminates the proxy hop but distributes health checking to every client — 500 clients checking 20 instances every 5 seconds produces 2,000 probe requests per second before any real traffic.
|
|
360
|
+
|
|
361
|
+
**Hybrid approach (common at scale):** Proxy-based load balancing at the ingress layer for external traffic; client-side load balancing for internal service-to-service calls where the client library can be standardized. Google Cloud's Service Mesh uses xDS APIs to configure gRPC applications directly for proxyless service mesh with endpoint discovery, load balancing, regional failover, and health checks.
|
|
362
|
+
|
|
363
|
+
### Health Checking and Reflection
|
|
364
|
+
|
|
365
|
+
gRPC provides a standard health checking protocol (`grpc.health.v1.Health`) that load balancers and orchestrators (Kubernetes) can use to determine service readiness. Implement it — without it, Kubernetes liveness probes require custom HTTP endpoints alongside your gRPC server.
|
|
366
|
+
|
|
367
|
+
gRPC Server Reflection allows clients to discover available services and methods at runtime without access to `.proto` files. This is essential for debugging tools like `grpcurl` and should be enabled in development/staging but typically disabled in production for security.
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## Trade-Offs Matrix
|
|
372
|
+
|
|
373
|
+
| Dimension | gRPC Advantage | gRPC Cost | Severity |
|
|
374
|
+
|---|---|---|---|
|
|
375
|
+
| **Serialization performance** | Binary protobuf is 3-10x faster to serialize/deserialize than JSON. Payloads are ~3x smaller. | Binary payloads are not human-readable. Every debugging session requires decoding tools. | High — this is the primary performance driver but the primary debugging obstacle |
|
|
376
|
+
| **Type safety** | Compile-time contract enforcement across all languages. Breaking changes caught before deployment. | Requires learning protobuf IDL, managing proto repositories, running code generation pipelines. | Moderate — one-time learning cost vs. ongoing safety benefit |
|
|
377
|
+
| **Streaming** | Native, type-safe, bidirectional streaming defined in the schema. Works identically across all languages. | Streaming adds complexity: backpressure management, reconnection logic, partial failure handling, resource cleanup. | High — streaming is powerful but the most common source of production bugs |
|
|
378
|
+
| **HTTP/2 transport** | Multiplexed connections, header compression, full-duplex. Single connection handles thousands of concurrent RPCs. | Requires HTTP/2-aware infrastructure. L4 load balancers break. Some proxies, CDNs, and WAFs do not support HTTP/2 end-to-end. | High — infrastructure that "just works" with REST may require changes for gRPC |
|
|
379
|
+
| **Code generation** | Eliminates hand-written client code, ensures client-server consistency, provides IDE autocompletion. | Adds a build step. Proto file changes require regenerating and recompiling consumers. CI/CD pipelines must include codegen. | Moderate — automation eliminates most friction after initial setup |
|
|
380
|
+
| **Browser support** | N/A — gRPC does not work in browsers natively. | Requires gRPC-Web proxy or Connect-RPC. No client/bidirectional streaming from browsers. Adds infrastructure and limits streaming. | Critical — this is a hard blocker for browser-first applications |
|
|
381
|
+
| **Tooling ecosystem** | Growing ecosystem: grpcurl, Buf Studio, BloomRPC, Postman gRPC support, Evans CLI. | Substantially less mature than REST tooling. No curl equivalent. No browser DevTools integration. | Moderate — improving yearly but still behind REST |
|
|
382
|
+
| **Contract evolution** | Protobuf's field numbering system enables backward/forward compatible schema changes with defined rules. | Requires discipline: never reuse field numbers, never change wire types, use `reserved` keyword. Breaking changes are silent if rules are violated. | Moderate — the rules are simple but the consequences of violating them are severe |
|
|
383
|
+
| **Latency** | Eliminates connection overhead (persistent connections), binary parsing is faster, header compression reduces per-request overhead. | First-connection latency is higher (HTTP/2 negotiation, TLS handshake). Benefits manifest on subsequent requests over the same connection. | Low — the initial connection cost is amortized over thousands of RPCs |
|
|
384
|
+
| **Observability** | Standard interceptor pattern makes it easy to add tracing (OpenTelemetry), metrics (Prometheus), and logging uniformly. | Binary payloads make access log inspection harder. Request/response logging requires custom interceptors with proto-to-JSON conversion. | Moderate — structured observability is good but ad-hoc debugging is harder |
|
|
385
|
+
|
|
386
|
+
---
|
|
387
|
+
|
|
388
|
+
## Schema Evolution and Versioning
|
|
389
|
+
|
|
390
|
+
### Safe Changes (Backward and Forward Compatible)
|
|
391
|
+
|
|
392
|
+
- **Adding new fields** with new field numbers — old clients ignore unknown fields, new clients use defaults for missing fields
|
|
393
|
+
- **Adding new enum values** — old clients treat unknown values as the default (0) value
|
|
394
|
+
- **Adding new RPC methods** — old clients never call them, new clients can
|
|
395
|
+
- **Adding new services** — no impact on existing consumers
|
|
396
|
+
- **Renaming fields** — protobuf uses field numbers on the wire, not names (but regenerated code will have new accessor names)
|
|
397
|
+
|
|
398
|
+
### Dangerous Changes (Breaking)
|
|
399
|
+
|
|
400
|
+
- **Changing a field number** — this silently corrupts data because old messages decode into wrong fields
|
|
401
|
+
- **Changing a field's wire type** — e.g., `int32` to `string`. The decoder interprets the bytes incorrectly
|
|
402
|
+
- **Removing a field without reserving its number** — a future developer may reuse the number, causing silent corruption
|
|
403
|
+
- **Reordering enum values** — enum values are encoded as integers; changing the mapping breaks everything
|
|
404
|
+
- **Renaming a service or method** — this changes the HTTP/2 path (`/package.Service/Method`), breaking all clients
|
|
405
|
+
|
|
406
|
+
### Best Practices for Schema Evolution
|
|
407
|
+
|
|
408
|
+
```protobuf
|
|
409
|
+
// Reserve removed field numbers and names to prevent reuse
|
|
410
|
+
message Order {
|
|
411
|
+
reserved 6, 8; // Never reuse these field numbers
|
|
412
|
+
reserved "legacy_status"; // Never reuse this field name
|
|
413
|
+
|
|
414
|
+
string order_id = 1;
|
|
415
|
+
// field 6 was removed (was legacy_status)
|
|
416
|
+
// field 8 was removed (was deprecated_field)
|
|
417
|
+
}
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
**Package versioning:** Use versioned packages (`order.v1`, `order.v2`) for breaking changes. Run both versions simultaneously during migration. This is the gRPC equivalent of REST API versioning (`/v1/orders`, `/v2/orders`).
|
|
421
|
+
|
|
422
|
+
**Buf tooling:** Use `buf breaking` to detect backward-incompatible changes in CI. This catches field number reuse, type changes, and removed fields before they reach production.
|
|
423
|
+
|
|
424
|
+
---
|
|
425
|
+
|
|
426
|
+
## Evolution Path
|
|
427
|
+
|
|
428
|
+
### Stage 1: REST/JSON Monolith (Starting Point)
|
|
429
|
+
|
|
430
|
+
Most systems begin here. A single service exposes REST/JSON endpoints. The API contract is defined by documentation (OpenAPI/Swagger) or implicitly by the code. This is appropriate and should not be prematurely replaced.
|
|
431
|
+
|
|
432
|
+
### Stage 2: Internal gRPC, External REST
|
|
433
|
+
|
|
434
|
+
As the monolith splits into services, internal communication moves to gRPC for performance and type safety. A gateway (Envoy, Kong, gRPC-Gateway) translates between external REST/JSON and internal gRPC. The `.proto` files become the single source of truth, with REST endpoints generated from proto annotations.
|
|
435
|
+
|
|
436
|
+
```protobuf
|
|
437
|
+
import "google/api/annotations.proto";
|
|
438
|
+
|
|
439
|
+
service OrderService {
|
|
440
|
+
rpc GetOrder(GetOrderRequest) returns (Order) {
|
|
441
|
+
option (google.api.http) = {
|
|
442
|
+
get: "/v1/orders/{order_id}"
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
### Stage 3: Full gRPC Mesh with Service Mesh
|
|
449
|
+
|
|
450
|
+
Internal services communicate exclusively via gRPC. A service mesh (Istio, Linkerd) handles mTLS, load balancing, circuit breaking, and observability. Proto files are managed in a central registry (Buf Schema Registry). Breaking change detection runs in CI.
|
|
451
|
+
|
|
452
|
+
### Stage 4: Hybrid Protocol Strategy
|
|
453
|
+
|
|
454
|
+
Mature architectures use the right protocol for each boundary:
|
|
455
|
+
- **Internal service-to-service:** gRPC (performance, streaming, type safety)
|
|
456
|
+
- **External public API:** REST/JSON (discoverability, tooling, developer experience)
|
|
457
|
+
- **Frontend-to-backend:** GraphQL or REST (flexible querying, browser compatibility)
|
|
458
|
+
- **Real-time client updates:** gRPC-Web/Connect-RPC or WebSocket (depending on streaming needs)
|
|
459
|
+
|
|
460
|
+
---
|
|
461
|
+
|
|
462
|
+
## Failure Modes
|
|
463
|
+
|
|
464
|
+
### 1. The "gRPC Everywhere" Failure
|
|
465
|
+
|
|
466
|
+
**What happens:** A team adopts gRPC for every API surface — including public APIs consumed by third-party developers and browser-based SPAs. Third-party developers cannot test the API with curl. Browser integration requires a gRPC-Web proxy. Documentation is a `.proto` file instead of an interactive API explorer.
|
|
467
|
+
|
|
468
|
+
**Why it fails:** gRPC was designed for machine-to-machine communication in controlled environments. Forcing it into developer-facing and browser-facing roles creates friction that outweighs the performance benefits.
|
|
469
|
+
|
|
470
|
+
**The fix:** Use gRPC internally and expose REST/JSON or GraphQL at the boundary. The gRPC-Gateway project generates REST endpoints from proto annotations, giving you both protocols from a single source of truth.
|
|
471
|
+
|
|
472
|
+
### 2. The "No Deadlines" Failure
|
|
473
|
+
|
|
474
|
+
**What happens:** Services call downstream services without setting deadlines. A slow database query in Service D causes Service C to wait indefinitely, which causes Service B to wait, which causes Service A to wait. All four services accumulate blocked goroutines/threads until they crash.
|
|
475
|
+
|
|
476
|
+
**Why it fails:** Without deadlines, a single slow dependency cascades into system-wide resource exhaustion. gRPC's deadline propagation only works if someone sets the initial deadline.
|
|
477
|
+
|
|
478
|
+
**The fix:** Always set a deadline on every outgoing RPC. Propagate the incoming deadline to outgoing calls (automatic in Go and Java). Monitor `DEADLINE_EXCEEDED` error rates — a spike indicates a downstream service is degrading.
|
|
479
|
+
|
|
480
|
+
### 3. The "L4 Load Balancer" Failure
|
|
481
|
+
|
|
482
|
+
**What happens:** gRPC traffic is routed through a Layer 4 (TCP) load balancer. The load balancer distributes TCP connections, not individual RPCs. Because gRPC multiplexes all RPCs over a single persistent connection, all traffic from one client goes to one backend. With 10 clients and 10 backends, some backends handle 80% of traffic while others idle.
|
|
483
|
+
|
|
484
|
+
**Why it fails:** L4 load balancers were designed for HTTP/1.1 where each connection carries one request. gRPC's HTTP/2 multiplexing breaks this assumption.
|
|
485
|
+
|
|
486
|
+
**The fix:** Use Layer 7 load balancing (Envoy, Linkerd proxy, Kubernetes headless service with client-side balancing) that understands gRPC and distributes at the RPC level.
|
|
487
|
+
|
|
488
|
+
### 4. The "Proto File Chaos" Failure
|
|
489
|
+
|
|
490
|
+
**What happens:** Proto files are duplicated across repositories. Team A's copy of `user.proto` diverges from Team B's copy. Field numbers are reused after removal. Messages are modified in incompatible ways without detection. Deserialization fails silently, producing corrupted data.
|
|
491
|
+
|
|
492
|
+
**Why it fails:** Proto files are a contract — they must be a single source of truth. Duplication is the same failure mode as copying a database schema into every application.
|
|
493
|
+
|
|
494
|
+
**The fix:** Maintain proto files in a dedicated repository or use the Buf Schema Registry. Run `buf lint` and `buf breaking` in CI. Generate and publish language-specific packages from the central proto repository. No service owns its own proto files — the registry does.
|
|
495
|
+
|
|
496
|
+
### 5. The "Streaming Resource Leak" Failure
|
|
497
|
+
|
|
498
|
+
**What happens:** Server streaming or bidirectional streaming RPCs are opened but not properly closed. Client disconnects are not detected. Server-side goroutines/threads accumulate, each holding resources (database connections, memory buffers) for a stream that no one is reading.
|
|
499
|
+
|
|
500
|
+
**Why it fails:** Streaming connections are long-lived. Without proper lifecycle management — context cancellation, keepalive pings, stream termination on error — resources leak slowly until the service degrades.
|
|
501
|
+
|
|
502
|
+
**The fix:** Always respect context cancellation in streaming handlers. Configure keepalive parameters to detect dead connections. Implement server-side timeouts on idle streams. Monitor open stream counts and set alerts on abnormal growth.
|
|
503
|
+
|
|
504
|
+
### 6. The "Unversioned Breaking Change" Failure
|
|
505
|
+
|
|
506
|
+
**What happens:** A team changes a field's type from `int32` to `string` (field number 4) and deploys the server. All clients still sending `int32` on field 4 produce garbage data that the server silently accepts and stores. The corruption is discovered days later in downstream reports.
|
|
507
|
+
|
|
508
|
+
**Why it fails:** Protobuf decodes based on wire type and field number. Changing the type without changing the field number does not produce an error — it produces silently wrong data.
|
|
509
|
+
|
|
510
|
+
**The fix:** Never change the type of an existing field. Deprecate the old field, reserve its number, and add a new field with a new number. Run `buf breaking` in CI to catch these changes automatically.
|
|
511
|
+
|
|
512
|
+
---
|
|
513
|
+
|
|
514
|
+
## Technology Landscape
|
|
515
|
+
|
|
516
|
+
### Core Implementations
|
|
517
|
+
|
|
518
|
+
| Tool | Language | Notes |
|
|
519
|
+
|---|---|---|
|
|
520
|
+
| **grpc-go** | Go | The most widely used implementation. Excellent performance. Native interceptor support. |
|
|
521
|
+
| **grpc-java** | Java/Kotlin | Mature, widely used in enterprise. Integrates with Spring Boot via `grpc-spring-boot-starter`. |
|
|
522
|
+
| **grpc-node** | Node.js | Two variants: `@grpc/grpc-js` (pure JS, recommended) and `grpc` (native C bindings, deprecated). |
|
|
523
|
+
| **grpc-python** | Python | `grpcio` package. Async support via `grpcio` with `asyncio`. |
|
|
524
|
+
| **grpc-dotnet** | C# | First-class support in ASP.NET Core. Best .NET gRPC experience. |
|
|
525
|
+
| **grpc-swift** | Swift | Used for iOS/macOS clients communicating with gRPC backends. |
|
|
526
|
+
| **grpc-dart** | Dart | Used in Flutter applications for backend communication. |
|
|
527
|
+
|
|
528
|
+
### Modern Tooling
|
|
529
|
+
|
|
530
|
+
| Tool | Purpose | Why It Matters |
|
|
531
|
+
|---|---|---|
|
|
532
|
+
| **buf** (buf.build) | Proto linting, breaking change detection, code generation, schema registry | Replaces the fragile `protoc` + plugin workflow. `buf lint` enforces style. `buf breaking` catches incompatible changes. `buf generate` replaces complex protoc invocations. |
|
|
533
|
+
| **Connect-RPC** | gRPC-compatible framework with browser support | Supports gRPC, gRPC-Web, and the Connect protocol. No proxy needed for browser clients. Handlers work with vanilla `net/http`. TypeScript clients integrate with React, Next.js. |
|
|
534
|
+
| **gRPC-Gateway** | REST/JSON to gRPC reverse proxy | Generates a REST API from proto annotations. Allows a single proto definition to serve both REST and gRPC clients. |
|
|
535
|
+
| **grpcurl** | Command-line gRPC client | The `curl` of gRPC. Requires either server reflection or proto files. Essential for debugging. |
|
|
536
|
+
| **Evans** | Interactive gRPC client (REPL) | More interactive than grpcurl. Auto-completes service and method names. |
|
|
537
|
+
| **Buf Studio** | Web-based gRPC client | Browser-based UI for testing gRPC services. Supports all streaming types. |
|
|
538
|
+
| **Kreya** | Desktop gRPC client | GUI client similar to Postman but for gRPC. Supports environments, variables, scripting. |
|
|
539
|
+
|
|
540
|
+
### Connect-RPC: The Modern Alternative
|
|
541
|
+
|
|
542
|
+
Connect-RPC deserves special attention. Built by the Buf team, it addresses gRPC's most significant limitations while maintaining full compatibility:
|
|
543
|
+
|
|
544
|
+
- **Browser support without a proxy:** Connect clients work directly in browsers over HTTP/1.1 or HTTP/2. No Envoy or translation layer required.
|
|
545
|
+
- **Triple-protocol support:** Every Connect handler simultaneously speaks gRPC, gRPC-Web, and the Connect protocol. Existing gRPC clients work unchanged.
|
|
546
|
+
- **Standard HTTP semantics:** Connect RPCs are plain HTTP POST requests with protobuf or JSON bodies. They are debuggable with curl and browser DevTools.
|
|
547
|
+
- **Framework integration:** Go handlers are standard `net/http` handlers — they work with existing routers, middleware, and observability. TypeScript clients integrate with React, Next.js, and standard `fetch`.
|
|
548
|
+
|
|
549
|
+
Connect-RPC is the recommended approach for new projects that need gRPC's benefits (protobuf contracts, streaming, code generation) without its browser and debugging limitations.
|
|
550
|
+
|
|
551
|
+
---
|
|
552
|
+
|
|
553
|
+
## Decision Tree
|
|
554
|
+
|
|
555
|
+
```
|
|
556
|
+
Need an API?
|
|
557
|
+
│
|
|
558
|
+
├─ Consumers are web browsers or third-party developers?
|
|
559
|
+
│ ├─ Yes → Need flexible querying across multiple entities?
|
|
560
|
+
│ │ ├─ Yes → GraphQL
|
|
561
|
+
│ │ └─ No → REST/JSON with OpenAPI
|
|
562
|
+
│ └─ No (internal services only) ↓
|
|
563
|
+
│
|
|
564
|
+
├─ Need bidirectional or client streaming?
|
|
565
|
+
│ ├─ Yes → gRPC (only option with type-safe streaming)
|
|
566
|
+
│ │ Consider Connect-RPC if browser clients also needed
|
|
567
|
+
│ └─ No ↓
|
|
568
|
+
│
|
|
569
|
+
├─ Performance-critical? (sub-10ms latency, >10K RPS)
|
|
570
|
+
│ ├─ Yes → gRPC
|
|
571
|
+
│ └─ No ↓
|
|
572
|
+
│
|
|
573
|
+
├─ Polyglot services needing type-safe contracts?
|
|
574
|
+
│ ├─ Yes → gRPC (single proto → all languages)
|
|
575
|
+
│ └─ No ↓
|
|
576
|
+
│
|
|
577
|
+
├─ Need server-push / real-time updates?
|
|
578
|
+
│ ├─ Yes → Browser client?
|
|
579
|
+
│ │ ├─ Yes → WebSocket or SSE (simpler) / Connect-RPC (if proto contracts needed)
|
|
580
|
+
│ │ └─ No → gRPC server streaming
|
|
581
|
+
│ └─ No ↓
|
|
582
|
+
│
|
|
583
|
+
├─ Team has gRPC experience and infrastructure supports HTTP/2?
|
|
584
|
+
│ ├─ Yes → gRPC (for the contract and tooling benefits)
|
|
585
|
+
│ └─ No → REST/JSON (lower friction, faster time to first API)
|
|
586
|
+
│
|
|
587
|
+
└─ When in doubt → REST/JSON for external, gRPC for internal
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
---
|
|
591
|
+
|
|
592
|
+
## Implementation Sketch
|
|
593
|
+
|
|
594
|
+
### Project Structure
|
|
595
|
+
|
|
596
|
+
```
|
|
597
|
+
proto/
|
|
598
|
+
├── buf.yaml # Buf configuration
|
|
599
|
+
├── buf.gen.yaml # Code generation config
|
|
600
|
+
└── order/
|
|
601
|
+
└── v1/
|
|
602
|
+
└── order.proto # Service and message definitions
|
|
603
|
+
|
|
604
|
+
internal/
|
|
605
|
+
├── server/
|
|
606
|
+
│ └── order.go # gRPC server implementation
|
|
607
|
+
├── interceptors/
|
|
608
|
+
│ ├── auth.go # Authentication interceptor
|
|
609
|
+
│ ├── logging.go # Request logging
|
|
610
|
+
│ └── recovery.go # Panic recovery
|
|
611
|
+
└── client/
|
|
612
|
+
└── order.go # Client wrapper with retries
|
|
613
|
+
|
|
614
|
+
cmd/
|
|
615
|
+
└── server/
|
|
616
|
+
└── main.go # Server entrypoint
|
|
617
|
+
|
|
618
|
+
gen/ # Generated code (do not edit)
|
|
619
|
+
└── order/
|
|
620
|
+
└── v1/
|
|
621
|
+
├── order.pb.go
|
|
622
|
+
└── order_grpc.pb.go
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
### Buf Configuration
|
|
626
|
+
|
|
627
|
+
```yaml
|
|
628
|
+
# buf.yaml
|
|
629
|
+
version: v2
|
|
630
|
+
modules:
|
|
631
|
+
- path: proto
|
|
632
|
+
lint:
|
|
633
|
+
use:
|
|
634
|
+
- STANDARD # Enforces Google's proto style guide
|
|
635
|
+
breaking:
|
|
636
|
+
use:
|
|
637
|
+
- FILE # Detects breaking changes per-file
|
|
638
|
+
```
|
|
639
|
+
|
|
640
|
+
```yaml
|
|
641
|
+
# buf.gen.yaml
|
|
642
|
+
version: v2
|
|
643
|
+
plugins:
|
|
644
|
+
- remote: buf.build/protocolbuffers/go
|
|
645
|
+
out: gen
|
|
646
|
+
opt: paths=source_relative
|
|
647
|
+
- remote: buf.build/grpc/go
|
|
648
|
+
out: gen
|
|
649
|
+
opt: paths=source_relative
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
### Server Entrypoint
|
|
653
|
+
|
|
654
|
+
```go
|
|
655
|
+
func main() {
|
|
656
|
+
lis, err := net.Listen("tcp", ":50051")
|
|
657
|
+
if err != nil {
|
|
658
|
+
log.Fatalf("failed to listen: %v", err)
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
// Create server with interceptor chain
|
|
662
|
+
srv := grpc.NewServer(
|
|
663
|
+
grpc.ChainUnaryInterceptor(
|
|
664
|
+
interceptors.Recovery(),
|
|
665
|
+
interceptors.Logging(),
|
|
666
|
+
interceptors.Auth(tokenValidator),
|
|
667
|
+
otelgrpc.UnaryServerInterceptor(),
|
|
668
|
+
),
|
|
669
|
+
grpc.ChainStreamInterceptor(
|
|
670
|
+
interceptors.StreamRecovery(),
|
|
671
|
+
interceptors.StreamLogging(),
|
|
672
|
+
interceptors.StreamAuth(tokenValidator),
|
|
673
|
+
otelgrpc.StreamServerInterceptor(),
|
|
674
|
+
),
|
|
675
|
+
grpc.KeepaliveParams(keepalive.ServerParameters{
|
|
676
|
+
MaxConnectionIdle: 5 * time.Minute,
|
|
677
|
+
Time: 1 * time.Minute, // Ping if idle
|
|
678
|
+
Timeout: 20 * time.Second, // Wait for ping ack
|
|
679
|
+
}),
|
|
680
|
+
)
|
|
681
|
+
|
|
682
|
+
// Register services
|
|
683
|
+
orderv1.RegisterOrderServiceServer(srv, server.NewOrderServer(store))
|
|
684
|
+
|
|
685
|
+
// Register health check
|
|
686
|
+
healthSrv := health.NewServer()
|
|
687
|
+
grpc_health_v1.RegisterHealthServer(srv, healthSrv)
|
|
688
|
+
healthSrv.SetServingStatus("order.v1.OrderService", grpc_health_v1.HealthCheckResponse_SERVING)
|
|
689
|
+
|
|
690
|
+
// Enable reflection for debugging (disable in production)
|
|
691
|
+
reflection.Register(srv)
|
|
692
|
+
|
|
693
|
+
log.Printf("gRPC server listening on :50051")
|
|
694
|
+
if err := srv.Serve(lis); err != nil {
|
|
695
|
+
log.Fatalf("failed to serve: %v", err)
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
```
|
|
699
|
+
|
|
700
|
+
### Client with Retry and Deadline
|
|
701
|
+
|
|
702
|
+
```go
|
|
703
|
+
func NewOrderClient(addr string) (orderv1.OrderServiceClient, func(), error) {
|
|
704
|
+
retryPolicy := `{
|
|
705
|
+
"methodConfig": [{
|
|
706
|
+
"name": [{"service": "order.v1.OrderService"}],
|
|
707
|
+
"waitForReady": true,
|
|
708
|
+
"retryPolicy": {
|
|
709
|
+
"MaxAttempts": 3,
|
|
710
|
+
"InitialBackoff": "0.1s",
|
|
711
|
+
"MaxBackoff": "1s",
|
|
712
|
+
"BackoffMultiplier": 2.0,
|
|
713
|
+
"RetryableStatusCodes": ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
|
|
714
|
+
}
|
|
715
|
+
}]
|
|
716
|
+
}`
|
|
717
|
+
|
|
718
|
+
conn, err := grpc.Dial(addr,
|
|
719
|
+
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
|
720
|
+
grpc.WithDefaultServiceConfig(retryPolicy),
|
|
721
|
+
grpc.WithChainUnaryInterceptor(otelgrpc.UnaryClientInterceptor()),
|
|
722
|
+
grpc.WithKeepaliveParams(keepalive.ClientParameters{
|
|
723
|
+
Time: 10 * time.Second, Timeout: 3 * time.Second,
|
|
724
|
+
PermitWithoutStream: true,
|
|
725
|
+
}),
|
|
726
|
+
)
|
|
727
|
+
if err != nil {
|
|
728
|
+
return nil, nil, fmt.Errorf("dial %s: %w", addr, err)
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
cleanup := func() { conn.Close() }
|
|
732
|
+
return orderv1.NewOrderServiceClient(conn), cleanup, nil
|
|
733
|
+
}
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
### Testing gRPC Services
|
|
737
|
+
|
|
738
|
+
```go
|
|
739
|
+
func TestCreateOrder(t *testing.T) {
|
|
740
|
+
// bufconn provides in-process testing without real network
|
|
741
|
+
lis := bufconn.Listen(1024 * 1024)
|
|
742
|
+
srv := grpc.NewServer()
|
|
743
|
+
orderv1.RegisterOrderServiceServer(srv, server.NewOrderServer(mockStore))
|
|
744
|
+
go func() { srv.Serve(lis) }()
|
|
745
|
+
defer srv.Stop()
|
|
746
|
+
|
|
747
|
+
conn, err := grpc.DialContext(ctx, "bufconn",
|
|
748
|
+
grpc.WithContextDialer(func(ctx context.Context, s string) (net.Conn, error) {
|
|
749
|
+
return lis.DialContext(ctx)
|
|
750
|
+
}),
|
|
751
|
+
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
|
752
|
+
)
|
|
753
|
+
require.NoError(t, err)
|
|
754
|
+
defer conn.Close()
|
|
755
|
+
|
|
756
|
+
client := orderv1.NewOrderServiceClient(conn)
|
|
757
|
+
resp, err := client.CreateOrder(ctx, &orderv1.CreateOrderRequest{
|
|
758
|
+
CustomerId: "test-customer",
|
|
759
|
+
Items: []*orderv1.LineItem{{ProductId: "prod-1", Quantity: 1, PriceCents: 999}},
|
|
760
|
+
})
|
|
761
|
+
require.NoError(t, err)
|
|
762
|
+
assert.NotEmpty(t, resp.OrderId)
|
|
763
|
+
}
|
|
764
|
+
```
|
|
765
|
+
|
|
766
|
+
---
|
|
767
|
+
|
|
768
|
+
## Operational Checklist
|
|
769
|
+
|
|
770
|
+
Before deploying gRPC to production, verify:
|
|
771
|
+
|
|
772
|
+
- [ ] **Load balancing is L7, not L4.** Confirm your load balancer distributes individual RPCs, not just TCP connections.
|
|
773
|
+
- [ ] **Deadlines are set on every outgoing RPC.** No unbounded waits. Monitor `DEADLINE_EXCEEDED` rates.
|
|
774
|
+
- [ ] **Health checking is implemented.** Register `grpc.health.v1.Health` so Kubernetes can probe readiness.
|
|
775
|
+
- [ ] **Keepalive is configured.** Set `MaxConnectionIdle`, `Time`, and `Timeout` on both client and server to detect dead connections.
|
|
776
|
+
- [ ] **Proto files are centrally managed.** Single repository or Buf Schema Registry. `buf breaking` runs in CI.
|
|
777
|
+
- [ ] **Interceptors cover observability.** Logging, metrics (request count, latency histogram, error rate), and distributed tracing on every RPC.
|
|
778
|
+
- [ ] **Reflection is disabled in production.** It exposes your API surface. Enable only in development/staging.
|
|
779
|
+
- [ ] **TLS is configured.** Use mTLS for service-to-service. Never run `insecure.NewCredentials()` in production.
|
|
780
|
+
- [ ] **Streaming handlers respect context cancellation.** Verify that server-side streaming goroutines terminate when the client disconnects.
|
|
781
|
+
- [ ] **Retry policies use exponential backoff.** Retry only on `UNAVAILABLE` and `DEADLINE_EXCEEDED`. Never retry `INVALID_ARGUMENT` or `NOT_FOUND`.
|
|
782
|
+
|
|
783
|
+
---
|
|
784
|
+
|
|
785
|
+
## Cross-References
|
|
786
|
+
|
|
787
|
+
- **[api-design-rest](../integration/api-design-rest.md)** — REST is the complement to gRPC: use REST for external/public APIs and browser clients, gRPC for internal service-to-service.
|
|
788
|
+
- **[api-design-graphql](../integration/api-design-graphql.md)** — GraphQL excels at flexible querying for frontend clients. Use when clients need to select specific fields across multiple entities.
|
|
789
|
+
- **[microservices](../patterns/microservices.md)** — gRPC is the standard transport for microservice architectures. Understand the microservices pattern before choosing the transport.
|
|
790
|
+
- **[websockets-realtime](../integration/websockets-realtime.md)** — For browser-based real-time communication, WebSockets remain simpler than gRPC-Web. Choose WebSockets when the client is a browser and you do not need proto contracts.
|
|
791
|
+
|
|
792
|
+
---
|
|
793
|
+
|
|
794
|
+
## Sources
|
|
795
|
+
|
|
796
|
+
- [Six Lessons from Production gRPC — Speedscale](https://speedscale.com/blog/six-lessons-from-production-grpc/)
|
|
797
|
+
- [4 Ways Enterprise Architects Are Using gRPC — Red Hat](https://www.redhat.com/en/blog/grpc-use-cases)
|
|
798
|
+
- [gRPC vs REST: Detailed Comparison 2025 — Wallarm](https://www.wallarm.com/what/grpc-vs-rest-comparing-key-api-designs-and-deciding-which-one-is-best)
|
|
799
|
+
- [Connect: A Better gRPC — Buf](https://buf.build/blog/connect-a-better-grpc)
|
|
800
|
+
- [gRPC Load Balancing — gRPC Official](https://grpc.io/blog/grpc-load-balancing/)
|
|
801
|
+
- [Lessons from a Large gRPC Mesh — Datadog](https://www.datadoghq.com/blog/grpc-at-datadog/)
|
|
802
|
+
- [Protobuf Compatibility Best Practices — Earthly](https://earthly.dev/blog/backward-and-forward-compatibility/)
|
|
803
|
+
- [gRPC Deadlines — gRPC Official](https://grpc.io/blog/deadlines/)
|
|
804
|
+
- [About gRPC — gRPC Official](https://grpc.io/about/)
|