<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Lukest Mensah</title>
    <description>The latest articles on DEV Community by Lukest Mensah (@lukestaws).</description>
    <link>https://dev.to/lukestaws</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3668820%2F437975a2-3b70-47af-acd2-0f76895b629e.png</url>
      <title>DEV Community: Lukest Mensah</title>
      <link>https://dev.to/lukestaws</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lukestaws"/>
    <language>en</language>
    <item>
      <title>Week 1: Dockerised URL Shortener with Redis Caching &amp; CI/CD – Live Demo</title>
      <dc:creator>Lukest Mensah</dc:creator>
      <pubDate>Thu, 18 Dec 2025 12:32:11 +0000</pubDate>
      <link>https://dev.to/lukestaws/week-1-dockerised-url-shortener-with-redis-caching-cicd-live-demo-33nd</link>
      <guid>https://dev.to/lukestaws/week-1-dockerised-url-shortener-with-redis-caching-cicd-live-demo-33nd</guid>
      <description>&lt;p&gt;As an ex-Uber driver grinding 1.5-hour mornings and full Thursdays, I’m on a 20-week mission to land a £100k+ AWS role. I wanted to move beyond "Hello World" tutorials and build something that felt production-ready. Week 1–2 of my "AWS Portfolio Battle Plan" is officially complete: &lt;em&gt;&lt;strong&gt;Docker Fundamentals &amp;amp; Deep Dive&lt;/strong&gt;&lt;/em&gt;, capped off with a live, high-performance URL shortener.&lt;/p&gt;

&lt;p&gt;I built &lt;em&gt;&lt;strong&gt;LukestAWS URL Shortener&lt;/strong&gt;&lt;/em&gt;, a service that doesn't just shorten links, it handles them with a performance-first mindset using Redis caching and PostgreSQL.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Architecture&lt;/strong&gt;&lt;br&gt;
I chose a modern, asynchronous stack to ensure the app could handle high concurrency without breaking a sweat:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; &lt;em&gt;&lt;strong&gt;FastAPI&lt;/strong&gt;:&lt;/em&gt; For high-performance, async routing and automatic Swagger documentation.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;PostgreSQL (15-alpine):&lt;/strong&gt;&lt;/em&gt; Reliable persistent storage for URL mappings.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;Redis (Upstash):&lt;/strong&gt;&lt;/em&gt; A serverless cache layer that prevents unnecessary database hits.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;Docker:&lt;/strong&gt;&lt;/em&gt; Multi-stage builds to keep production images lean and secure, running as a non-root user.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;Fly.io:&lt;/em&gt;&lt;/strong&gt; Deployed on the edge to keep latency low.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Performance in Action: Redis Caching&lt;/strong&gt;&lt;br&gt;
The Redis integration is the star of the show. By caching both the long-to-short and short-to-long mappings, we bypass the database for repeat requests.&lt;/p&gt;

&lt;p&gt;·  First Request: Database write + Cache set.&lt;br&gt;
·  Second Request:  Instant Cache Hit.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi0t6udtuguwcpigmzu1u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi0t6udtuguwcpigmzu1u.png" alt="First Request: Database write + Cache set" width="800" height="514"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Falrf7sdj9f2hff80ewve.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Falrf7sdj9f2hff80ewve.png" alt="Second Request:  Instant Cache Hit" width="800" height="517"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Code: How it Works&lt;/strong&gt;&lt;br&gt;
Here is a look at the shortener handler. Notice how it checks the cache first before even touching the database:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1r3qompihx9ulpr5rofu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1r3qompihx9ulpr5rofu.png" alt="Python Code" width="780" height="349"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The "Aha!" Moments (Challenges Overcome)&lt;/strong&gt;&lt;br&gt;
The most educational part of this build wasn't the code that worked, but the code that didn't.&lt;br&gt;
·  &lt;em&gt;&lt;strong&gt;The SQLAlchemy Dialect Trap:&lt;/strong&gt;&lt;/em&gt; While deploying, I hit a NoSuchModuleError. I learned the hard way that &lt;em&gt;&lt;strong&gt;SQLAlchemy 2.0&lt;/strong&gt;&lt;/em&gt; dropped support for the postgres:// prefix. A quick regex fix to swap the environment variable to postgresql:// saved the day.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Try it Out&lt;/strong&gt;&lt;br&gt;
Check out the project in action:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;Live Demo:&lt;/em&gt;&lt;/strong&gt; aws-url-shortener.fly.dev&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;Interactive Docs:&lt;/strong&gt;&lt;/em&gt; /docs (Authorize with your API key to test!)&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;Health Check:&lt;/strong&gt;&lt;/em&gt; Check Status&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Next week: Serverless SaaS with AWS CDK. Follow for the journey as I battle through the next 18 weeks!&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>fastapi</category>
      <category>docker</category>
      <category>aws</category>
    </item>
  </channel>
</rss>
