Backend
We are using NPM to generate our css using tailwind.
In development, make sure to clear browser cache to get fresh stylesheets.
npm installTo get started with TailWind CSS, make sure you have the correct binary in the root directory.
https://tailwindcss.com/blog/standalone-cli
Templating
go install github.com/a-h/templ/cmd/templ@latestServer-Side Interactivity
Client-Side Interactivity
Database
The *.sql files in internal/db are in psql syntax. If only SQLC could generate files from the .psql file extension. One can dream
Object Relational Mapping
go install github.com/sqlc-dev/sqlc/cmd/sqlc@latestServer Routing
- make - utility
- install for Windows:
choco install make - install for MacOS:
brew install make - no need for explanation to linux users
- install for Windows:
- air - for development live-reloading
- npm - for npm packages (Tailwindcss with plugins)
- install Node
- install packages run
npm i
Using the Go port of DotEnv. Example .env file for development:
DB_HOST="127.0.0.1"
DB_PORT="5432"
DB_DATABASE="sqlc-example"
DB_USERNAME="postgres"
DB_PASSWORD="password"git clone https://github.com/markkhoo/GOTTH.git
cd GOTTH
make dev
This Makefile is designed to simplify common development tasks for your project. It includes targets for building your Go application, watching and building Tailwind CSS, generating templates, and running your development server using Air.
This target watches the ./static/css/input.css file and automatically rebuilds the Tailwind CSS styles whenever changes are detected.
make tailwind-watchThis target minifies the Tailwind CSS styles by running the tailwindcss command.
make tailwind-buildThis target generates templates using the templ command.
make templ-generateThis target generates database controllers in go using the sqlc command.
make sqlc-generateThis target runs the development server using Air, which helps in hot-reloading your Go application during development.
make devThis target orchestrates the building process by executing the tailwind-build, templ-generate, sqlc-generate, and go build commands sequentially. It creates the binary output in the ./bin/ directory.
make build