PHIN VADS written in Go. Load phinvads.dump into a PostgreSQL database using pg_restore, run the app with air, and go!
Clone the repo:
git clone https://github.com/skylight-hq/phinvads-go.git
cd phinvads-go- Install direnv (
brew install direnv) - Add a hook for your shell
- Restart your terminal
- Run
direnv allowin the project directory
Download and install Docker if you don't already have it installed.
- Place
phinvads.dumpinto the top level of your project directory (/phinvads-go) - Navigate to the project directory and start your PostgreSQL database with
make start - Run
make refreshto create thephinvadsdatabase and load in the data
When you want to shut down your database environment, run make stop.
-
Install and run PostgreSQL
-
Create an empty database:
psql -c 'CREATE DATABASE phinvads' -
Load the database dump file:
pg_restore -d phinvads --no-owner --role=$(whoami) phinvads.dump
-
Install Go
-
Install air:
go install github.com/air-verse/air@latest
-
Install templ
go install github.com/a-h/templ/cmd/templ@latest
-
Install mkcert
-
Create your own self-signed certs for local development:
cd tls mkcert -install mkcert localhost cd ..
-
Run the app! If you are only working on backend code, you can just run a simple live reload with air:
air
-
Air will also work for the frontend, but you will have to refresh your browser every time you make a change. To get automatic browser reloads, run the app this way:
templ generate --watch --proxy="http://localhost:4000" # Then, in a separate terminal window, run air: air -c .air-with-proxy.toml