• Stars
    star
    208
  • Rank 188,087 (Top 4 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created about 3 years ago
  • Updated 30 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Storage for Hasura built on top of S3

Hasura Storage

Hasura storage is a service that adds a storage service on top of hasura and any s3-compatible storage service. The goal is to be able to leverage the cloud storage service while also leveraging hasura features like its graphql API, permissions, actions, presets, etc...

Workflows

To understand what hasura-storage does we can look at the two main workflows to upload and retrieve files.

Uploading files

When a user wants to upload a file hasura-storage will first check with hasura if the user is allowed to do so, if it the file will be uploaded to s3 and, on completion, file metadata will be stored in hasura.

sequenceDiagram
    actor User
    autonumber
    User->>+hasura-storage: upload file
    hasura-storage->>+hasura: check permissions
    hasura->>-hasura-storage: return if user can upload file
    hasura-storage->>+s3: upload file
    s3->>-hasura-storage: file information
    hasura-storage->>+hasura: file metadata
    hasura->>-hasura-storage: success
    hasura-storage->>-User: file metadata

Retrieving files

Similarly, when retrieving files, hasura-storage will first check with hasura if the user has permissions to retrieve the file and if the user is allowed, it will forward the file to the user:

sequenceDiagram
    actor User
    autonumber
    User->>+hasura-storage: request file
    hasura-storage->>+hasura: check permissions
    hasura->>-hasura-storage: return if user can access file
    hasura-storage->>+s3: request file
    s3->>-hasura-storage: file
    hasura-storage->>-User: file

Features

The main features of the service are:

  • leverage hasura's permissions to allow users to upload/retrieve files
  • upload files to any s3-compatible service
  • download files from any s3-compatible service
  • create presigned URLs to grant temporary access
  • caching information to integrate with caches and CDNs (cache headers, etag, conditional headers, etc)
  • perform basic image manipulation on the fly
  • integration with clamav antivirus

OpenAPI

The service comes with an OpenAPI definition which you can also see online.

Using the service

Easiest way to get started is by using nhost's free tier but if you want to self-host you can easily do it yourself as well.

Self-hosting the service

Requirements:

  1. hasura running, which in turns needs postgres or any other supported database.
  2. An s3-compatible service. For instance, AWS S3, minio, etc...

A fully working example using docker-compose can be found here. Just remember to replace the image hasura-storage:dev with a valid docker image, for instance, nhost/hasura-storage:0.1.5.

Contributing

If you need help or want to contribute it is recommended to read the contributing information first. In addition, if you plan to contribute with code it is also encouraged to read the development guide.

More Repositories

1

nhost

The Open Source Firebase Alternative with GraphQL.
TypeScript
7,785
star
2

hasura-backend-plus

πŸ”‘Auth and πŸ“¦Storage for Hasura. The quickest way to get Auth and Storage working for your next app based on Hasura.
TypeScript
1,172
star
3

hasura-auth

Authentication for Hasura.
Go
376
star
4

nhost-dart

Nhost Dart & Flutter packages
Dart
89
star
5

nhost-js-sdk

Nhost JS SDK to handle Auth and Storage with Nhost.
TypeScript
78
star
6

cli

Nhost CLI
Go
77
star
7

nextjs-stripe-starter

TypeScript
46
star
8

nhost-react-typescript-example-app

Nhost Example project using React
CSS
24
star
9

docs

Nhost Documentation
JavaScript
24
star
10

nhost-nextjs-notes-starter

TypeScript
16
star
11

nhost-react-native-example-app

A Nhost Starter Project Using React Native
JavaScript
12
star
12

nhost-netlify-starter-nextjs-reactquery

TypeScript
11
star
13

nuxt

NuxtJS module for Nhost
TypeScript
10
star
14

stripe-graphql

Go
7
star
15

functions

Dockerfile
7
star
16

react-nhost

JavaScript
6
star
17

nhost-js

Nhost JavaScript SDK
TypeScript
5
star
18

examples

JavaScript
5
star
19

react-apollo

For easy usage of Apollo and React with Nhost.
TypeScript
5
star
20

nhost-nextjs-example-app

JavaScript
5
star
21

react-auth

For easy usage of Auth with Nhost
TypeScript
4
star
22

quickstart-nextjs

CSS
3
star
23

hasura-auth-js

JavaScript SDK for interacting with hasura-auth
TypeScript
3
star
24

postgres

PLpgSQL
3
star
25

cli-go

Go
2
star
26

nhost-run-hello-world

Hello World application leveraging Nhost Run
JavaScript
2
star
27

graphql.se

JavaScript
1
star
28

functions-test

JavaScript
1
star
29

storage-server-v2-node

TypeScript
1
star
30

nhost-vue-composition

1
star
31

draw

TypeScript
1
star
32

vue-quickstart

TypeScript
1
star
33

cra-template-nhost-quickstart

CSS
1
star
34

nhost-run-bun-generator

TypeScript
1
star
35

nhost-run-cat-generator

A cat generator written in Python leveraging Nhost Run
Dockerfile
1
star
36

nhost.toml

HTML
1
star
37

nixops

Standardized nixops operations @Nhost
Nix
1
star
38

hasura-storage-js

TypeScript
1
star