lkmail Update 1.13: Centralizing External Links
Welcome to Update 1.13 of the lkmail development journey!
As a codebase grows, one of the easiest ways to introduce technical debt is by scattering hardcoded values throughout your UI components. Today, we applied a fantastic architectural reflex to prevent this: centralizing our external links.
The Danger of Hardcoded Strings
In our last update, we fixed a Markdown artifact in our GitHub URL. However, the absolute URL was still hardcoded directly inside src/components/Footer.tsx.
If I ever changed my GitHub handle, or if I wanted to reference my GitHub profile in another component (like an About page or a Contact section), I would have to hunt down and update multiple files manually.
The KISS Solution: EXTERNAL_LINKS
To keep the codebase perfectly DRY (Don't Repeat Yourself), I updated our centralized routing file (src/lib/routes.ts) to include a new EXTERNAL_LINKS constant.
Because external URLs do not need to be dynamically translated based on the user's locale (unlike our internal localized ROUTES), they get their own dedicated, immutable object:
// External links centralized to avoid hardcoding across components
export const EXTERNAL_LINKS = {
GITHUB: "[https://github.com/lionel-kaufmann](https://github.com/lionel-kaufmann)",
} as const;
Refactoring the Footer
With the data securely centralized, I refactored the Footer.tsx blueprint to import and consume this new constant.
import { EXTERNAL_LINKS } from "@/lib/routes";
export default function Footer() {
const year = new Date().getFullYear();
return (
<footer className="border-t border-gray-200 dark:border-gray-800 py-8 mt-16">
{/* ... */}
<a
href={EXTERNAL_LINKS.GITHUB}
target="_blank"
rel="noopener noreferrer"
className="hover:text-gray-900 dark:hover:text-white transition-colors"
>
GitHub
</a>
{/* ... */}
</footer>
);
}
By abstracting the URL, the Footer component is now purely focused on presentation.
Small refactors like this compound over time, ensuring that the lkmail architecture remains incredibly resilient and easy to update. The UI is clean, the data is centralized, and we are ready for the next big feature!