The Innocent Crime
It started the way these things always start.
With a single line of code that should have made me stop and think.
The blog editor for my portfolio did not have an upload service.
It did not have image optimization.
It did not have a media library.
It did not have storage providers.
It did not have metadata.
It had a canvas.
The task was innocent.
"Make cover images smaller."
A reasonable request.
A tiny optimization.
A five-minute improvement.
So I did what every developer does when faced with a small frontend problem:
I solved the immediate problem and ignored Future Me.
The solution?
Convert the image in the browser.
canvas.toBlob(
blob => {},
"image/webp",
0.65
)Beautiful.
Smaller images.
Faster uploads.
The preview worked.
The save button worked.
The toast notification said:
Saved successfully.
Therefore, according to ancient developer law:
The problem was solved.
Except there was one tiny detail.
The image was not uploaded anywhere.
It was converted into a base64 data URL and stored directly inside the blog document.
A WebP image.
Inside Firestore.
Inside the same document containing my article content.
Future Me was standing in the corner watching this happen.
He looked disappointed.
"Are you seriously storing binary data inside your CMS database?"
I looked away.
"Technically it's a string."
He sighed.
The Problem I Successfully Ignored For Two Years
The funny thing about bad decisions is that they rarely hurt immediately.
That is why they survive.
The blog worked.
Posts published.
Images displayed.
Nothing exploded.
So the architecture quietly became:
Browser
|
|
Canvas conversion
|
|
Base64 string
|
|
Firestore document
It was simple.
Too simple.
Eventually I started noticing the cracks.
Images were not properly managed.
There was no reusable asset library.
There was no storage lifecycle.
There was no separation between content and files.
The article contained the image.
The image existed only because the article existed.
Which is basically the digital equivalent of storing your furniture inside your house blueprint.
It works.
Until you need to move.
Then you realize you created a problem two years ago and politely scheduled Future You to deal with it.
The Day I Finally Got Tired
The breaking point was not even technical.
It was workflow.
Every time I wanted to publish something, the process became:
Upload image in dashboard.
Let the browser convert it into WebP.
Store it as base64.
Realize search engines and external systems don't really see it properly.
Download the generated image.
Upload it manually somewhere else.
Share the file.
Copy the Google Drive ID.
Manually construct the URL.
Something like:
https://lh3.googleusercontent.com/d/FILE_ID=w1000
Then paste that into the article.
Every.
Single.
Time.
Past Me had created a workflow where the computer was helping me create more work.
Which is impressive.
The entire point of computers was supposed to be removing manual steps.
I had built a machine that generated chores.
"I'll Just Build an Upload Endpoint"
The obvious fix was simple.
I already knew what needed to happen.
Create a backend.
Add an upload endpoint.
Validate files.
Store them properly.
Return a URL.
Delete the questionable frontend logic.
Done.
Simple.
Except software development has a strange habit.
Every simple feature eventually asks:
"How serious do you want to take this?"
So the upload endpoint became:
"Wait, where should files live?"
Google Drive sounded reasonable.
Then:
"How do I authenticate?"
OAuth.
Then:
"Where do refresh tokens go?"
Encrypted storage.
Then:
"How do I prevent fake callbacks?"
Signed OAuth state.
Then:
"What happens if the connection expires?"
Token recovery.
Then:
"How does the dashboard know?"
Integration health.
The upload endpoint was no longer an endpoint.
It was an entrance.
And behind that entrance was an entire cave system.
The Backend Wasn't the Destination
At some point, I stopped building an image uploader.
I started building infrastructure.
The first realization was storage providers.
The media service shouldn't care where files live.
Google Drive is just one implementation.
The future could be:
Google Drive
Firebase Storage
Cloudflare R2
Amazon S3
Whatever future me decides is suddenly "the correct architecture"
So the system became:
Upload
|
Storage Provider
|
Media Record
|
Reusable Asset
The media system didn't need to know the details.
It just needed a contract.
Something like:
interface StorageProvider {
upload()
delete()
healthCheck()
}
A reasonable abstraction.
The kind of abstraction you create when you accidentally realize your portfolio is becoming a platform.
The Second Crime Scene
After solving storage, I found another problem.
The base64 mistake was everywhere.
Blog covers.
Editor images.
Quick edits.
Different components.
Different implementations.
Different versions of the same bad idea.
Three separate image workflows.
Three separate places future bugs could appear.
So they became one pipeline.
Image Upload
↓
Media Library
↓
Storage Provider
↓
Reusable URL
↓
Any Feature
One source of truth.
One upload process.
One place to fix things.
Which sounds obvious now.
It was not obvious when each individual feature was created.
Then I Accidentally Built a CMS
The funny part?
I never decided to build one.
There was no meeting.
No roadmap.
No grand architecture document titled:
"Build a Content Management Platform."
It just happened.
One feature at a time.
Suddenly the dashboard had:
Blog publishing
Draft management
Categories
Tags
Comments
Moderation
Contact messages
Analytics
Series management
Media library
Storage integrations
Google OAuth
Image optimization
Authentication
Rate limiting
Deployment workflows
At some point, the portfolio stopped being the application.
The portfolio became a website running on top of the application.
The dashboard was no longer an admin page.
It was a CMS.
The Media Library Became the Product
The final irony is that the original problem was never really images.
It was ownership.
I wanted my content system to understand my assets.
Not just store whatever string the browser gave it.
The Media Library became the place where files gained identity.
A file now had:
Storage provider
Dimensions
Size
Visibility
Metadata
Status
Lifecycle
It became something the system understood.
Not just something attached to a blog post.
Of Course, Security Arrived
The moment files became real, security showed up.
Nobody asks for security features.
Nobody creates a ticket saying:
"Please add OAuth replay protection."
People ask for uploads.
Security arrives afterward carrying paperwork.
Suddenly there were questions:
Where do refresh tokens go?
Encrypted.
What happens if access is revoked?
Reconnect flow.
Who can upload?
Admins.
Who can delete?
Admins.
How do private files stay private?
Backend proxy.
How do we stop abuse?
Rate limiting.
The feature request was:
"Upload images."
The implementation became:
"Build a small storage platform."
Then The Dashboard Started Getting Organized
Once integrations existed, another problem appeared.
Storage was no longer just a setting.
It was an integration.
Google Drive was not a random checkbox hidden inside settings.
It was a capability.
So the dashboard evolved again.
The old structure was:
Settings
└── Storage
The new structure became:
Platform
├── Integrations
└── Settings
Because eventually every feature asks the same question:
"Where does this belong?"
The answer was no longer "settings."
It was:
"This is part of the platform."
Even The Media Library Needed A Redesign
After building the system, the next problem was obvious.
The Media Library itself looked like a file browser.
But everything else in the dashboard had evolved.
Series had beautiful cards.
Content had workflows.
The media page still looked like a folder.
So it became an asset gallery.
Cards gained:
Visual previews
Status indicators
Provider information
Accessible actions
Better loading states
Storage-aware empty states
Sorting
Consistent layouts
The goal changed.
It was no longer:
"Show me files."
It became:
"Help me manage my content assets."
Small difference.
Huge architectural shift.
The Real Rabbit Hole
I thought the rabbit hole was Google Drive.
It wasn't.
I thought it was OAuth.
It wasn't.
I thought it was building the backend.
It wasn't.
The real rabbit hole was realizing every small feature eventually asks:
Do you want to build the feature, or do you want to build the system that supports the feature?
Replacing a base64 image required storage.
Storage required providers.
Providers required abstractions.
Abstractions required management.
Management required dashboards.
Dashboards required integrations.
Integrations required health states.
Health states required monitoring.
Monitoring required...
You get the idea.
The feature was never:
"Replace the canvas conversion."
The feature was:
"Images should exist somewhere other than inside the document describing them."
Everything else was the plumbing required to make that sentence true.
The Rabbit Hole Wins Again
Today, new images upload through a proper Media Library.
They are stored separately from content.
They have metadata.
They have ownership.
They have lifecycle management.
They can be reused.
The old articles still work.
No migration disaster.
No broken images.
No emergency rewrite.
And somewhere along the way, I stopped building the backend for my portfolio.
I accidentally built the publishing platform my portfolio happens to use.
Which is probably the most developer thing possible.
A two-hour improvement becoming months of architecture work.
A simple upload button becoming OAuth infrastructure.
A personal blog becoming a CMS.
I should have touched grass.
Instead, I learned far more about Firestore limits, storage providers, and OAuth refresh tokens than any reasonable person ever should.
The rabbit hole wins again.