This is a Flask/Supabase project showing how to create a user profile along with how to store sensitive data that only the user of that data should be able to view using a one-to-one relationship and row level security (RLS). This project also demonstrates how to use a Postgres function to update two tables (which is done in a transaction so that if one fails there should be a rollback) using a .rpc function call. We also demonstrate how to use a generated column for the slug inside the database by making use of a Postgres function we create. Storage is used to store the featured image for the notes in the app.
This project makes use of:
- Supabase Python Library
- uv
- Flask
- DaisyUI
- tailwindcss
- pgTAP Postgres unit testing
- Tailwind Profile from Codepen
- heroicons
You can get started with this locally by using the Supabase CLI. Make sure you have the CLI installed before continuing. You can find installation instructions here.
Create a copy of this project using the commands below:
npx degit silentworks/flask-notes project-name
cd project-name
pnpm install # or npm install or yarn installRun the command below to start your local Supabase docker instance
pnpm dlx supabase start # npx supabase startCopy .env.example file and rename it .env. Now copy the credentials you were given when you ran pnpm dlx supabase start into this file.
Be sure to take a peek at the
.sqlfiles inside thesupabase/migrationsandsupabase/testsdirectory. You can run the supabase tests by callingpnpm dlx supabase test db.
Now we can start the project dev server:
uv run flask run --debugWe can now navigate to the /auth/signup url to create an account.