Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the initial infrastructure for the database #59

Open
maxcell opened this issue Jul 21, 2022 · 2 comments
Open

Improve the initial infrastructure for the database #59

maxcell opened this issue Jul 21, 2022 · 2 comments

Comments

@maxcell
Copy link
Contributor

maxcell commented Jul 21, 2022

As a user there are a lot of steps to setting up the project before you can fully get it operational currently:

  • You need to go to Supabase and create a project
  • You need to get the environment variable keys
  • You need to set a session secret
  • You need to run the SQL commands for establishing the schema
  • You need to run the SQL commands for establishing the Postgres trigger functions
  • You need to deploy the project

Previously back when we implemented login (#23), we used Supabase's auth system. It might make more sense to use Supabase to do the database but we roll the auth work ourselves. The big reason why we didn't do it before is that there were some complications with how Prisma cross join schemas (supabase/supabase#1502) like the one you'd get from Supabase's auth.users which was our initial approach (#37).

Taking prior art into how other Remix Stacks implement auth, I think it is fair to say they have it figured out!


By taking this approach though we offer ourselves the opportunity to scaffold the entire database with Prisma, seed the database with ease, allow for different implementations of a database to come in for local development versus production, and reduce the number of environment variables and potential errors we can come across.

@maxcell
Copy link
Contributor Author

maxcell commented Jul 21, 2022

An alternative solution for people is also to provide a read-only database for when people clone so folks could get the experience of using the application without any setup until they are ready to graduate to their own systems

@tzmanics
Copy link
Contributor

tzmanics commented Jul 21, 2022

After digging into this more @maxcell found a solution we will rely on now and the steps we'll need to take are

  • set RLS policies for notes and profiles
  • test ^
  • add supabase credentials to main code base
  • update readme to reflect ^
  • add banner to all site pages letting users know it is a public database and link to readme documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants