GithubHelp home page GithubHelp logo

doytsujin / storage-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from supabase/storage

0.0 1.0 0.0 2.92 MB

S3 compatible object storage service that stores metadata in Postgres

Home Page: https://supabase.com/docs/guides/storage

License: Apache License 2.0

Shell 0.34% JavaScript 0.26% TypeScript 94.30% PLpgSQL 4.90% Dockerfile 0.20%

storage-api's Introduction

Supabase Storage Middleware

Coverage Status

A scalable, light-weight object storage service.

Read this post on why we decided to build a new object storage service.

  • Uses Postgres as it's datastore for storing metadata
  • Authorization rules are written as Postgres Row Level Security policies
  • Integrates with S3 as the storage backend (with more in the pipeline!)
  • Extremely lightweight and performant

Architecture

Documentation

Development

  • Copy .env.sample to .env file.
  • Copy .env.test.sample to .env.test.
  • Change GLOBAL_S3_BUCKET and REGION to the name and region of a S3 bucket.
    • If you just want to run the tests and not develop locally, you can skip this step because S3 calls are mocked in our tests.
  • Set up your AWS credentials. Your user must have permissions to s3:PutObject, s3:GetObject, s3:DeleteObject in the bucket you have chosen.

Your root directory should now have both .env and .env.test files.

  • Then run the following:
# this sets up a postgres database and postgrest locally via docker
npm run infra:restart
# Start the storage server
npm run dev

The server should now be running at http://localhost:5000/

The following request should insert and return the list of buckets.

# insert a bucket named avatars
curl --location --request POST 'http://localhost:5000/bucket' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoic2VydmljZV9yb2xlIiwiaWF0IjoxNjEzNTMxOTg1LCJleHAiOjE5MjkxMDc5ODV9.th84OKK0Iz8QchDyXZRrojmKSEZ-OuitQm_5DvLiSIc' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "avatars"
}'

# get buckets
curl --location --request GET 'http://localhost:5000/bucket' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoic2VydmljZV9yb2xlIiwiaWF0IjoxNjEzNTMxOTg1LCJleHAiOjE5MjkxMDc5ODV9.th84OKK0Iz8QchDyXZRrojmKSEZ-OuitQm_5DvLiSIc'

Testing

To perform your tests you can run the following command: npm test

storage-api's People

Contributors

inian avatar thebengeu avatar fenos avatar bnjmnt4n avatar darora avatar ftonato avatar dependabot[bot] avatar sweatybridge avatar ankitjena avatar soedirgo avatar burmecia avatar alaister avatar bariqhibat avatar sduduzog avatar ikhsan avatar jianhan avatar mingfang avatar rahul3v avatar xenirio avatar buschco avatar

Watchers

 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.