@@ -14,11 +14,10 @@ pnpm run dev # Start dev server on localhost:3000
1414pnpm run build # Build for production
1515pnpm run preview # Preview production build
1616
17- # Database (requires .env file in project root)
18- pnpm run db:start # Start PostgreSQL + PostGIS with Docker
19- pnpm run db:stop # Stop database
20- pnpm run db:restart # Restart database (useful for reseeding)
17+ # Database (uses Supabase remote)
18+ pnpm run db:setup # Run migrations and seeds on remote Supabase
2119pnpm run db:generate # Generate Drizzle migrations from schema changes
20+ pnpm run db:push # Push migrations to remote Supabase via CLI
2221
2322# Code Quality
2423pnpm run lint # Run ESLint with cache
@@ -55,20 +54,29 @@ The app uses **PostgreSQL with PostGIS** and a normalized relational schema with
55542 . Insert corresponding rows into ` location_categories ` junction table
56553 . PostGIS automatically handles the geometry conversion
5756
58- ### Database Seeding
57+ ### Database Setup and Seeding
5958
60- - ** Automatic seeding** via Docker Compose when starting the PostgreSQL database
59+ The project uses ** Supabase** for remote database management:
60+
61+ - ** Remote** : Connected to Supabase project (wwiwmsgedqeepcdtnhon) via connection pooler
6162- Migrations are stored in ` database/migrations/ ` (generated by Drizzle)
6263- Seed files are stored in ` database/seeds/ ` :
64+ - ` rls-policies.sql ` - Row Level Security policies
6365 - ` categories.sql ` - All Google Maps category types with icon mappings
64- - ` sources/dummy.sql ` - Dummy location data for testing
65- - The seeding process (executed by Docker):
66- 1 . ` init.sh ` - Creates PostGIS extensions, roles, and permissions
67- 2 . ` run-migrations.sh ` - Applies Drizzle migrations to create tables
68- 3 . ` rls-policies.sql ` - Applies Row Level Security policies
69- 4 . Seeds categories and dummy location data
70- - To start/restart database: ` pnpm run db:start `
71- - To regenerate migrations after schema changes: ` pnpm run db:generate `
66+ - ` sources/*.sql ` - Location data from various sources
67+
68+ ** Database workflow** :
69+
70+ 1 . Generate migrations from schema changes: ` pnpm run db:generate `
71+ 2 . Apply migrations and seeds to remote: ` pnpm run db:setup `
72+ 3 . (Optional) Push via Supabase CLI: ` pnpm run db:push `
73+
74+ The ` db:setup ` script (` scripts/db-setup.ts ` ):
75+
76+ - Enables PostGIS extension automatically
77+ - Runs all migrations in order, tracking applied migrations to avoid duplicates
78+ - Applies RLS policies and seeds data from SQL files
79+ - Uses connection pooler with ` prepare: false ` for transaction pooling mode
7280
7381### API Endpoints
7482
@@ -118,7 +126,8 @@ The app uses **UnoCSS with Nimiq presets**:
118126- Import schema as ` tables ` from ` server/utils/drizzle.ts `
119127- Schema is defined in ` database/schema.ts `
120128- Type exports: ` Location ` , ` Category ` , ` LocationCategory `
121- - Connection uses individual env vars (POSTGRES_HOST, POSTGRES_PORT, POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB)
129+ - Connection uses ` DATABASE_URL ` environment variable
130+ - Must use ` prepare: false ` option for Supabase transaction pooler
122131- PostgreSQL-specific: Use ` sql ` tagged templates for PostGIS queries
123132- PostGIS functions: ` ST_X() ` , ` ST_Y() ` , ` ST_Distance() ` , ` ST_Within() ` , etc.
124133
@@ -130,7 +139,7 @@ The app uses **UnoCSS with Nimiq presets**:
1301392 . Categories must be valid Google Maps types (snake_case strings) from ` database/seeds/categories.sql `
1311403 . Use PostGIS ` ST_SetSRID(ST_MakePoint(longitude, latitude), 4326) ` for location geometry
1321414 . Insert corresponding rows into ` location_categories ` junction table
133- 5 . Restart Docker Compose to apply changes: ` pnpm run db:restart `
142+ 5 . Apply changes: ` pnpm run db:setup ` (runs migrations and seeds)
134143
135144### Category Filtering
136145
@@ -151,27 +160,28 @@ The app uses **UnoCSS with Nimiq presets**:
151160- ** ` drizzle.config.ts ` ** - PostgreSQL dialect, schema at ` database/schema.ts ` , migrations output to ` database/migrations/ `
152161- ** ` uno.config.ts ` ** - UnoCSS with Nimiq presets
153162- ** ` eslint.config.mjs ` ** - Antfu's ESLint config with Nuxt integration
154- - ** ` database/docker-compose.yml ` ** - Docker Compose setup for local PostgreSQL development
155- - ** ` database/init.sh ` ** - Initializes PostGIS extensions and permissions
156- - ** ` database/run- migrations.sh ` ** - Runs Drizzle migrations on container start
157- - ** ` database/rls-policies.sql ` ** - Row Level Security policies
163+ - ** ` supabase/config.toml ` ** - Supabase local development configuration
164+ - ** ` scripts/db-setup.ts ` ** - Unified migration and seeding script
165+ - ** ` database/migrations/ ` ** - Drizzle-generated SQL migrations
166+ - ** ` database/seeds/ rls-policies.sql ` ** - Row Level Security policies
158167- ** ` database/seeds/categories.sql ` ** - All Google Maps categories with icons
159- - ** ` database/seeds/sources/dummy .sql ` ** - Dummy location data
168+ - ** ` database/seeds/sources/* .sql ` ** - Location data from various sources
160169
161170## Environment Variables
162171
163172Required in ` .env ` (project root):
164173
165174``` env
166- # PostgreSQL Configuration
167- POSTGRES_HOST=localhost
168- POSTGRES_PORT=5432
169- POSTGRES_USER=postgres
170- POSTGRES_PASSWORD=your_password
171- POSTGRES_DB=postgres
175+ # PostgreSQL Configuration (Supabase Remote)
176+ DATABASE_URL=postgresql://postgres.wwiwmsgedqeepcdtnhon:[YOUR-PASSWORD]@aws-1-eu-central-1.pooler.supabase.com:6543/postgres
172177
173178# API Keys
174179NUXT_GOOGLE_API_KEY=your_api_key
175180```
176181
177- All variables are validated via ` safeRuntimeConfig ` using Valibot schema.
182+ ** Important** :
183+
184+ - Uses Supabase connection pooler (port 6543) for remote database access
185+ - The pooler provides IPv4 connectivity (required for some WSL/network setups)
186+ - Connection uses transaction pooling mode (requires ` prepare: false ` in postgres client)
187+ - All variables are validated via ` safeRuntimeConfig ` using Valibot schema
0 commit comments