From 8a1b24398ac1f472225f9af6c6866f454c3229bc Mon Sep 17 00:00:00 2001 From: sbddesign Date: Tue, 30 Dec 2025 07:55:18 -0500 Subject: [PATCH 1/2] update readme for supabase --- README.md | 99 +++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 75 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 4301405..5ed81d5 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,8 @@ This is a work in progress. Things are rapidly being built and changed on variou ## Prerequisites - Node.js (v18 or later) -- Docker and Docker Compose - A Phoenix node running locally or remotely +- Docker and Docker Compose (only needed for local database setup) 1. Clone the repository: ```bash @@ -37,34 +37,78 @@ cp .env.example .env ## Database Setup -Aurora uses PostgreSQL for data storage, running in Docker for easy setup and management. +Aurora uses PostgreSQL for data storage. You have two options: -### Starting the Database +### Option 1: Staging Database (Recommended for Frontend Developers) -1. Start the PostgreSQL container: -```bash -docker compose up -d -``` +Use the hosted Supabase database - no Docker required! This is the recommended option for frontend developers who want to focus on UI/UX without worrying about backend setup. -This will: -- Create a PostgreSQL 15 instance -- Set up a persistent volume for data storage -- Expose the database on port 5432 -- Configure the following credentials: - - User: aurora - - Password: aurora_dev_password - - Database: aurora_db +1. **Get the connection string:** + - Contact your team lead for the Supabase database connection string + - Or access it from the Supabase dashboard: Settings → Database → Connection string (use the "URI" format) -2. Apply database migrations: -```bash -npx prisma migrate dev -``` +2. **Set up your environment:** + ```bash + # Create a .env file in the project root + DATABASE_URL="postgresql://postgres:[PASSWORD]@db.[PROJECT_REF].supabase.co:5432/postgres?sslmode=require" + PHOENIXD_HOST=localhost + PHOENIXD_HTTP_PASS_LIMITED=abc123 + ``` + +3. **Sync the database schema:** + ```bash + # This applies existing migrations to the staging database + npx prisma migrate deploy + ``` + +4. **Load sample data (optional):** + ```bash + npx prisma db seed + ``` + +That's it! You're ready to develop. The staging database is shared, so you'll see data from other developers. + +### Option 2: Local Database (For Self-Hosting) + +Run PostgreSQL in Docker on your local machine. Use this option if you want a completely isolated database or are self-hosting the project. + +1. **Start the PostgreSQL container:** + ```bash + docker compose up -d + ``` + + This will: + - Create a PostgreSQL 15 instance + - Set up a persistent volume for data storage + - Expose the database on port 5432 + - Configure the following credentials: + - User: aurora + - Password: aurora_dev_password + - Database: aurora_db + +2. **Set up your environment:** + ```bash + # Create a .env file in the project root + DATABASE_URL="postgresql://aurora:aurora_dev_password@localhost:5432/aurora_db" + PHOENIXD_HOST=localhost + PHOENIXD_HTTP_PASS_LIMITED=abc123 + ``` + +3. **Apply database migrations:** + ```bash + npx prisma migrate dev + ``` ### Loading Sample Data The project includes seed data to help you get started quickly. The seed data includes 5 sample contacts with various fields and metadata: -1. Load the seed data: +**For Staging Database:** +```bash +npx prisma db seed +``` + +**For Local Database:** ```bash npx prisma db seed ``` @@ -76,9 +120,9 @@ This will create sample contacts including: - Carol Crypto (privacy advocate) - Dave Decentralized (web5 developer) -To reset the database and reload seed data: +**Note:** On the staging database, seed data is shared. If you want to reset and reload seed data on your local database: ```bash -# Reset the database +# Reset the local database npx prisma migrate reset # Or manually: @@ -88,7 +132,7 @@ npx prisma db seed ### Managing the Database -Common database management commands: +**For Local Database (Docker):** ```bash # View database logs @@ -102,12 +146,19 @@ docker compose down -v # Access PostgreSQL CLI docker compose exec postgres psql -U aurora -d aurora_db +``` + +**For Both Options:** +```bash # Generate Prisma client after schema changes npx prisma generate -# Create a new migration after schema changes +# Create a new migration after schema changes (local only) npx prisma migrate dev --name + +# Apply migrations to staging database +npx prisma migrate deploy ``` ### Database Structure From d6fe55f8c332c5dec5ee4679fd3d1ec31aa98f9f Mon Sep 17 00:00:00 2001 From: sbddesign Date: Tue, 30 Dec 2025 08:50:43 -0500 Subject: [PATCH 2/2] update readme --- README.md | 99 ++++++++++++++++--------------------------------------- 1 file changed, 29 insertions(+), 70 deletions(-) diff --git a/README.md b/README.md index 5ed81d5..2a58052 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,8 @@ This is a work in progress. Things are rapidly being built and changed on variou ## Prerequisites - Node.js (v18 or later) +- Docker and Docker Compose - A Phoenix node running locally or remotely -- Docker and Docker Compose (only needed for local database setup) 1. Clone the repository: ```bash @@ -37,78 +37,44 @@ cp .env.example .env ## Database Setup -Aurora uses PostgreSQL for data storage. You have two options: +Aurora uses PostgreSQL for data storage, running in Docker for easy setup and management. -### Option 1: Staging Database (Recommended for Frontend Developers) -Use the hosted Supabase database - no Docker required! This is the recommended option for frontend developers who want to focus on UI/UX without worrying about backend setup. +If you are only working on the frontned UI, you can use a staging database on Supabase. In your `.env`, add this: -1. **Get the connection string:** - - Contact your team lead for the Supabase database connection string - - Or access it from the Supabase dashboard: Settings → Database → Connection string (use the "URI" format) - -2. **Set up your environment:** - ```bash - # Create a .env file in the project root - DATABASE_URL="postgresql://postgres:[PASSWORD]@db.[PROJECT_REF].supabase.co:5432/postgres?sslmode=require" - PHOENIXD_HOST=localhost - PHOENIXD_HTTP_PASS_LIMITED=abc123 - ``` - -3. **Sync the database schema:** - ```bash - # This applies existing migrations to the staging database - npx prisma migrate deploy - ``` - -4. **Load sample data (optional):** - ```bash - npx prisma db seed - ``` - -That's it! You're ready to develop. The staging database is shared, so you'll see data from other developers. +``` +DATABASE_URL="postgresql://postgres.PROJECT_ID:PASSWORD@aws-1-us-east-2.pooler.supabase.com:5432/postgres" +``` -### Option 2: Local Database (For Self-Hosting) +Replace `PROJECT_ID` and `PASSWORD` with the proper credentials. -Run PostgreSQL in Docker on your local machine. Use this option if you want a completely isolated database or are self-hosting the project. -1. **Start the PostgreSQL container:** - ```bash - docker compose up -d - ``` +### Starting the Database (Devs Only) - This will: - - Create a PostgreSQL 15 instance - - Set up a persistent volume for data storage - - Expose the database on port 5432 - - Configure the following credentials: - - User: aurora - - Password: aurora_dev_password - - Database: aurora_db +1. Start the PostgreSQL container: +```bash +docker compose up -d +``` -2. **Set up your environment:** - ```bash - # Create a .env file in the project root - DATABASE_URL="postgresql://aurora:aurora_dev_password@localhost:5432/aurora_db" - PHOENIXD_HOST=localhost - PHOENIXD_HTTP_PASS_LIMITED=abc123 - ``` +This will: +- Create a PostgreSQL 15 instance +- Set up a persistent volume for data storage +- Expose the database on port 5432 +- Configure the following credentials: + - User: aurora + - Password: aurora_dev_password + - Database: aurora_db -3. **Apply database migrations:** - ```bash - npx prisma migrate dev - ``` +2. Apply database migrations: +```bash +npx prisma migrate dev +``` ### Loading Sample Data The project includes seed data to help you get started quickly. The seed data includes 5 sample contacts with various fields and metadata: -**For Staging Database:** -```bash -npx prisma db seed -``` - -**For Local Database:** +1. Load the seed data: ```bash npx prisma db seed ``` @@ -120,9 +86,9 @@ This will create sample contacts including: - Carol Crypto (privacy advocate) - Dave Decentralized (web5 developer) -**Note:** On the staging database, seed data is shared. If you want to reset and reload seed data on your local database: +To reset the database and reload seed data: ```bash -# Reset the local database +# Reset the database npx prisma migrate reset # Or manually: @@ -132,7 +98,7 @@ npx prisma db seed ### Managing the Database -**For Local Database (Docker):** +Common database management commands: ```bash # View database logs @@ -146,19 +112,12 @@ docker compose down -v # Access PostgreSQL CLI docker compose exec postgres psql -U aurora -d aurora_db -``` - -**For Both Options:** -```bash # Generate Prisma client after schema changes npx prisma generate -# Create a new migration after schema changes (local only) +# Create a new migration after schema changes npx prisma migrate dev --name - -# Apply migrations to staging database -npx prisma migrate deploy ``` ### Database Structure