1- # Mosayic Python API
1+ # Python API
22
3- A FastAPI backend application with Supabase database integration.
3+ A FastAPI backend application with Supabase database integration, designed to compliment the React Native Mobile application Stack at Kealy Studio .
44
55## Tech Stack
66
@@ -44,7 +44,7 @@ python-api/
4444
45451 . Install dependencies:
4646 ``` bash
47- uv sync
47+ uv sync --all-groups
4848 ```
4949
50502 . Start local Supabase:
@@ -54,12 +54,13 @@ python-api/
5454
55553 . Copy environment variables:
5656 ``` bash
57- cp .env.local.example .env.local
57+ mv .env.example .env
58+ mv supabase/.env.example supabase/.env
5859 ```
5960
60614 . Run the development server:
6162 ``` bash
62- uv run uvicorn app.main:app --reload --port 8080
63+ uv run uvicorn app.main:app --host 0.0.0.0 --port 8080
6364 ```
6465
6566### Running Tests
@@ -68,40 +69,36 @@ python-api/
6869uv run pytest
6970```
7071
71- ### Docker
7272
73- Build and run the container:
74-
75- ``` bash
76- docker build -t mosayic-api .
77- docker run -p 8080:8080 mosayic-api
78- ```
79-
80- ## Environment Variables
81-
82- Configure in ` .env.local ` for development:
83-
84- | Variable | Description |
85- | ----------| -------------|
86- | ` supabase_url ` | Supabase project URL |
87- | ` supabase_secret_key ` | Supabase service role key |
88- | ` api_key ` | API authentication key |
89- | ` debug_mode ` | Enable debug mode (default: false) |
90- | ` environment ` | Environment name (development/production) |
9173
9274## Database
9375
9476Supabase migrations are in ` supabase/migrations/ ` . Current schema includes:
9577
9678- ` users ` - User profiles synced with Supabase Auth
97- - ` items ` - User-owned items
79+ - ` devices ` - A user may have many devices
80+
9881
99- Run migrations locally:
100- ``` bash
101- supabase db push
102- ```
10382
10483## Deployment
10584
10685- ** API** : Deployed to Google Cloud Run (see ` .github/workflows/gcp-deploy.yaml ` )
10786- ** Database** : Migrations deployed via GitHub Actions (see ` .github/workflows/supabase-deploy-migrations.yaml ` )
87+
88+ The command to deploy is:
89+ ```
90+ # Set the variables
91+ export PROJECT_ID=goat-together
92+ export REGION=eu-west1
93+ export SERVICE_NAME=goattogether-api
94+
95+ # Get the project number
96+ PROJECT_NUMBER=$(gcloud projects describe $PROJECT_ID --format="value(projectNumber)")
97+
98+ # Deploy to Cloud Run
99+ gcloud run deploy $SERVICE_NAME \
100+ --source . \
101+ --region=$REGION \
102+ --project=$PROJECT_ID \
103+ --allow-unauthenticated
104+ ```
0 commit comments