Giter VIP home page Giter VIP logo

nhost's Introduction

Nhost

Nhost

Quickstart   •   Website   •   Docs   •   Blog   •   Twitter   •   Discord


Nhost is an open source Firebase alternative with GraphQL, built with the following things in mind:

  • Open Source
  • GraphQL
  • SQL
  • Great Developer Experience

Nhost consists of open source software:

Architecture of Nhost




Visit https://docs.nhost.io for the complete documentation.

Get Started

Option 1: Nhost Hosted Platform

  1. Sign in to Nhost.
  2. Create Nhost app.
  3. Done.

Option 2: Self-hosting

Since Nhost is 100% open source, you can self-host the whole Nhost stack. Check out the example docker-compose file to self-host Nhost.

Sign In and Make a Graphql Request

Install the @nhost/nhost-js package and start build your app:

import { NhostClient } from '@nhost/nhost-js'

const nhost = new NhostClient({
  subdomain: '<your-subdomain>',
  region: '<your-region>'
})

await nhost.auth.signIn({ email: '[email protected]', password: 'spaceX' })

await nhost.graphql.request(`{
  users {
    id
    displayName
    email
  }
}`)

Frontend Agnostic

Nhost is frontend agnostic, which means Nhost works with all frontend frameworks.

Resources

  • Start developing locally with the Nhost CLI

Nhost Clients

Integrations

Applications

Community ❤️

First and foremost: Star and watch this repository to stay up-to-date.

Also, follow Nhost on GitHub Discussions, our Blog, and on Twitter. You can chat with the team and other members on Discord and follow our tutorials and other video material at YouTube.

Nhost is Open Source

This repository, and most of our other open source projects, are licensed under the MIT license.

ROSS Index - Fastest Growing Open-Source Startups | Runa Capital

How to contribute

Here are some ways of contributing to making Nhost better:

Contributors

A table of avatars from the project's contributors

nhost's People

Contributors

chrtze avatar dbarrosop avatar dddenis avatar dipakparmar avatar ejkkan avatar elephant3 avatar elitan avatar fuzzyreason avatar gavanwilhite avatar gdangelo avatar github-actions[bot] avatar guicurcio avatar lectrician1 avatar luciodale avatar macmac49 avatar mainamary avatar mdp18 avatar muttenzer avatar nbourdin avatar nesmanrique avatar nunopato avatar onehassan avatar plmercereau avatar renovate[bot] avatar rikardwissing avatar sebagudelo avatar subhendukundu avatar szilarddoro avatar timpratim avatar wollerman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nhost's Issues

Rename `getUrl` to `getPublicUrl`

There are two ways of getting a file URL:

  1. Get the direct (or public) URL. For users to access the file using this URL the public role in Hasura must have access to the file in the GraphQL API.
  2. Pre signed URL. For users to access this file the user has to have permission to the file in the GraphQL API.

We could keep the getUrl, deprecate it, and use it as an alias for getPublicUrl.

With the new naming we would have two ways of getting a file URL:

  • getPublicUrl
  • getPresginedUrl

Versioning of storage rules

A versioning of the last saved storage rule settings would be great to "fallback" to the last working version.

Probably someone screwed up his rules and has a struggle right now.. probably that someone is me ...:-|

Bug - x-hasura-user-id is not accessible in production function

Description

Currently in local development, I am able to access the x-hasura-user-id in a custom function by forwarding client headers. I access the user id this way below locally and it works.

const userId = req.body.session_variables["x-hasura-user-id"];

Problem

In the nhost production function, I am unable to access x-hasura-user-id. This is the error that was pulled from an nhost team member to help me debug:

(unsaved) test event

