Sitemap

Building social features using DynamoDB and Lambda

4 min readApr 8, 2023

Last month, we added some simple social features to Street Art Cities. These allow you to follow any entity on the platform (cities, artists, users), view a personalised feed of items related to those entities, and be notified when new items from entities you follow are posted.

Press enter or click to view image in full size

Street Art Cities is built as a set of serverless services on AWS Lambda and DynamoDB, and figuring out the best architecture for this new functionality was a lot of fun.

Single-table design

Street Art Cities runs on a single DynamoDB table with about two dozen different entity types. For the new social functionality, we introduced two new ones: Follow and Activity.

I tend to use Google Sheets or something similar to figure out how these entities should be laid out across the indexes in the table in a way that works with our access patterns. For these new entities, this looked roughly like this:

Press enter or click to view image in full size

The following access patterns were kept into account:

Follow

  • Get list of followers of entity: pk=follow#user_{me}
  • Get list of followed…

--

--

Thomas Schoffelen
Thomas Schoffelen

Written by Thomas Schoffelen

Entrepreneur tech kid, co-founder of NearSt, Londoner, open source enthusiast and aspiring spare time literature geek.

No responses yet