- Go 52.2%
- templ 24%
- HTML 22.9%
- Makefile 0.9%
| db | ||
| res | ||
| templates | ||
| .gitignore | ||
| addressbook.service | ||
| admin.go | ||
| app.go | ||
| CLAUDE.md | ||
| config.go | ||
| dbservice.go | ||
| extracontacts.go | ||
| go.mod | ||
| go.sum | ||
| ldap_server.go | ||
| main.css | ||
| makefile | ||
| models.go | ||
| package-lock.json | ||
| package.json | ||
| phonedirectory.go | ||
| README.md | ||
| slack.go | ||
| slackcontacts.go | ||
| util.go | ||
Addressbook
A web-based phone directory that pulls contacts from a company Slack workspace and lets you sprinkle in extras on top. Contacts are served over:
- HTTP — admin panel at
/admin, public landing at/ - XML — Yealink / Cisco IP-phone compatible feed at
/directory.xml - LDAP — standard directory protocol on port
389(configurable)
Built with Go, SQLite, templ, and Tailwind CSS v4. Ships as a single self-contained binary.
Building
# Prerequisites: Go ≥ 1.22, Node ≥ 18, make
make all # clean → CSS → templates → binary → bin/app.exe / bin/app
Cross-compile for Linux from any OS:
GOOS=linux GOARCH=amd64 go build -o bin/addressbook .
Installing on Linux (systemd)
1 — Create a dedicated user and directories
sudo useradd --system --no-create-home --shell /usr/sbin/nologin addressbook
sudo mkdir -p /etc/addressbook
sudo mkdir -p /var/lib/addressbook
sudo chown root:addressbook /etc/addressbook
sudo chmod 750 /etc/addressbook
sudo chown addressbook:addressbook /var/lib/addressbook
sudo chmod 750 /var/lib/addressbook
2 — Install the binary
sudo cp bin/addressbook /usr/local/bin/addressbook
sudo chmod 755 /usr/local/bin/addressbook
3 — Create the environment file
sudo cp addressbook.service /etc/systemd/system/addressbook.service
sudo nano /etc/addressbook/env
Minimum contents of /etc/addressbook/env:
# Database path (writable by the addressbook user)
DB_PATH=/var/lib/addressbook/addressbook.db
# Slack integration
SLACK_API_KEY=xoxb-your-bot-token-here
# Default country prefix for phone normalisation (E.164)
PHONE_PREFIX=+420
# LDAP port — 389 requires CAP_NET_BIND_SERVICE (already set in the unit file)
# Change to e.g. 3389 if you prefer a high port (and remove the Capabilities
# lines from the unit file)
LDAP_PORT=389
# HTTP port (default 8080)
# HTTP_PORT=8080
Lock down the file so only root and the service account can read it:
sudo chown root:addressbook /etc/addressbook/env
sudo chmod 640 /etc/addressbook/env
4 — Enable and start the service
sudo systemctl daemon-reload
sudo systemctl enable --now addressbook
Check it came up cleanly:
sudo systemctl status addressbook
sudo journalctl -u addressbook -f
Upgrading
make all
sudo systemctl stop addressbook
sudo cp bin/addressbook /usr/local/bin/addressbook
sudo systemctl start addressbook
Configuration reference
All configuration is through environment variables (set in /etc/addressbook/env
for the systemd service, or in a .env file in the working directory for local dev).
| Variable | Default | Description |
|---|---|---|
DB_PATH |
addressbook.db |
Path to the SQLite database file |
SLACK_API_KEY |
— | Slack bot token (xoxb-…) |
PHONE_PREFIX |
+420 |
Default country code for phone normalisation |
LDAP_PORT |
389 |
LDAP server listen port |
LDAP — Yealink T33G setup
See the admin panel at /admin for the base DN.
Quick reference for Directory → LDAP in the phone web UI:
| Field | Value |
|---|---|
| Server Address | IP of this server |
| Port | 389 (or your LDAP_PORT) |
| Base | ou=people,dc=addressbook,dc=local |
| User / Password | (leave empty — anonymous bind) |
| LDAP Name Filter | (cn=%) |
| LDAP Number Filter | (telephoneNumber=%) |
| LDAP Name Attributes | cn sn |
| LDAP Number Attributes | telephoneNumber |
| LDAP Display Name | %cn |
| Protocol | LDAPv3 |
Development
cp .env.example .env # fill in SLACK_API_KEY at minimum
go run . # starts on :8080 (HTTP) and :389 (LDAP)
The scheduler syncs Slack contacts every 2 minutes and regenerates the XML directory every 5 minutes.