Skip to content

webscopeio/supabase-modules

Repository files navigation

Workspace

The Supabase Modules repository is a pnpm workspace managed using Turborepo. It includes the following applications:

Apps

  • docs: a Vitepress app - to learn about the project
  • apps/next: a Next.js app - to use the project

Directory structure

There is no package/installable/CLI for the time being. The apps/** directory organizes by framework the modules source code and a Supabase project configuration for them.

For example, our Next.js app looks like this:

📂 docs
📂 apps
  📂 next
    📁 components
      📁 user
    📁 modules
      📁 user
      📁 types
      📁 utils
    📁 supabase
      📁 migrations
  • The UI lives in the /components directory categorized by module name i.e. user.
  • The logic lives in the /modules directory categorized by module name i.e. user.
  • The database configuration lives in the /supabase directory where migrations can be identified by module name i.e. 20240214100236_user.sql.

Requirements

  • Node: >=20,
  • Package manager: pnpm@8.15.1

Install

To install dependencies, run the following command from the root repository:

pnpm install

Environment variables

Please refer to .env.example when working with environment variables. This repository is local-first development, so you should set all of your development variables in .env.local located in the root repository.

If you want to connect to a remote Supabase instance you can set all of your variables in .env located in the root repository.

If you do not have these, you may have to run Supabase locally first before development. Read more on Your Supabase Instance.

Develop

For development, run the following command from the root repository:

pnpm db:start && pnpm dev
  • supbase CLI will start your Supabase Instance at the response ports
  • docs will be available in port 3001
  • playground will be available in port 3000

Remember to run pnpm db:stop to save resources once you are done working with your local Supabase Instance.

If you intended to develop with a cloud hosted Supabase Instance you only need to run:

pnpm dev:remote

Build

To build, run the following command from the root repository:

pnpm build

Contributing

Excited to hear that you are interested in contributing to this project! Please visit Contributing

Documentation

To learn more about this project, please visit Supabase Modules Documentation.