Response
{
  "errorType": "Runtime.UnhandledPromiseRejection",
  "errorMessage": "TypeError: Cannot read property 'x-hasura-user-id' of undefined",
  "trace": [
    "Runtime.UnhandledPromiseRejection: TypeError: Cannot read property 'x-hasura-user-id' of undefined",
    "    at process.<anonymous> (/var/runtime/index.js:35:15)",
    "    at process.emit (events.js:400:28)",
    "    at processPromiseRejections (internal/process/promises.js:245:33)",
    "    at processTicksAndRejections (internal/process/task_queues.js:96:32)"
  ]

Expectation

I should be able to access the x-hasura-user-id from the session_variables the same way in production as I do in local development

Expo url setup for nhost-cli local development and production use cases

For anyone coming after me, even on MacOS Docker actually exposes the ports correctly and if Mac Firewall is off the services are accessible from the local network (i.e. so that Expo Go can point to the local dev environment from a physical device).

For Expo, you can set the URLs as below, this makes the production builds point to the nhost cloud (you need to insert your URL here), the physical devices using Expo Go point to the IP of the machine running the Metro Bundler and the simulators run on the machine point to localhost.

TLDR: In Expo, to make development use the dev environment and production use production, see code below:

export const auth_url =
  Constants.manifest.packagerOpts.dev && !Constants.isDevice
    ? "http://localhost:9001"
    : typeof manifest.packagerOpts === `object` && manifest.packagerOpts.dev
    ? `http://${manifest.debuggerHost.split(`:`).shift().concat(`:9001`)}`
    : "nhost.io cloud url";

I created a proposed PR nhost/docs#35 to include this in the docs under the nhost dev section.

Using admin secret

  • methods for setting and clearing admin secret
  • if admin secret is set, it should be sent along in the headers for all requests (x-hasura-admin-secret)

This is useful when sending GraphQL requests, managing files, signing up users, and sending function calls.

It should also be easy to toggle between making requests using the admin secret or not.

Apollo subscriptions do not exist

Hey,

not sure if this is the right place, but I couldn't find a support platform.

I am using Nuxt and followed the guide. Also used the same configurations from the nuxt example.
The auth is working fine, but I can't query anything.

I have only 2 tables

  • user
  • notes

notes is a basic table with

  • id
  • text
  • user_id
  • created_at
  • updated_at

When I test the queries from within hasura, everything works fine. But I can't query anything from within my application.

I always get this error

Error no subscriptions exist
apollo-module.js?0d2d:84 Error GraphQL error: field "notes" not found in type: 'query_root'
apollo-module.js?0d2d:84 Error GraphQL error: field "notes" not found in type: 'query_root'

Client login URLs not taking from the production dashboard

Hey folks,

I am trying to change the Client login URL in the production dashboard, but it is still taking the old one after successful redirect.

For example.
I had localhost previously, now I have changed to the prod url, but after login it is still taking the localhost.

Please let me know if you need more info, I am happy to help.

Todos example with is_completed and completed

In the Todos documentation example, the table is created with the field is_completed but later in the documentation completed is used:

  • permissions / insert screenshot
  • permissions / select screenshot
  • authentication / App.js code snippet in the subscription query
  • authentication / permission / insert screenshot
  • authentication / permission / select screenshot

Allow Disabling Anonymous Registration in Projects

It would be great to disable Anonymous registration from so that it cannot be controlled by an account admin. It seems that this could potentially be a security hole for some applications.

I am not sure if this belongs here or the backend plus.

Better support to add image transformation query parameters

Hasura Storage supports adding image transformation query parameters to manipulate the image on the fly. The SDK should make it easy to use them.

The following query parameters can be added to both public URLs and presigned URLs:

  • w (width)
  • h (height)
  • q (quality)
  • b (blur)
  • r (radius)

auth.requestPasswordChange not working - message: ""email" must be a string"

Hello guys,
I'm trying to work with "auth" and "recovery password" but It's not working correctly.

I get back this:

error: "Bad Request"
message: "\"email\" must be a string"
statusCode: 400

below my code:

auth.requestPasswordChange({
   email: values.email,
 })
.then()
.catch()

Is there a way to get the ticket? Reading the docs seems that is not possibile and the only way is to send the ticket by email.
I would get back the ticket and then pass It to the MailGun Api. Do you think is It possible to do It?

thank you.

Apollo doesn't re-render items with same __typename and same id

When working with Apollo when an item of the same __typename and same id came after a mutation, everything changed in the cache and therefore one didn't need to do any refetchQueries, and data from queries where these items where fetched would re-render automatically.

However, when using this package after mutating or creating a new item, I can see that the item is in the cache (by looking at apollo devtools) but the lists where these items are queried do not re-render automatically.

I wonder if there is a setting somewhere to enable this behavior.

Custom API - Allow for use of ES6 import

Environment - Local/Nhost Dev
Machine - Apple M1 Macbook Pro

Issue
When trying to create a custom API, I installed the Twilio package and the nhost_api server crashed and logged the following

nhost_api | import net from 'net';

nhost_api | ^^^^^^

nhost_api |

nhost_api | SyntaxError: Cannot use import statement outside a module

nhost_api | at wrapSafe (internal/modules/cjs/loader.js:979:16)

nhost_api | at Module._compile (internal/modules/cjs/loader.js:1027:27)

nhost_api | at Module._extensions..js (internal/modules/cjs/loader.js:1092:10)

nhost_api | at Object.require.extensions.<computed> [as .ts] (/usr/src/app/node_modules/ts-node/src/index.ts:1286:43)

nhost_api | at Module.load (internal/modules/cjs/loader.js:928:32)

nhost_api | at Function.Module._load (internal/modules/cjs/loader.js:769:14)

nhost_api | at Module.require (internal/modules/cjs/loader.js:952:19)

nhost_api | at require (internal/modules/cjs/helpers.js:88:18)

nhost_api | at /usr/src/app/index.ts:17:26

nhost_api | at Array.forEach (<anonymous>)

Expectation
I should be able to import an npm package without issue

Accept Any OAuth2 Provider

Login with Facebook, Google, Twitter, Microsoft, LinkedIn, Apple. etc are necessary.

As per App Store Review Guidelines we must include apple login if we use any third party login otherwise the app will be rejected :
https://developer.apple.com/app-store/review/guidelines/#sign-in-with-apple

So instead of adding new OAuth2 providers one by one. I request to create a general UI for any OAuth2 provider to work. By collection additional information.

nhost.io login not working

It's always me!
I've seen that you've changed your look (looks amazing!!), but now I can no longer log in or retrieve my password.
Before the redesign I used to log in with google, but now I see that this type of access is no longer available.

thanks
C.

Schermata 2021-12-09 alle 19 31 36

Anonymous users?

Does nHost support anonymous users?

If not, is there some way this could be achieve with the existing APIs?

Add support of apple id OAuth-orisation

I am developing a react-native application, nhost.io looks very promising and inspiring for me.

But the main audience that my client is focused on is the iOs apps, so I am desperate about having an Apple id.

I see that you have it in the list here https://github.com/nhost/hasura-auth and here https://github.com/nhost/hasura-backend-plus but at the same time I see "we don't support Apple id" yet

Do we support it or not? If we do, can I expect to start developing an apple id application and within a month have the apple-id there? Or at least have something to set up apple-id by ourselves? Thank you!

Allow Deployments from Specific Branches

It would be great to be able to specify a specific branch for a deployment other than the default branch. This would be ideal for situations where you have a production branch and a staging branch.

selfhost how-to missing

assumption: every OSS app, is written for the people to use.
for that a setup-instruction is a necassary part.

please publish a how-to, docker-compose etc.
TIA

[Question]: Export DB / Hasura Schema

Dear @elitan ,

first of all, thanks for creating this awesome project. Really happy to take a look, read the docs and find my way around. Looks very promising.

I am currently evaluating nhost as a BaaS solution here at university for our next projects. I am not sure if this repository is the correct place to ask some general questions or request features - but i will try anyway. Please feel free to transfer this issue to any other repository, if it is more suitable.

In our institute, we support researchers from different domains in collecting, visualizing and analyzing (medical) health data. Based on our partners, we have a lot of "repeating projects" (i.e., deploy the same application over and over again for different scenarios, like tinnitus, diabetes, ...).

In order to easily manage these projects, i would like to have :

  • some kind of export feature, that allows to quickly dump the entire project (i.e., the entire database schema with all relations, and so on)
  • import this schema within a newly created project and have everything setup.

Can you point me into the right direction? Is this (already) possible? If so, how?
Can we add such a "schema description" file to our git repository and keep track of changes?

All the best,
Johannes

Nothing rendering when NhostAuthProvider/NhostApolloProvider used

I've added these in but nothing is rendered. If I remove them then everything renders as normal. Has anybody seen this?

E.g.

const App: FC<AppProps> = ({ Component, pageProps }: AppProps) => { return ( <NhostAuthProvider auth={auth}> <NhostApolloProvider auth={auth} gqlEndpoint={process.env.GRAPHQL_ENDPOINT}> <ChakraProvider> <Component {...pageProps} /> </ChakraProvider> </NhostApolloProvider> </NhostAuthProvider> ); }

this just renders a blank page, but if I remove the Nhost providers it works as normal.

ALLOWED_EMAIL_DOMAINS

Set ALLOWED_EMAIL_DOMAINS in the Nhost console to specify what email domain names are allowed to register accounts.

Github repos aren't displaying properly after reconnection

I had to remove and reconnect Nhost from my Github organization. Afterwards, I realized that the list of repos simply get added on instead of just refreshing to only show the current available repos. Here's a pic after I changed my repo's name a few times and connected and reconnected. There should only be two repos displaying, but instead, a new three get added every time I reconnect to my Github org.

Screen Shot 2021-12-11 at 9 24 06 AM

Non self serving user management in hasura-auth

Are there plans to add non self serving user management to hasura-auth?

Now users can register themselves and then manage their own user data, eg. password. It would be nice if such functionality - registering users with specific roles, changing their password, etc - would be also available to admins (eg. clients with x-hasura-admin-secret) so that they can manage their users.

I can now register new users from my backend via the auth JS SDK and can add roles by using the - what I think is private - API of hasura-auth, namely the Hasura graphql API exposed for the auth tables. Using the same API and looking at hasura-auth sources I could also implement password change for any of my users. However, this smells as I use these private API-s and the password hash function may change in the future.

So instead, it would be great to have an auth API, which can be used when passing x-hasura-admin-secret or similar along with the auth calls and which would allow managing any users under hasura-auth.

Or if you say that the Hasura exposed hasura-auth graphql API is intended for us developers as well and it will be officially documented, then it is also fine with me.

Apollo Devtools for Chrome and Firefox Not working with NhostApolloProvider

The apollo devtools do not work with nhostapolloprovider. I can interact with the GraphiQl and run queries or mutations but the queries, mutations and cache tabs are empty. I have tested my other GraphQl apps (even ones running with Hasura api) and the browser extension works properly and is stable.

My current working versions for both browsers are:

Im on a Macbook
Chrome v. 89.0.4389.90
ApolloClient Devtools v. 3.0.2
@nhost/react-apollo 1.0.7

Firefox: latest

Document get userId from jwt token in server.

https://www.npmjs.com/package/jsonwebtoken

const decoded = jwt.verify(token, process.env.NHOST_JWT_KEY);

const userId = decoded["https://hasura.io/jwt/claims"]["x-hasura-user-id"];

For future reference and help let's document this use case.
Thanks

[Suggestion] Use ory stack for auth management

Yo guys, what if you will consider for the future to use ory stack for auth Z/N? - https://www.ory.sh
ory kratos for user management
ory oathkeeper for authorization

  • They offer as well an open-source IAM solution and Oauth solution which can be handy for developing your own public APIs.
  • No need to maintain own auth solution
  • Security issues tracking and hardening can be a hussle

would love to hear from you guys what do you think about this.

Stuck at Creating Project

Hi. I am evaluating this new product. I've just following the getting started guide and tried to create a "todos" app but now the process has been stuck on the "Creating your project..." step (Nhost console) for days now. Even when I pick my answers and move ahead, the process does not complete and stays at this step for hours.

image

[Feature Request] Custom API Repository Path

Dear @elitan ,

in the docs, i read about Custom APIs ( https://docs.nhost.io/custom-api ), which would really be an awesome feature.
Prior, i worked a lot with NestJS ( https://nestjs.com/ ), which is (at least for me) the go-to backend framework when i need to develop an API.

For larger project, i always followed a monorepository approach (i.e., all of my applications (api, web application, mobile application, admin web application, ...) are stored within the same git repository. In this context, i used nrwl/nx to structure / maintain my monorepository. However, nrwl/nx has a predefined folder structure. For example, your apps are located within apps/!

In this context, the custom api would not work, because the api would be stored in apps/awesome-api or whatever ;) Could you please make the api path within the repository customizable? Somewhere in the Settings page or whatever?

All the best,
Johannes

Unable to delete project on Nhost v2

When I try to delete a project in v2, this error pops up in the console.

_app-4d83c955826672cd.js:1 Uncaught (in promise) 
Error: Foreign key violation. update or delete on table "apps" violates foreign key constraint 
"deployments_app_id_fkey" on table "deployments"

Screen Shot 2021-12-09 at 9 30 27 AM

[Feature Request] Hasura Pro Version Option

Hi @elitan ,
For hasura's backend, testing and monitoring are almost non-existent right now. Hasura basic console does not offer the features for us to run regression testing and monitor the traffic. Is it possible to include this feature in the near future?
Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.