Diary of Working on Notas - Part II

Diary of Working on Notas - Part II

Daily short news for you
  • For over a week now, I haven't posted anything, not because I have nothing to write about, but because I'm looking for ways to distribute more valuable content in this rapidly exploding AI era.

    As I shared earlier this year, the number of visitors to my blog is gradually declining. When I looked at the statistics, the number of users in the first six months of 2025 has dropped by 30% compared to the same period last year, and by 15% compared to the last six months of 2024. This indicates a reality that users are gradually leaving. What is the reason for this?

    I think the biggest reason is that user habits have changed. They primarily discover the blog through search engines, with Google being the largest. Almost half of the users return to the blog without going through the search step. This is a positive signal, but it's still not enough to increase the number of new users. Not to mention that now, Google has launched the AI Search Labs feature, which means AI displays summarized content when users search, further reducing the likelihood of users accessing the website. Interestingly, when Search Labs was introduced, English articles have taken over the rankings for the most accessed content.

    My articles are usually very long, sometimes reaching up to 2000 words. Writing such an article takes a lot of time. It's normal for many articles to go unread. I know and accept this because not everyone encounters the issues being discussed. For me, writing is a way to cultivate patience and thoughtfulness. Being able to help someone through my writing is a wonderful thing.

    Therefore, I am thinking of focusing on shorter and medium-length content to be able to write more. Long content will only be used when I want to write in detail or delve deeply into a particular topic. So, I am looking for ways to redesign the blog. Everyone, please stay tuned! 😄

    » Read more
  • CloudFlare has introduced the pay per crawl feature to charge for each time AI "crawls" data from your website. What does that mean 🤔?

    The purpose of SEO is to help search engines see the website. When users search for relevant content, your website appears in the search results. This is almost a win-win situation where Google helps more people discover your site, and in return, Google gets more users.

    Now, the game with AI Agents is different. AI Agents have to actively seek out information sources and conveniently "crawl" your data, then mix it up or do something with it that we can't even know. So this is almost a game that benefits only one side 🤔!?

    CloudFlare's move is to make AI Agents pay for each time they retrieve data from your website. If they don’t pay, then I won’t let them read my data. Something like that. Let’s wait a bit longer and see 🤓.

    » Read more
  • Continuing to update on the lawsuit between the Deno group and Oracle over the name JavaScript: It seems that Deno is at a disadvantage as the court has dismissed the Deno group's complaint. However, in August, they (Oracle) must be held accountable for each reason, acknowledging or denying the allegations presented by the Deno group in the lawsuit.

    JavaScript™ Trademark Update

    » Read more

Challenges

Today, Hanoi is windy, cool, and lightly drizzling. I resumed working on Notas after nearly 3 weeks of rest and focus. Just this morning, I still didn't have any ideas for the next article because there were too many major issues that I hadn't resolved yet. But luckily, just recently, while cleansing my soul in the droplets of water from the fountain, I found the missing piece for the long-lasting troubles.

As usual, this week I will summarize the issues, difficulties I am facing, what I have accomplished, and the plan for the next week.

Difficulties

There are many significant challenges that I am currently facing.

In the previous article, I mentioned the structure of the Adapter as the database. Initially, I implemented the LocalStorage Adapter to retrieve data from the Local Storage in the browser. If I were to add a new Adapter to retrieve data from a specific server and handle synchronization, the user would need to connect to the internet to use that Adapter.

This means that a note-taking application would require an internet connection to be used. Hmm... that doesn't seem logical, as not everyone always has an internet connection. If they go outside and are offline but need to take notes, they won't be able to use the application, right?

Therefore, I had to find another solution that allows users to use the application both online and offline.

In the previous 3-tier architecture: UI, Logic, and Adapter, it seems that it is not enough to make the application work offline. To ensure that the application still works offline, we need to come up with a way to store user data when they have no internet connection.

So, we need to add a storage layer - which I call Storage - between Logic and Adapter. Storage acts as a local data storage, meaning that users can interact with the data even when they are offline. At this point, Logic will directly interact with Storage as a local database and also need to add a mechanism to synchronize data from Adapter to Storage.

It sounds simple, but when I started working on it, things were not easy.

First, I had to modify a lot of code and create an additional Storage layer to store data in the Local Storage as an offline database for users.

Second, the synchronization mechanism between Storage and Adapter is not very convenient, especially when adding a second client that participates in the synchronization server. So, when someone edits data in the same synchronization server, the data must be immediately synchronized to the other machines. Not to mention when multiple machines participate in editing the same note, it will be very complicated.

Third, even if a client has enabled data synchronization, if for some reason the machine is not connected to the network but still performs offline add/edit/delete operations, when there is a network connection, the data still needs to be synchronized with the server according to a certain rule.

It's really headache-inducing. When I first started, I didn't think this issue would be so complicated. Honestly, for the past week, every morning when I woke up, the first thing I thought about was how to solve this synchronization problem.

Finally, I had to modify my code many times to find a common rule for synchronization, and perhaps the light is shining through the leaves more clearly day by day.

Solution

Let's think about git along with its data pull/push mechanism. A remote server stores the remote repository, and a repository is "cloned" to the local storage on the computer. The task of git is to provide a mechanism to synchronize between remote and local, meaning that somehow it ensures that the data in the local storage is always the same as the remote.

If applied in that way, the Adapter will be like the remote, and the Storage will be like the local. Notas will require the Adapter to implement corresponding pull/push functions for retrieving and pushing new data to the synchronization server.

The remaining challenge is determining when to pull and push data.

Achievements and Goals for the Next Week

Writing notes on Notas

You may not believe it, but this Part II summary article is being written within the Notas application itself.

Notas can now function with alpha-level synchronization features. Using it to write is also a way to test its accuracy. Of course, there are still errors that occur while writing, many of which are related to asynchronous pull/push behaviors, causing data loss at certain times. Hopefully, these errors will be fixed in the coming week.

Finally, thank you for following along. If you have any questions or anything that is still unclear, please leave a comment below the article. I am more than happy to answer!

Premium
Hello

Me & the desire to "play with words"

Have you tried writing? And then failed or not satisfied? At 2coffee.dev we have had a hard time with writing. Don't be discouraged, because now we have a way to help you. Click to become a member now!

Have you tried writing? And then failed or not satisfied? At 2coffee.dev we have had a hard time with writing. Don't be discouraged, because now we have a way to help you. Click to become a member now!

View all

Subscribe to receive new article notifications

or
* The summary newsletter is sent every 1-2 weeks, cancel anytime.

Comments (2)

Leave a comment...
Avatar
Trịnh Cường1 year ago

very sure bro :))

Reply
Avatar
Trịnh Cường1 year ago

cố lên bạn, mình tin là bạn sẽ làm đc ;)

Reply
Avatar
Xuân Hoài Tống1 year ago

Cảm ơn bạn Cường đã động viên tinh thần. Nhớ dùng sp của mình sắp tới nhé