Skip to content

Conversation

@danstarns
Copy link
Contributor

dgraph-js doesn't have official support for working in the browser, so here I added content to the JavaScript SDK doc that highlights this and proposes alternatives to the SDK usage.

@trunk-io
Copy link

trunk-io bot commented May 29, 2025

Running Code Quality on PRs by uploading data to Trunk will soon be removed. You can still run checks on your PRs using trunk-action - see the migration guide for more information.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new “Browser support” section to the JavaScript SDK documentation, outlining how to interact with Dgraph via the HTTP API in browser environments and highlighting limitations and best practices.

  • Introduces notes, tips, and warnings for browser usage of Dgraph
  • Provides side-by-side code examples comparing Node.js gRPC and browser HTTP calls
  • Adds a parseDgraphUrl helper and a summary of HTTP API limitations
Comments suppressed due to low confidence (3)

dgraph/sdks/javascript.mdx:560

  • [nitpick] The variable name p is ambiguous in this context; consider renaming it to something more descriptive (e.g., person or newUser).
const p = { name: "Alice", age: 26 }

dgraph/sdks/javascript.mdx:434

  • [nitpick] Consider adding a link to the official Dgraph HTTP API reference to help readers dive deeper into endpoint details and supported request formats.
the same capabilities in browsers using Dgraph's HTTP API with standard `fetch` requests.

dgraph/sdks/javascript.mdx:441

  • [nitpick] You might want to mention the GraphQL endpoint path (e.g., /graphql) or include a link to the GraphQL API docs for clarity.
consider using Dgraph's GraphQL API instead, which is designed for client-side usage and provides better security boundaries.

@johnymontana johnymontana merged commit e0beb37 into main May 30, 2025
9 checks passed
@johnymontana johnymontana deleted the dgraph-js-browser branch May 30, 2025 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants