urlshare-scalable-self-cleaning-file-sharing

Urlshare: A Scalable, Self-Cleaning File-Sharing Platform

A developer's portfolio is defined by the practical friction it eliminates. Most cloud storage tools suffer from a hidden flaw: they accumulate digital waste. When users upload temporary files, those files often sit on servers indefinitely, creating "link rot" and ballooning infrastructure costs.

To solve this, I engineered Urlsharea high-performance, full-stack file-sharing platform designed to provide a seamless, secure, and automated way to transfer data without the clutter.

Blog image



The Tech Stack: Why I Chose PERN & Next.js

To build a platform capable of handling asynchronous file transfers and automated cleanup logic, I needed an ecosystem that offered speed, relational data integrity, and excellent asset delivery.

1. Next.js & React (Frontend)

I utilized Next.js to ensure the platform interface is lightning-fast. Leveraging Server-Side Rendering (SSR) where appropriate, Urlshare minimizes time-to-first-byte, delivering a responsive user experience from the moment a link is clicked.

2. Node.js & PostgreSQL (Backend & Database)

For the backend engine, Node.js handles incoming requests efficiently via its non-blocking I/O model. To manage file metadata, PostgreSQL was the clear winner. Its relational structure allows the system to precisely track file ownership, access logs, and expiration windows with strict data integrity.

3. Cloudinary (Cloud Infrastructure)

Instead of stressing a single server with massive binary uploads, I integrated Cloudinary. This allows the platform to scale fluidly, offloading storage overhead and serving assets through a global Content Delivery Network (CDN) for maximum download speeds.


Engineering the "Self-Cleaning" Ecosystem

The standout engineering feature of Urlshare is its ability to eliminate storage overhead completely without human intervention.

[User Upload] ──> [Set TTL Timestamp] ──> [PostgreSQL Metadata]
                                                    │
[Cloudinary CDN] <── [Automated Purge Engine] <─────┘ (TTL Expired)

Automatic Expiration Logic

To prevent "storage bloat," I engineered a custom deletion engine that monitors and executes data lifecycles:

  • Timestamp Tracking: Every uploaded asset is assigned a strict "Time-to-Live" (TTL) value upon entry.
  • Database Synchronization: The backend continuously audits these active timestamps against the current system time.
  • Two-Way Purging: The exact millisecond a file expires, a database transaction drops the metadata record from PostgreSQL, simultaneously triggering an asynchronous, secure API call to Cloudinary to permanently wipe the physical asset.
The Result: A lean, cost-efficient ecosystem that completely avoids hosting "zombie" links or accumulating orphaned cloud data.

Security and the User Experience (UX)

Security shouldn't introduce friction; it should make interactions more seamless.

📲 QR-Code Authentication

Moving files across different hardware ecosystems (like transferring a document from a desktop monitor to a mobile device) is traditionally clunky. Urlshare solves this by rendering dynamic QR codes for every active upload. Users can simply scan the on-screen code with a smartphone camera to instantly authorize and begin the download session—no tedious typing required.

🔒 Granular Access Control

Using unique, cryptographically secure shareable links combined with JWT-based session verification, permissions are strictly enforced directly at the API level. This ensures that data access is restricted solely to intended recipients.


Lessons in Full-Stack Architecture

Building Urlshare reinforced a vital software principle: the most critical parts of an application are often what the user never sees. Coordinating asynchronous cloud deletions while ensuring a remote CDN stays perfectly in sync with a local relational database requires defensive error handling and robust fail-safe logic.

This project successfully bridges the gap between high-end UI/UX fluidity and heavy-duty backend engineering.


Call to Action (CTA)

  • Try the Live App: urlshare.sushanka.com.np
  • View the Source: Check out the architectural codebase on GitHub.
  • Let's Collaborate: If you are interested in full-stack engineering, performance optimization, or want to discuss technical systems, let's connect!
Sushanka Lamichhane

Sushanka Lamichhane

Writer and creator. Sharing thoughts, ideas, and stories.