Skip to content

typelate/sortable-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sortable Example

A drag-and-drop task list built with Go, htmx, and SortableJS. Tasks within a list can be reordered by dragging, and the new order is persisted to PostgreSQL.

Stack

  • muxt — template-driven HTTP routing
  • htmx + SortableJS — drag-and-drop reordering without a JS framework
  • sqlc — type-safe SQL queries
  • pgx — PostgreSQL driver

Installing tools

  • go install github.com/typelate/muxt@latest
  • go install github.com/maxbrunsfeld/counterfeiter/v6@latest

Once they are installed, you can run go generate ./....

Running

Set the DATABASE_URL environment variable and run:

go run github.com/typelate/sortable-example/cmd/server

The server listens on PORT (default 8080).

Goose-like migrations run automatically on startup.

Testing

Unit tests (no database required):

go test ./...

Integration tests in internal/database require a running PostgreSQL instance reachable via DATABASE_URL. They are skipped automatically when the database is unavailable.

License

MIT

About

An example app using muxt, htmx, sortable.js, and Postgres (pgx)

Topics

Resources

Stars

Watchers

Forks

Used by

Contributors

Languages