Introducing Libraree

Chris Wood
All Geek To Me
Published in
6 min readJan 2, 2022
UK library cards in your Apple Wallet or Wallet Passes on Android

Libraries are amazing

One of the most under-valued assets in British society is our libraries. Quite simply, they’re an utterly amazing portal into other worlds and lives. They’re open to everyone and are completely free.

Our libraries are also evolving. They’re not the same book-oriented libraries your grandmother would visit; they’re that and more!

All yours for free on Libby!

Want to get the latest magazines on your iPad for free without paying a penny? Most UK libraries offer you the Libby app.

Want to get today’s daily newspapers from the UK and around the world and not have to pay a £20+ subscription? Pressreader is included with many library services’ memberships.

Want to read e-books or listen to Audiobooks without paying for each item you download or a £15-per-month Audible subscription? Borrowbox gives you just that and is available from most libraries.

Borrowbox

Want a warm space with friendly people and free wifi? Research your family tree using the leading services but without forking out several hundred pounds?

You get the idea; seriously, join your local library now!

Amazing, but also not that great.

Library services are chronically under-funded. 2020 saw a reduction in funding of £20m and further 14% reduction was anticipated for 2021.

Searching for library books

Individual library services don’t really innovate from a technology perspective and procure closed-access systems from a small market of vendors addressing the sector.

All of this goes some way to explain why some of the actions we take for granted in our modern electronic world still aren’t easily done when it comes to libraries.

Say you’ve found a book while you’re stood in a bookshop. Surely I can just scan the barcode and find out which of my local libraries has it in stock so I can reserve it? Erm, no, probably not.

Or say you’re the kind of person who only carries a mobile around; you don’t need a physical wallet because you pay for stuff using Apple or Google Pay. Want to add your library cards to your mobile wallet so you can just drop by whenever the mood takes you? You’re out of luck, buddy.

Most libraries don’t have an app, those that do don’t have an Apple Wallet capability and that’s most likely because your library uses barcodes that Apple Wallet doesn’t understand. So you still need to carry around those old-fashioned plastic things.

So, you’re out of luck. Or, at least, you were out of luck.

Say ‘hello’ to Libraree!

I’ve started a new project to start making awesome library things easier and more relevant to people’s day-to-day technology expectations.

Libraree catalogue search

I live on the boundary of several local and unitary authorities so I’m a member of three different library services: Wigan, Lancashire and Manchester. That gives me more opportunity to find a book I want to read, but would otherwise come at the cost of having to search multiple separate library catalogues separately.

The main Libraree app will allow you to search for books by title, author or ISBN across your choice of library service catalogues and gives you a simple overview of availability:

One further tap is all it takes to be taken to your library’s catalogue and reservation page.

Library cards for your Apple Wallet

Meanwhile the Libraree Cards site will generate a branded library card for your Apple Wallet or Wallet Passes on Android.

It includes a traditional one-dimensional barcode that matches the one on your physical card as well as a QR-code representation which are increasingly supported by self-service kiosks.

Any details you enter to create your library card are never shared with another party and don’t travel over the internet. In fact, most of the library card generation process happens entirely on your own device.

Hope you find these new tools useful! I also have a few other library-related ideas that I’ll work on in my free time in 2022.

Tech notes

Both the catalogue search and Apple Wallet apps were created using Svelte for the frontend and Azure Functions written in NodeJS for the backend. Svelte just makes sense to me far more than most other Javascript frameworks, and pairing it with serverless functions that only cost fractions of a penny per execution makes implementation easy and costs cheap.

Because each library service procures its own catalogue system and because they’re generally closed systems, book searches are carried out using screen scraping via the catalogues-library NPM package. This is certainly a point of potential weakness and one I’d love to replace with genuine API connections in the future, but I suspect that would require me to engage with over 300 different library services across the UK, so it’s not a journey I’m eager to embark upon.

The library card app required the sourcing of logos for all of the UK’s local and unitary authorities as well as coming up with matching branding colours for text and backgrounds. After a ton of initial research, this was largely done using code, using Selenium to grab Twitter avatars and convert them to PNG images and then using a port of Android’s Palette API to derive appropriate colour palettes. The overall dataset was then reviewed by hand and tweaked as necessary.

Barcodes are scanned and recognised using quagga2, to which I’ve contributed a Telepen barcode reader. Telepen is one of the most common barcode symbologies used by UK libraries.

Traditional one-dimensional barcodes are generated using bwip-js and are embedded within the Apple Wallet pass as stripe images. This is how I’ve managed to get some of the older barcode symbologies to appear on the pass.

I chose to include a QR code because without one of the official Apple barcodes, iPhones won’t increase their brightness to make scanning easier. Additionally, quite a few self-service kiosks will happily scan QR codes now, even if it’s a completely different symbology to the ones used on an authority’s library cards.

At no point are library card details sent over the internet. That means that the “pkpass” file — actually a renamed zip file with a signature file inside — is generated within the browser, with only the signing happening on a server operated by me. The signature is derived from the checksums of the individual files listed within a manifest file, not based on the zip file itself, which is how a signature can still be generated without the content being transferred anywhere.

The projects have also introduced me to many of the image manipulation possibilities that are now possible in client-side Javascript (zooming, cropping, resizing, panning) as well handling of Blob objects, allowing you to download a file that’s been created in client memory rather than streamed from a server.

--

--