Indie Log #3
7/30/2024
I fell into the swamp of refactoring, which left me exhausted. But now it’s almost finished. There are a few changes I made while doing that work, so I'm going to write about some of them.
Publishing
I changed the name from sync to publish because I believe it is a better term for users when sharing their content.
The previous publishing method involving the left and right nodes, which supported rollback, was removed. Now, if some content fails, the rest will still be published.
Result message after publishing:
{
"events": {
"added": [...],
"modified": [...],
"removed": [...]
},
"failed": [...]
}
Typescript SDK
I prefer TypeScript when coding. If the type is supported in the IDE, it helps autocomplete the code and boosts my confidence that the code is correct. So, I made an API client library using TypeScript.
Before creating it, I had to consider how its interface would look. TypeScript is needed for defining the properties of the content. The content can have many properties with different types, so it needs to help users identify these types for better DX. Let’s look at this example:
const content = await fetch("<https://api.writeflow.dev/v1/contents>");
content.title; // Runtime error (misspelling)
// With no information about properties,
// you have to check it manually.
content.properties.published?.type === "checkbox" &&
content.properties.published.checkbox;
With the default fetch method, you can't get the proper data type of the content. But with the client SDK, it’s easy to fetch content.
const content = await writeflow().content.list();
content.titie; // IDE notifies an error
content.title; // Autocomplete supported
// You can use properties without validating types.
content.properties.published.checkbox;
Embed
I initially intended for users to do everything in Notion, so they wouldn't have to visit the WriteFlow website. This way, WriteFlow would feel like a part of Notion.
Thankfully, appending embed blocks is acceptable in the Notion API, so I can use this feature to integrate WriteFlow into Notion well. With this, I made it possible to publish content on a Notion page. If the user creates a collection connected with a Notion database, then the publishing page appears below the database.
This rotate button is for publishing. I think I can create a fun feature with it soon.
Validating the product
I'm kind of scared to show people this product because I can't guarantee it will work as I thought. Therefore, I need a few users to test the product. This is challenging for me.