A multi-tenant payroll and employee-directory service. Companies manage their own staff records; company admins run payroll.
go run .Listens on 127.0.0.1:8088. Set ADDR to change that. No dependencies, no
database — the store is in memory and reseeds on every start.
go test ./...curl -s -X POST 127.0.0.1:8088/auth/login \
-H 'Content-Type: application/json' \
-d '{"email":"jane@acme.test","password":"password"}'Returns a bearer token valid for 15 minutes. Send it on every other endpoint:
curl -s 127.0.0.1:8088/whoami -H "Authorization: Bearer <token>"| Method | Path |
|---|---|
GET |
/health |
POST |
/auth/login |
GET |
/whoami |
GET |
/companies/{companyId}/employees |
GET |
/companies/{companyId}/employees/{employeeId} |
PATCH |
/companies/{companyId}/employees/{employeeId} |
POST |
/companies/{companyId}/payroll |
Every account has the password password.
| Company | Employee | Role |
|---|---|---|
Acme (c_acme) |
e_jane — jane@acme.test |
employee |
| Acme | e_john — john@acme.test |
manager |
| Acme | e_alice — alice@acme.test |
company admin |
Globex (c_globex) |
e_bob — bob@globex.test |
employee |
| Globex | e_carol — carol@globex.test |
manager |
| Globex | e_dave — dave@globex.test |
company admin |
Platform (c_platform) |
e_sam — sam@payroll.test |
platform admin |
Jane reports to John, who reports to Alice. Bob reports to Carol, who reports to Dave.
| File | Contents |
|---|---|
main.go |
Entry point and routing |
auth.go |
Token issuing, verification, request authentication |
handlers.go |
Endpoint handlers |
store.go |
Domain types and the in-memory store |
api_test.go |
Endpoint tests |