Phase 8Days 36-40

PostgreSQL, Transactions & Authentication

database/sql, migrations, SQL-first repositories, sessions, and authorization

Phase Goal

Persist real application state safely and enforce authentication and authorization server-side.

Progress

Day 36: PostgreSQL & database/sql

Day 37: Schema Design, Migrations & Repositories

Day 38: Transactions, Isolation & Allocation Conflicts

Day 39: Sessions, Passwords & Authorization

Day 40: Mini Project — Laboratory Sample Custody API

Capstone
Laboratory Sample Custody API

Track biological samples from intake through technician handoffs, storage, analysis, and disposal while preserving an append-only custody history.

  • Concurrent handoffs cannot assign one sample to two custodians
  • Session auth plus sample- and role-level authorization
  • Reversible migrations and real-PostgreSQL integration tests

Phase Complete!

After this phase, you'll be able to:

  • sql.DB as a concurrent connection pool
  • Drivers, PingContext, and pool configuration
  • QueryRowContext, QueryContext, Scan, and rows.Close
  • Prepared statements and parameterized SQL
  • Keys, constraints, indexes, and timestamps
  • Forward migrations and reproducible environments
  • Repository boundaries without hiding SQL
  • sqlc awareness and compile-time query shapes

You can apply Phase 8 skills in a finished, explainable Go project.