sortable-example

module
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2026 License: MIT

README

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

Directories

Path Synopsis
cmd
server command
internal
database/internal/fake
Code generated by counterfeiter.
Code generated by counterfeiter.
domain/internal/fake
Code generated by counterfeiter.
Code generated by counterfeiter.
hypertext/internal/fake
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL