Using Supabase for the Postgres Database

For those who are interested. It is not my recommended approach but I have used supabase both for DB and File Storage.

Here is the example project: GitHub - paulnotfromstrapi/strapi-base

I also used “strapi-provider-upload-supabase”: “^1.0.0” as my file provider.

Here are my config settings.

config/database.js

module.exports = ({ env }) => {
  const client = env("DATABASE_CLIENT");

  const connections = {
    postgres: {
      connection: {
        connectionString: env("DATABASE_URL"),
        ssl: env.bool("DATABASE_SSL", false) && {
          rejectUnauthorized: env.bool(
            "DATABASE_SSL_REJECT_UNAUTHORIZED",
            true
          ),
        },
        schema: env("DATABASE_SCHEMA", "public"),
      },

      pool: {
        min: env.int("DATABASE_POOL_MIN"),
        max: env.int("DATABASE_POOL_MAX"),
      },
    },
  };

  return {
    connection: {
      client,

      ...connections[client],

      acquireConnectionTimeout: env.int("DATABASE_CONNECTION_TIMEOUT", 60000),
    },
  };
};

My supabase provider settings
config/plugins.js

module.exports = ({ env }) => ({
  upload: {
    config: {
      provider: "strapi-provider-upload-supabase",
      providerOptions: {
        apiUrl: env("SUPABASE_API_URL"),
        apiKey: env("SUPABASE_API_KEY"),
        bucket: env("SUPABASE_BUCKET"),
        directory: env("SUPABASE_DIRECTORY"),
        options: {},
      },
      actionOptions: {
        upload: {},
        uploadStream: {},
        delete: {},
      },
    },
  },
});

.env.example

HOST=0.0.0.0
PORT=1337

APP_KEYS=eugbpKpPrDf6pqXMiFk6+w==,TS4NQTj3L6W6FHdm7Bqo1A==,0t/EVFYhX87aEAzNq2x/KA==,jMehGQK4OjiV4i+yKj7jWQ==
API_TOKEN_SALT=ualmALKeYdJlyyVEMcXiQw==
ADMIN_JWT_SECRET=mqYNI4lFWH2BberCaAdoPA==
TRANSFER_TOKEN_SALT=e853xCTd1zTdI26O3NSfVg==

JWT_SECRET=HRsqM7AcFvAa/cctdsqNUQ==

# Supabase Provider
SUPABASE_URL=to_be_modified
SUPABASE_API_URL=to_be_modified
SUPABASE_API_KEY=to_be_modified
SUPABASE_BUCKET=to_be_modified
SUPABASE_DIRECTORY=to_be_modified

# Supabase Database
DATABASE_CLIENT=postgres
DATABASE_URL=to_be_modified
DATABASE_SHEMA=public
DATABASE_POOL_MIN=1
DATABASE_POOL_MAX=100

Although it work fine. I would be curious why folks are using Supabase. If you are just looking for a DB you can checkout something like Neon, a hosted Postgres DB https://neon.tech/.

I may be biased on not using Supabase with Strapi but I know many folks do, here is a video I did showing how to setup supabase and strapi together as a learning exercise.

If you just want to use a hosted DB my recomendation would be to use https://neon.tech/ and then use Cloudinary as image provide.

For anyone interested I have this project where it is deployed to renders free tier ( both Strapi and Astro ) and I use Cloudinary and Neon DB for File storage and Db. Both have very good free tiers.

Project Link

Hope this helps.