I will post dev updates as comments in this thread.
Feel free to comment with any requests / feedback / thoughts
I will post dev updates as comments in this thread.
Feel free to comment with any requests / feedback / thoughts
10:43am - Fixed Google Analytics, which is currently used to display page view counts (had forgotten to migrate it over when I moved from GraphQL to REST API). Note - displayed page view accounts are less than the real page views because the data is from Google Analytics, and won't track anyone with an ad blocker (including myself). I plan to move off Google Analytics, it was only implemented as a quick short-term solution.
Added progress loading bar on page changes using the nprogress library (nextjs-toploader).
I'm not a fan of how slow the page changes are in Next.js. I much prefer the page immediately changing, optimistically cached, and with a loading screen. But that would require building my own custom framework again, and no way I'm going back to that and dealing with all that complexity. If there's one thing I've learned as a developer is that it's generally best to just go with the simpler solution, even if it sometimes means sacrificing control.
Worth mentioning that I did both of these tasks quickly by searching Google and ending up at StackOverflow and/or random blog post which gave me most of the answer, and then I maybe tweaked it a little bit. The reality is that 99% of dev work has already been done before, and thus using tools like Google / StackOverflow is generally the most efficient way to get things done.
LLMs these days simplify this even further, as well as AI code completion tools like GitHub Copilot. Within 2 years, I think AI code completion will be so advanced that adding these new features will be as simple as prompting one's codebase, reducing the time and cognitive load for this by 99%+. At that point, basic app development will be completely commoditized.
Ok I'm getting sidetracked here, this is just supposed to be a dev update blog right?
3:55pm - auto-reconnect to websockets server on disconnect using exponential decay, improved post slugify function
12:13pm - Removed extraneous fetch queries. Turns out react-query defaults
refetchOnWindowFocus to true, which re-fetches when
staleTime has expired, was causing all of those refetches. I think that's a dumb default, as with many other things in react-query, but whatever.
2023-07-31 - "Latest Comments" widget (in right sidebar) now live updates (using websockets).
Just got back from vacation to Busan. Got a nice tan.
7:59pm update - prompts user upon exit when there are unsaved changes in comment box (23 minutes)
8:24pm update - when pressing "Create Post" button from within a tag/community, that tag will be prefilled automatically (thanks NecroSocial for the feedback on this one)
5am update - Site is now a Progressive Web App, meaning it's installable, is faster, and will work online using cached data.
Had dinner with some really kind Japanese people who saw me get rejected from a Korean BBQ place for being alone and asked me if I wanted to join them.
2023-07-26 - Just added "Latest Comments" widget to right sidebar, as well as /comments page (dev time: 2 hours)
2023-07-25 - Today's update, set up live viewer count ("X users online" in the right sidebar) and a chat room (/chat, accessible from the chat bubble icon in the top left of the header, or on the right sidebar next to "X users online"). Chat room is currently anonymous only, and messages aren't saved yet. I'll finish that up tomorrow, and also I want live-updates of recent activity and feeds.
Tech-wise I set up a $6/month VPS with Digital Ocean and installed a Node.js websockets server on it.
Today's update (2023-07-20) - Updated the UI today to add a "classic" view, which looks like Lemmy (I like their UI). Also added images for posts with URLs (scraping the meta tags). Wow, the site is starting to look legit!
2022-10-07 - Added signup modal, cleaned up profile page styling - specifically cleaning up profile picture upload, added website link next to one's username.
2022-10-05 - Migrated my PostgreSQL database from Google Cloud SQL to Digital Ocean. Google Cloud SQL is absurdly expensive, with my bill coming out to an outrageous $107/month. With Digital Ocean I'll just be using the cheapest option for now which comes at $15/month. If I need to upgrade to a high availability cluster, it seems like that starts at $60/month.
Google Cloud also makes it very difficult for you to know how much you'll be charged. The create Postgres page doesn't even show you price estimates. Looking at my billing I have no idea why I was charged $64/month in vCPU and $40/month in RAM and I'm not sure how to get that info. Google Cloud's website in general is slow with terrible UX (and also seems to be the only website that totally fails with my Dark Reader Chrome extension).
On a personal note I have arrived to Barcelona. It's nice finally wearing shorts + T-Shirts and seeing the sun again.
2022-09-26 - Implemented HN ranking algorithm (sort by "hot"), search (currently only searches posts by title and content) using Postgres full-text search
Added profile pics to comments and leaderboard page, image support in posts
2022-09-25 - Fixed some nasty frontend bugs on upvoting/downvoting resulting from Apollo GraphQL cache not being properly configured. I've always found Apollo's caching to be super confusing and the documentation to be lackluster (eg. where is this in the documentation?), but now I'm finally starting to get it. Tldr: when it comes to cache updates on mutations, use
cache.modify() instead of the terribly convoluted way they tell you to do it in the documentation.
2022-09-24 - Implemented post sorting by top upvoted (took < 2 hours for backend/frontend. Most time-consuming part was trying to figure out why TypeORM was incorrectly trying to escape my alias in the orderBy clause. The solution came down to something really stupid (using skip/take instead of offset/limit). TypeORM can be super annoying, but unfortunately I haven't found a better ORM in Node.js, and I find that ORMs do save a lot of time compared to pure query builders like knex (though I wish TypeORM just used knex's query builder).
Next I'll fix some bugs (eg. noticing some problems with upvoting), and maybe implement Reddit's "hot" sorting. Also comments need profile pictures.
Yesterday evening I arrived in Stockholm. Today being a Saturday in a new city normally the first thing I'd want to do would be to explore, but these days I get more satisfaction out of being productive then just wandering around new cities because I've done a ton of that already. Yesterday being a travel day I didn't get any work done. Now that I've finished this and it's 2:30pm, I feel like I've given myself permission to wander / will feel less guilty doing so. Seems like a nice chill city so far, and weather is good.
2022/9/21 - Yesterday I added page views on posts (only visible when positive) using the Google Analytics API (was a pain in the ass, not surprisingly)
2022/9/22 - Added the ability to upload profile pictures. Super primitive right now, and the UI is horrible, but it's a start.
On a personal level, I've been MIA for a while because I took August off to enjoy the European summer, traveling through Spain. Then I spent 2 weeks in London, and am now concluding 2 weeks in Paris before most likely heading to Stockholm.
I'd switched my focus to some other projects (not public yet), but am now returning to this one. Initially it was for some cleanup because I was in contact with another entrepreneur who'd been considering hiring me to build something similar. But now I have some other ideas as well and realize this project will serve well as a master boilerplate to pump out a bunch of other projects, and of course I still want to make this project successful as well.
What's next: in the short-term I want to finish profile pictures and have them show everywhere (currently not visible in the comments). Next I will maybe try to get images working in posts, then afterwards clean things up to get ready for a launch (need to finish sorting/ranking, etc). Then start working on my other projects that I believe are a bit more promising from a profit perspective in the short-term.
Wow my e key seems to be destroyed now (took forever to type the above) so I will need to see if I can fix this. Last time my key broke on this keyboard I had to go to Seoul, Korea for a replacement...damn LG Gram 17 finally starting to disappoint me.
2022/7/27 - Set up token on testnet, cleaned up login/register forms
2022/7/28 - Migrated frontend to Google Cloud Run off of Google App Engine after deploy failed for some cryptic reason ("fetch failed"? wtf?). Set up Cloud Storage and started working on profile picture image upload, before deciding I should start trying to actually get real users on here and real feedback instead of just diving down the feature building rabbit hole.
Want to get some actual user feedback to make sure this is going somewhere. I'm committed to making this work, but at the same time I've got a million other ideas as well so if this isn't going anywhere towards getting actual usage then I'll shift focus to another idea (doesn't mean I'd abandon this project as I still believe in this long-term, but it seems there has to be a clear value add for users to start using this and overcoming the chicken and egg problem. I could create a bunch of fake accounts and talk to myself like what the Reddit founders initially did, but I'm not interested in that).
(btw am currently bouncing between Helsinki and Tallinn and was on vacation for a bit, hence the gap between updates. hit me up if you're around and want to meet)
2022/7/16 - Added ability to tip users. Below a comment, you'll see a "tip" button if their address is connected. Click that, a dialog will pop up, and you can send them eth from your wallet. Super rudimentary of course, but it's a start
I would like to be able to post a screenshot here, ie. be able to post images in posts/comments, so maybe I'll tackle that next. And then at some point performance (the backend is currently slow because it only runs when there are requests, so it gets "cold starts"), and better filtering.
2022/7/14 - Connect with wallet is now functional. You can either connect your ethereum address to an existing zsync account, or create a new zsync account with just your ethereum address. Still some more work to do before it's "production" ready (eg. disconnecting, handling edge cases, different wallets, styling), but at least now you can try it now (notice I've connected my eth account). I used ethers.js.
Retrieving ENS names with infura (free tier) for whatever reason is astronomically slow - to the tune of queries taking 30-60 seconds. I ended up using this random person's free API (thanks @frolic). But really this is ridiculous and we need a better solution (comment below if you know of a better solution).
I'm also surprised how difficult it's been to find a nice boilerplate for this wallet connecting stuff. Is there some nice resource I'm missing, or is everyone wasting precious hours of their lives re-inventing the wheel here? In any case I'll be posting code boilerplates and resources on this site so you don't have to waste your time reinventing the wheel, so stay tuned...
Also just for the record, the connect wallet stuff was mostly done yesterday, I just had plans in the evening (which went overboard due to subway not working and taxi strike) so didn't have time to deploy. Came back late at 1:30am and in my sleep deprived state desperately trying to figure out why signing on Trezor was crashing Metamask everytime (forcing me to remove and re-enable the Chrome extension to fix). There's definitely a bug there with Metamask, but I realized I was using the wrong Trezor passphrase (it's for a side account I never use), and after using the correct passphrase, signing worked (after a good 10-15 minutes freaking out having forgotten my passphrase for that account). If there's any lesson there, it's just to be careful when working in a sleep deprived state because that makes it much easier to be stuck in some local minimum and miss the forest for the trees.
Next goals: Finish up connect wallet edge cases + styling, then maybe work on fixing up site to let me post my eth dev code resources (as well as for the rest of my tech stack) as I think it's outrageous that there are so few easily available resources (or maybe Google search is just too terrible now to find them).
2022/7/12 - Made it possible to customize background color using CSS variables, added settings dropdown menu (gear icon) on top right, added modals - for now just for login. Login by email modal functional.
2022/7/13 - Setup Google Analytics, Tags on homepage now populated from backend sorted by "popularity" (created API endpoint and did frontend styling this morning, including rudimentary autocomplete), updated commenting to use rich text editor (using tiptap), added ability to edit and delete comments, fixed "1 minutes ago" datetime to string function, various styling updates (eg. spacing inside posts), spawning login modals when unauthenticated and trying to do stuff that needs auth
Goals for tomorrow (2022/7/14): connect with eth wallet is the main one, followed by profile picture upload, fix some bugs (eg. case insensitivity on some things, Twitter oauth seems to have broke and appears to be infinitely hanging on Twitter's end), maybe image upload, improve username display (don't just show Twitter if that's connected) as time permits. Eth wallet auth will prob take most of the time though so would be happy with just that.
Also want to build out user profile pages. More on that later, many basic features still need to be built out (eg. upvoting/downvoting comments) before the fancier stuff is really justified