Skip to content

Latest commit

 

History

History
94 lines (65 loc) · 2.24 KB

File metadata and controls

94 lines (65 loc) · 2.24 KB

Docker Configuration

This directory contains all Docker-related configuration files for the Better Auth Backend project.

Structure

docker/
├── docker-compose.yml          # PostgreSQL + Adminer services configuration
├── postgres/
│   ├── init.sql               # Database initialization script
│   └── scripts/               # Additional SQL scripts (optional)
└── README.md                  # This file

Services

  • PostgreSQL 15: Main database server
  • Adminer: Lightweight web-based database management tool

Usage

From Project Root

# Start PostgreSQL + Adminer
docker compose -f docker/docker-compose.yml up -d

# Stop all services
docker compose -f docker/docker-compose.yml down

# Remove data volumes (fresh start)
docker compose -f docker/docker-compose.yml down -v

From Docker Directory

cd docker

# Start all services
docker compose up -d

# Stop all services
docker compose down

Adminer Database Viewer

Access URL: http://localhost:8080

Login Credentials:

  • System: PostgreSQL
  • Server: postgres
  • Username: app_user
  • Password: app_password
  • Database: app_db

Features:

  • Browse all Better Auth tables (user, session, account, verification)
  • Run SQL queries
  • Export/import data
  • View table structures and relationships

Database Initialization

  • postgres/init.sql: Creates Better Auth schema tables automatically
  • postgres/scripts/: Additional SQL scripts run in alphabetical order
  • One-Time Setup: Initialization only runs when data volume is empty

Ports

  • 5432: PostgreSQL database server
  • 8080: Adminer web interface

Environment Variables

The following environment variables are used:

  • POSTGRES_DB: app_db
  • POSTGRES_USER: app_user
  • POSTGRES_PASSWORD: app_password

These match the configuration in your .env file.

Health Check

The PostgreSQL container includes a health check that verifies the database is ready before your application connects.

Volumes

  • postgres_data: Persistent storage for database data
  • Init Scripts: Mounted from ./postgres/ directory

Network

  • app_network: Isolated network for the application services