Eventide is an event-driven inventory web app built with Go, PostgreSQL, and vanilla HTML/CSS/JS.
It focuses on operational visibility:
- current stock by warehouse
- immutable inventory event log
- daily in/out movement summaries
- warehouse-aware filtering across views
- Backend: Go (
net/http) - Database: PostgreSQL (
pgxconnection pool) - Frontend: Static HTML/CSS/JS served by the Go app
- Auth: Cookie-based in-memory sessions
.
|- main.go # Route wiring + static/app handlers
|- auth.go # Login/logout/session middleware
|- database.go # DB connection init/close
|- handlers.go # API handlers (items, inventory, events, etc.)
|- statements.go # Daily statements query logic
|- models.go # Shared data models
|- Project Documentation/
| |- schema.sql # DB schema + seed data
|- static/
| |- index.html # Public landing page
| |- dashboard.html # Protected app landing (/app/)
| |- inventory/ # Current Stock page
| |- events/ # Event Log page
| |- warehouses/ # Warehouses page
| |- daily-history/ # Daily History page
| |- login/ # Login page
- Inventory changes are recorded as immutable rows in
events. - Snapshot quantities are maintained by DB logic (see
schema.sql). - UI pages consume authenticated
/api/*endpoints. - App pages are served under
/app/*and require a valid session.
- Go 1.25+
- PostgreSQL
Run the SQL in Project Documentation/schema.sql to create tables, triggers, and seed data.
Edit the connection string in database.go:
const connStr = "postgres://postgres:admin123@127.0.0.1:5432/eventide"Update user/password/host/port/database as needed for your machine.
go mod tidygo run .Server starts on:
http://localhost:3000
GET /- public landing pageGET /login/- login UIPOST /api/login- login endpointGET /logout- clear session and redirect to/
/app/- dashboard/app/inventory//app/events//app/warehouses//app/daily-history/
GET /api/itemsPOST /api/itemsPUT /api/items/{id}GET /api/inventoryGET /api/eventsPOST /api/eventsGET /api/usersGET /api/warehousesGET /api/daily-statements?start_date=YYYY-MM-DD&end_date=YYYY-MM-DD[&item_id=N][&warehouse_code=CODE]
curl -i -X POST http://localhost:3000/api/login \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"admin123"}'curl -b "session_token=YOUR_TOKEN" http://localhost:3000/api/inventorycurl -X POST http://localhost:3000/api/events \
-H "Content-Type: application/json" \
-b "session_token=YOUR_TOKEN" \
-d '{
"item_id": 1,
"warehouse_id": 1,
"quantity_change": 10,
"type": "inbound",
"reason_code": "restock"
}'curl -b "session_token=YOUR_TOKEN" \
"http://localhost:3000/api/daily-statements?start_date=2026-03-01&end_date=2026-03-31&warehouse_code=WH-A"- Session cookie name:
session_token - Session storage is in-memory (
auth.go) - Sessions expire after 12 hours
- Restarting the server clears active sessions
- Verify PostgreSQL is running.
- Verify
connStrindatabase.gois correct. - Ensure
eventidedatabase exists and schema has been applied. - Run
go test ./...to confirm compile health.
- You must be logged in first (
POST /api/login). - Ensure browser/curl is sending
session_tokencookie.
- Confirm
/api/warehouses,/api/items,/api/events,/api/inventoryreturn data. - Check browser devtools network tab for failed requests.