DEV Community

Cover image for How I built a Local-first, Zero-Server Note-taking App with Next.js and Google Drive API
Luan Hang
Luan Hang

Posted on

How I built a Local-first, Zero-Server Note-taking App with Next.js and Google Drive API

Most note-taking apps today have a "privacy tax." You either give your data to their servers or pay a hefty subscription to keep it private. I wanted something different: A professional workspace where I own the data, and the performance is instant.

Thatโ€™s why I built OwnSync Note. Here is the technical breakdown of how I made it happen.

The Architecture: Local-First is the Future โšก
To achieve sub-second load times and offline support, I went with a Local-first architecture.

  • Persistence: I used IndexedDB to store notes directly in the browser. This ensures that even with thousands of notes, the UI remains snappy.
  • Sync Engine: Instead of building a custom backend (and becoming another "data landlord"), I leveraged the Google Drive API. The app syncs .json files directly from the browser to the user's personal drive.
  • Conflict Resolution: One of the biggest challenges was handling sync conflicts. I implemented a version-checking logic that prompts users when a remote change is detected, ensuring no data loss.

The Tech Stack ๐Ÿ› ๏ธ

  • Framework: Next.js (App Router) for the core structure.
  • Styling: Tailwind CSS for that clean, 3-column professional UI.
  • Editor: A custom WYSIWYG Markdown editor with native JSON auto-formatting (a lifesaver for devs!).
  • Deployment: Vercel (with a heavy focus on security and rotated API keys).

Key Features for Developers
Beyond privacy, I added things that I personally needed as a developer:

  1. JSON Auto-formatting: Just paste a minified JSON, and it beautifies instantly.
  2. 3-Column Layout: Efficient navigation inspired by classic IDEs.
  3. PWA Support: It feels like a native desktop app but stays lightweight.

Why go "Zero-Server"? ๐Ÿ›ก๏ธ
By removing the middleman (the database), I removed the risk. If my app goes down, your notes are still in your Google Drive. If you want to switch apps, your notes are already standard Markdown files. No lock-in, ever.

Wrapping Up
Building OwnSync Note taught me that we don't always need complex backends to create powerful tools. Sometimes, empowering the user to own their infrastructure is the best feature you can build.

Iโ€™d love to hear your thoughts on the architecture or any features you'd like to see!

๐Ÿ‘‰ Check it out: https://ownsyncnote.com
๐Ÿ‘‰ Follow the journey on X: @OwnSyncNote

productivity #webdev #nextjs #javascript #buildinpublic

Top comments (0)