You ever had a 20 year old Cisco IP phone and wanted to put a phonebook on it? Well, me neither. Pass the bottle.
  • Go 52.2%
  • templ 24%
  • HTML 22.9%
  • Makefile 0.9%
Find a file
2026-05-26 15:37:24 +02:00
db Move to LDAP 2026-05-26 15:17:54 +02:00
res Move to LDAP 2026-05-26 15:17:54 +02:00
templates Move to LDAP 2026-05-26 15:17:54 +02:00
.gitignore remove compiled css 2026-05-22 00:28:20 +02:00
addressbook.service setup for deployment 2026-05-26 15:37:24 +02:00
admin.go Move to LDAP 2026-05-26 15:17:54 +02:00
app.go setup for deployment 2026-05-26 15:37:24 +02:00
CLAUDE.md admin + base (or layout if you will) for future functionality 2026-05-21 00:00:22 +02:00
config.go Move to LDAP 2026-05-26 15:17:54 +02:00
dbservice.go Move to LDAP 2026-05-26 15:17:54 +02:00
extracontacts.go Move to LDAP 2026-05-26 15:17:54 +02:00
go.mod Move to LDAP 2026-05-26 15:17:54 +02:00
go.sum Move to LDAP 2026-05-26 15:17:54 +02:00
ldap_server.go Move to LDAP 2026-05-26 15:17:54 +02:00
main.css init 2026-05-20 22:32:47 +02:00
makefile admin + base (or layout if you will) for future functionality 2026-05-21 00:00:22 +02:00
models.go i ♥️ boileprlateslop 2026-05-21 00:28:52 +02:00
package-lock.json init 2026-05-20 22:32:47 +02:00
package.json init 2026-05-20 22:32:47 +02:00
phonedirectory.go Move to LDAP 2026-05-26 15:17:54 +02:00
README.md setup for deployment 2026-05-26 15:37:24 +02:00
slack.go Move to LDAP 2026-05-26 15:17:54 +02:00
slackcontacts.go Move to LDAP 2026-05-26 15:17:54 +02:00
util.go Move to LDAP 2026-05-26 15:17:54 +02:00

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

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.