Stack 🏓

Dockerized (postgres + nginx + golang + react) starter kit

Only implements users, sessions, password_resets, and a toy post type to demonstrate basic CRUD.

Features and Stack

  • Hot-reload, front and back, including a test-runner for golang changes

Back-end

  • golang-migrate already configured for easy migrations
  • sqlc for auto-generated sql bindings
  • golang-jwt cookies with automatic refresh: ready for horizontal

Front-end

Requirements

Install docker && docker-compose

Quick Start

# clone the repo
git clone git@github.com:vineetsgr07/ecommerce-golang.git

# copy the .env template for your local version
cp .env.example .env

# build and start the containers
docker-compose up
  1. Visit http://localhost:4500
  2. Make changes to go, sql, or react code, and enjoy hot-reload goodness!

Run client-side test watcher

docker-compose exec react npm run test

Database Helpers

Migrations

Migrations are created and run using simple wrappers around go-migrate.

# create files for a new migration
postgres/new my_migration_name

# execute any new migrations (this is also run automatically the container is created)
postgres/migrate up

# go down 1 migration
postgres/migrate down 1

# goto a migration by index
postgres/migrate goto 3

Open a psql client

# remember to use \q to exit
postgres/psql