GithubHelp home page GithubHelp logo

zcjwin / hasura-storage Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nhost/hasura-storage

0.0 0.0 0.0 18.27 MB

Storage for Hasura built on top of S3

License: Apache License 2.0

Shell 1.22% C 1.06% Go 90.69% Nix 3.54% Makefile 1.48% PLpgSQL 1.90% Dockerfile 0.09%

hasura-storage's Introduction

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

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.

hasura-storage's People

Contributors

dbarrosop avatar dependabot[bot] avatar elitan avatar nunopato avatar phishy avatar kevinrodriguez-io avatar sradigan avatar elephant3 avatar

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.