Where it began#

About a week ago, an idea came to me. There are only so many hours in a day, and only so many thoughts, opinions, and ideas we can have in it. I can’t expect myself to write a long, profound blog post every day. But I can record the small moments that make up everyday life.

That reminded me of Flomo, an app I had tried before. I was still in high school then and didn’t really have access to a phone, so I probably treated it as a conventional note-taking app. It didn’t quite fit that use, and I eventually stopped using it. Now that it has come back to mind, I want to try a different approach.

Finding a way#

I study computer science, and I want to have full control over what I write: to keep it private, preserve it for the long term, and not leave it at the mercy of a service provider. So I started looking for a genuinely open-source app that would make it easy to record my life. I asked ChatGPT, and its answer was Memos.

Memos feels a little like Weibo or Twitter. I can post a short note, attach a location or a photo, and capture whatever is on my mind. I don’t need an all-encompassing note-taking system. I want something that can stay by my side.

So I decided to build it.

Where should it run?#

I used to deploy various apps on a cloud server, but eventually gave up on that approach. A server takes a fair amount of work to maintain, especially for an app I hope to keep running for years. There are plenty of ways it can fail, and the operating costs add up. Once, a Redis configuration mistake filled up my server’s storage. This time, I wanted something stable and easier to look after without spending too much.

Let’s go serverless!#

That led me to a serverless setup: put the database on a database platform, the app on an application platform, and object storage on a storage platform. Each part can do what it does best, and I have less infrastructure to maintain myself.

I asked ChatGPT again, this time with a few constraints. I’ve long been a Cloudflare user, and its inexpensive storage, Containers, and Workers made it a natural place to start.

The choice came together: a Cloudflare Worker and Container for the app, Cloudflare R2 for object storage, and Neon for Postgres. Neon offers a 0.5 GB free storage allowance, which seemed like a reasonable starting point for this project.

Daily notes · request path

Phone / browser Capture a moment
Cloudflare Worker Entry point and routing
Memos Container The app itself

Where Memos stores the data

Neon Postgres Text and memo data
Cloudflare R2 Photos and attachments

Scheduled backup · database copy

Cloudflare schedule Runs every day
Backup Container Exports from Neon
R2 backup bucket Stores the database copy

Version watch · GitHub Actions proposes updates

Daily check Stable upstream releases
Upgrade PR Patch or minor version
Human review Rehearse migrations if needed
Merge into main Trigger a production build

Automatic deployment · Cloudflare Workers Builds

main changes Start the build
Back up first Neon → R2
Deploy and restart Worker / Container
Smoke test Check the app is running
My Memos setup. Use the buttons above to explore recording, backups, upgrades, and deployment.

GitHub Actions watches for stable releases and opens upgrade PRs; it does not deploy the app. Once a PR is merged into main, Cloudflare Workers Builds backs up the database, deploys the update, restarts the container, and checks that the app is running. A separate Cloudflare schedule triggers the daily database backup.

What does it cost?#

I use a subdomain of my blog’s domain, which costs about 100 yuan a year. The Container is roughly $5 a month. R2 is billed by usage, and I haven’t come close to using up its 10 GB free storage allowance yet.

Keeping the data safe#

I have a lot of confidence in Cloudflare’s storage, though trusting any one provider completely is difficult. The database is the part I worry about more: it lives on Neon’s free tier, and I can only assume the platform is reasonably reliable. To give myself another way back, I set up automated database backups. One runs every day, and another runs before each deployment. The overall cost remains manageable.

Let’s begin#

After all that tinkering, I finally have a diary of my own. I also wrote a small OAuth adapter so ChatGPT can connect to Memos. That means my scheduled tasks can read what I’ve recorded over the years and help me remember what happened. And each day I have a very cute little companion cheering me on. All right, that companion is ChatGPT.

So, let’s get started!

And, by the way, you’re welcome to visit my Memos and take a look at my everyday life.