VetPet
· 1 min
gosqlitebootstrapsecurity
A small veterinary clinic application: owners and their pets, with search, create, edit and delete screens (Bootstrap 5) behind a login. It was a Spring Boot and Thymeleaf application; this is the same set of pages written in Go, as one binary without a Java runtime.
What is inside?
- Form login with a server side session. The cookie is
HttpOnlyandSameSite=Lax, a new session id is issued at every sign-in, and passwords are kept as bcrypt hashes. - Two roles: an admin can delete, a user can read, create and edit.
- Cross-site form posts are refused with Go's
CrossOriginProtection, so the pages need no CSRF token field. - Data in memory, or in a SQLite file. SQLite is the pure Go
modernc.org/sqlite, so no C compiler is needed. - Bootstrap is embedded in the binary.
- The search ignores case for every letter:
şükfindsŞükrü.
go run ./cmd/vetpet # http://localhost:8080, data in memory
docker compose up --build # data in a volume
The demo logins are admin / admin and user / user. They are demo passwords and the log warns while they are in use.
Source code: github.com/ergulcu/vetpet