Compare commits

..

2 Commits

Author SHA1 Message Date
github-actions[bot]
cc88dbc4bd release(packages/nhost-js): nhost/nhost-js (#3491)
Automated release preparation for packages/nhost-js version
nhost/nhost-js

Changes:
- Updated CHANGELOG.md

Co-authored-by: dbarrosop <dbarrosop@users.noreply.github.com>
2025-09-24 15:47:51 +02:00
David Barroso
a6a5ecdad9 chore(docs): update README (#3492)
### **PR Type**
Documentation


___

### **Description**
- Update root README code examples

- Switch to `createClient` API and adjust auth methods

- Change GraphQL request syntax to object form

- Simplify install commands in package README


___



<details> <summary><h3> File Walkthrough</h3></summary>

<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Documentation</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>README.md</strong><dd><code>Revise root README examples
and links</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; </dd></summary>
<hr>

README.md

<ul><li>Changed code block language to TypeScript<br> <li> Replaced
<code>NhostClient</code> with <code>createClient</code> import<br> <li>
Updated auth and GraphQL usage methods<br> <li> Updated JS/TS client
link and removed integrations section</ul>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/3492/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5">+21/-25</a>&nbsp;
</td>

</tr>

<tr>
  <td>
    <details>
<summary><strong>README.md</strong><dd><code>Simplify installation
commands</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</dd></summary>
<hr>

packages/nhost-js/README.md

- Removed `@beta` tag from npm/yarn/pnpm install commands


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/3492/files#diff-32a1491b95260b677b05569fe11db6fe14aa7b380c7ef6422041949311f103a2">+3/-3</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>
</table></td></tr></tr></tbody></table>

</details>

___
2025-09-24 15:42:41 +02:00
3 changed files with 40 additions and 35 deletions

View File

@@ -65,23 +65,30 @@ Since Nhost is 100% open source, you can self-host the whole Nhost stack. Check
Install the `@nhost/nhost-js` package and start building your app:
```jsx
import { NhostClient } from '@nhost/nhost-js'
```ts
import { createClient } from '@nhost/nhost-js'
const nhost = new NhostClient({
subdomain: '<your-subdomain>',
region: '<your-region>'
const nhost = createClient({
subdomain: 'your-project',
region: 'eu-central-1'
})
await nhost.auth.signIn({ email: 'user@domain.com', password: 'userPassword' })
await nhost.auth.signInEmailPassword({
email: 'user@example.com',
password: 'password123'
})
await nhost.graphql.request(`{
users {
id
displayName
email
}
}`)
await nhost.graphql.request({
query: `
query GetUsers {
users {
id
displayName
email
}
}
`
})
```
## Frontend Agnostic
@@ -103,19 +110,8 @@ Nhost is frontend agnostic, which means Nhost works with all frontend frameworks
## Nhost Clients
- [JavaScript/TypeScript](https://docs.nhost.io/reference/javascript/nhost-js/nhost-client)
- [JavaScript/TypeScript](https://docs.nhost.io/reference/javascript/nhost-js/main)
- [Dart and Flutter](https://github.com/nhost/nhost-dart)
- [React](https://docs.nhost.io/reference/react/nhost-client)
- [Next.js](https://docs.nhost.io/reference/nextjs/nhost-client)
- [Vue](https://docs.nhost.io/reference/vue/nhost-client)
## Integrations
- [Apollo](./integrations/apollo#nhostapollo)
- [React Apollo](./integrations/react-apollo#nhostreact-apollo)
- [React URQL](./integrations/react-urql#nhostreact-urql)
- [Stripe GraphQL API](./integrations/stripe-graphql-js#nhoststripe-graphql-js)
- [Google Translation GraphQL API](./integrations/google-translation#nhostgoogle-translation)
## Applications

View File

@@ -1,3 +1,13 @@
# Changelog
All notable changes to this project will be documented in this file.
## [@nhost/nhost-js@4.0.1] - 2025-09-24
### ⚙️ Miscellaneous Tasks
- *(docs)* Update README (#3492)
- fix (packages/nhost-js): force refresh correctly if marginSeconds is set to 0 #54
# 5.0.0-beta.9

View File

@@ -6,13 +6,13 @@ The Nhost JavaScript SDK provides a client-side interface to interact with Nhost
```bash
# npm
npm install @nhost/nhost-js@beta
npm install @nhost/nhost-js
# yarn
yarn add @nhost/nhost-js@beta
yarn add @nhost/nhost-js
# pnpm
pnpm add @nhost/nhost-js@beta
pnpm add @nhost/nhost-js
```
## Quick Start
@@ -27,17 +27,17 @@ const nhost = createClient({
})
// Use authentication features
const response = await nhost.auth.signInEmailPassword({
const signinResponse = await nhost.auth.signInEmailPassword({
email: 'user@example.com',
password: 'password123'
})
if (response.body.session) {
if (signinResponse.body.session) {
console.log('Signed in successfully!')
}
// Use GraphQL features
const response = await nhost.graphql.request({
const graphqlResponse = await nhost.graphql.request({
query: `
query GetUsers {
users {
@@ -49,17 +49,16 @@ const response = await nhost.graphql.request({
`
})
return response.body.data.users
// Use storage features
const response = await nhost.storage.uploadFiles({
const storageResponse = await nhost.storage.uploadFiles({
'file[]': [file]
})
return response.body.processedFiles[0]
return storageResponse.body.processedFiles[0]
// call a serverless function
const response = await nhost.functions.fetch('/echo', {
const functionsResponse = await nhost.functions.fetch('/echo', {
method: 'POST',
body: JSON.stringify({
message: 'Hello, world!'