Skip to content

Commit

Permalink
Merge pull request #8 from silentworks/10-01-Add_app_source_repo_link
Browse files Browse the repository at this point in the history
Add app source repo link
  • Loading branch information
silentworks committed Oct 1, 2023
2 parents 281c5a5 + 7df8316 commit 19ef0cd
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 146 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# Python Flask Demo
# Flask Notes

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.

This project makes use of:

- [Supabase Auth Helpers SvelteKit](https://supabase.com/docs/guides/auth/auth-helpers/sveltekit)
- [Supabase Python Library](https://supabase.com/docs/reference/python/introduction)
- [Poetry](https://python-poetry.org/)
- [Flask](https://flask.palletsprojects.com/en/3.0.x/)
- [DaisyUI](https://daisyui.com/)
- [tailwindcss](https://tailwindcss.com/)
- [pgTAP](https://pgtap.org/) Postgres unit testing
- [Tailwind Profile from Codepen](https://codepen.io/ScottWindon/pen/XWdbPLm)
- [heroicons](https://heroicons.com/)

## Getting started

Expand All @@ -20,6 +23,7 @@ Create a copy of this project using the commands below:
npx degit silentworks/supabase-flask-demo project-name
cd project-name
npm install # or pnpm install or yarn install
poetry install
```

Run the command below to start your local Supabase docker instance
Expand Down
2 changes: 1 addition & 1 deletion app/supabase.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

url = os.environ.get("SUPABASE_URL", "")
key = os.environ.get("SUPABASE_KEY", "")
app_name = os.environ.get("APP_NAME", "Supabase Flask Demo")
app_name = os.environ.get("APP_NAME", "Flask Notes")


def get_supabase() -> Client:
Expand Down
180 changes: 40 additions & 140 deletions static/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -1916,14 +1916,14 @@ html {
position: relative;
}

.col-span-6 {
grid-column: span 6 / span 6;
}

.col-span-2 {
grid-column: span 2 / span 2;
}

.col-span-6 {
grid-column: span 6 / span 6;
}

.mx-2 {
margin-left: 0.5rem;
margin-right: 0.5rem;
Expand Down Expand Up @@ -1954,11 +1954,6 @@ html {
margin-bottom: 1rem;
}

.my-10 {
margin-top: 2.5rem;
margin-bottom: 2.5rem;
}

.mb-10 {
margin-bottom: 2.5rem;
}
Expand All @@ -1971,6 +1966,10 @@ html {
margin-bottom: 1.5rem;
}

.mb-8 {
margin-bottom: 2rem;
}

.ml-1 {
margin-left: 0.25rem;
}
Expand Down Expand Up @@ -2003,12 +2002,8 @@ html {
margin-top: 2rem;
}

.mb-2 {
margin-bottom: 0.5rem;
}

.mb-8 {
margin-bottom: 2rem;
.mt-10 {
margin-top: 2.5rem;
}

.block {
Expand All @@ -2035,24 +2030,12 @@ html {
height: 0.75rem;
}

.h-screen {
height: 100vh;
}

.h-6 {
height: 1.5rem;
}

.h-4 {
height: 1rem;
}

.h-5 {
height: 1.25rem;
}

.min-h-screen {
min-height: 100vh;
.h-screen {
height: 100vh;
}

.w-11\/12 {
Expand All @@ -2067,34 +2050,26 @@ html {
width: 33.333333%;
}

.w-full {
width: 100%;
}

.w-6 {
width: 1.5rem;
}

.w-4 {
width: 1rem;
}

.w-5 {
width: 1.25rem;
.w-full {
width: 100%;
}

.max-w-2xl {
max-width: 42rem;
}

.max-w-xs {
max-width: 20rem;
}

.max-w-5xl {
max-width: 64rem;
}

.max-w-xs {
max-width: 20rem;
}

.flex-1 {
flex: 1 1 0%;
}
Expand Down Expand Up @@ -2174,12 +2149,6 @@ html {
margin-left: calc(2.5rem * calc(1 - var(--tw-space-x-reverse)));
}

.space-y-4 > :not([hidden]) ~ :not([hidden]) {
--tw-space-y-reverse: 0;
margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse)));
margin-bottom: calc(1rem * var(--tw-space-y-reverse));
}

.space-y-2 > :not([hidden]) ~ :not([hidden]) {
--tw-space-y-reverse: 0;
margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));
Expand Down Expand Up @@ -2215,30 +2184,18 @@ html {
border-radius: 0.5rem;
}

.rounded-none {
border-radius: 0px;
}

.rounded-sm {
border-radius: 0.125rem;
}

.rounded-md {
border-radius: 0.375rem;
}

.border {
border-width: 1px;
.rounded-none {
border-radius: 0px;
}

.border-b {
border-bottom-width: 1px;
}

.border-t {
border-top-width: 1px;
}

.border-gray-300 {
--tw-border-opacity: 1;
border-color: rgb(209 213 219 / var(--tw-border-opacity));
Expand All @@ -2249,11 +2206,6 @@ html {
border-color: rgb(31 41 55 / var(--tw-border-opacity));
}

.border-gray-600 {
--tw-border-opacity: 1;
border-color: rgb(75 85 99 / var(--tw-border-opacity));
}

.bg-base-100 {
--tw-bg-opacity: 1;
background-color: hsl(var(--b1) / var(--tw-bg-opacity));
Expand Down Expand Up @@ -2288,24 +2240,19 @@ html {
padding: 3rem;
}

.p-3 {
padding: 0.75rem;
}

.p-2 {
padding: 0.5rem;
}

.p-3 {
padding: 0.75rem;
}

.px-4 {
padding-left: 1rem;
padding-right: 1rem;
}

.px-5 {
padding-left: 1.25rem;
padding-right: 1.25rem;
}

.px-6 {
padding-left: 1.5rem;
padding-right: 1.5rem;
Expand Down Expand Up @@ -2351,19 +2298,10 @@ html {
padding-bottom: 2rem;
}

.py-4 {
padding-top: 1rem;
padding-bottom: 1rem;
}

.pb-12 {
padding-bottom: 3rem;
}

.pt-4 {
padding-top: 1rem;
}

.pb-4 {
padding-bottom: 1rem;
}
Expand All @@ -2372,6 +2310,10 @@ html {
padding-right: 1rem;
}

.pt-4 {
padding-top: 1rem;
}

.text-center {
text-align: center;
}
Expand Down Expand Up @@ -2410,11 +2352,6 @@ html {
line-height: 1rem;
}

.text-3xl {
font-size: 1.875rem;
line-height: 2.25rem;
}

.font-bold {
font-weight: 700;
}
Expand Down Expand Up @@ -2445,6 +2382,16 @@ html {
color: rgb(59 130 246 / var(--tw-text-opacity));
}

.text-gray-100 {
--tw-text-opacity: 1;
color: rgb(243 244 246 / var(--tw-text-opacity));
}

.text-gray-400 {
--tw-text-opacity: 1;
color: rgb(156 163 175 / var(--tw-text-opacity));
}

.text-gray-500 {
--tw-text-opacity: 1;
color: rgb(107 114 128 / var(--tw-text-opacity));
Expand Down Expand Up @@ -2500,16 +2447,6 @@ html {
color: rgb(253 224 71 / var(--tw-text-opacity));
}

.text-gray-100 {
--tw-text-opacity: 1;
color: rgb(243 244 246 / var(--tw-text-opacity));
}

.text-gray-400 {
--tw-text-opacity: 1;
color: rgb(156 163 175 / var(--tw-text-opacity));
}

.underline {
text-decoration-line: underline;
}
Expand All @@ -2532,25 +2469,11 @@ html {
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
}

.hover\:border-b:hover {
border-bottom-width: 1px;
}

.hover\:bg-blue-600:hover {
--tw-bg-opacity: 1;
background-color: rgb(37 99 235 / var(--tw-bg-opacity));
}

.hover\:bg-stone-300:hover {
--tw-bg-opacity: 1;
background-color: rgb(214 211 209 / var(--tw-bg-opacity));
}

.hover\:bg-slate-300:hover {
--tw-bg-opacity: 1;
background-color: rgb(203 213 225 / var(--tw-bg-opacity));
}

.hover\:bg-gray-700:hover {
--tw-bg-opacity: 1;
background-color: rgb(55 65 81 / var(--tw-bg-opacity));
Expand All @@ -2561,16 +2484,6 @@ html {
color: rgb(191 219 254 / var(--tw-text-opacity));
}

.hover\:text-indigo-500:hover {
--tw-text-opacity: 1;
color: rgb(99 102 241 / var(--tw-text-opacity));
}

.hover\:text-gray-700:hover {
--tw-text-opacity: 1;
color: rgb(55 65 81 / var(--tw-text-opacity));
}

.hover\:text-gray-300:hover {
--tw-text-opacity: 1;
color: rgb(209 213 219 / var(--tw-text-opacity));
Expand All @@ -2581,22 +2494,9 @@ html {
color: rgb(75 85 99 / var(--tw-text-opacity));
}

.hover\:text-gray-800:hover {
--tw-text-opacity: 1;
color: rgb(31 41 55 / var(--tw-text-opacity));
}

.hover\:text-gray-400:hover {
.hover\:text-indigo-500:hover {
--tw-text-opacity: 1;
color: rgb(156 163 175 / var(--tw-text-opacity));
}

.hover\:underline:hover {
text-decoration-line: underline;
}

.focus\:border-none:focus {
border-style: none;
color: rgb(99 102 241 / var(--tw-text-opacity));
}

@media (min-width: 640px) {
Expand Down
Loading

0 comments on commit 19ef0cd

Please sign in to comment.