<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[A Dilettante's Journal]]></title><description><![CDATA[A Dilettante's Journal]]></description><link>https://blog.romitraj.dev</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1763052970819/f6e93f83-81f4-4a68-8fad-ff620b40344d.png</url><title>A Dilettante&apos;s Journal</title><link>https://blog.romitraj.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Thu, 14 May 2026 07:38:57 GMT</lastBuildDate><atom:link href="https://blog.romitraj.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Finishing off what I started]]></title><description><![CDATA[So, 11 days ago I wrote about the Frontend part of my website. I showed you the initial designs and my thought process with it. But a car cannot start with just the chassis right? We need to build the]]></description><link>https://blog.romitraj.dev/finishing-off-what-i-started</link><guid isPermaLink="true">https://blog.romitraj.dev/finishing-off-what-i-started</guid><dc:creator><![CDATA[Romit Raj Sahu]]></dc:creator><pubDate>Mon, 30 Mar 2026 12:45:20 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/690c7cb545f44bca496ce13e/8dfa52da-ccb8-4d6a-ae69-754152da15cb.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>So, 11 days ago I wrote about the Frontend part of my website. I showed you the initial designs and my thought process with it. But a car cannot start with just the chassis right? We need to build the engine. And that is what I did.</p>
<p>I also deployed the project with my own server. Learned a thing or two about that as well.</p>
<p>Also, in the process of doing all that, I did something which I had never done before.</p>
<img src="https://cdn.hashnode.com/uploads/covers/690c7cb545f44bca496ce13e/92f5ed08-e27a-4063-837f-d070da8cd7c4.png" alt="" style="display:block;margin:0 auto" />

<p>A 8 days commit streak in GitHub. Now I know in the grand scheme of things it does not matter much, but god does it look good!</p>
<p>So, picking up where we left off, this was how the login and homepage basically looked.</p>
<img src="https://cdn.hashnode.com/uploads/covers/690c7cb545f44bca496ce13e/55ef27b0-25cc-4f88-aa50-a8ed9f13c116.png" alt="" style="display:block;margin:0 auto" />

<hr />
<img src="https://cdn.hashnode.com/uploads/covers/690c7cb545f44bca496ce13e/15a39a1f-c578-4db5-92f5-4008f507e401.png" alt="" style="display:block;margin:0 auto" />

<p>Simple enough. Nothing fancy. Now the thing is whenever I click on any checkbox, it did not save it, which defeats the whole purpose of the project. So we needed a database to store it. Now the main options that may pop up are MySQL and Postgres. But for the purpose of this project, they are kind of an overkill. So I settled with something which is light, literally...</p>
<img src="https://cdn.hashnode.com/uploads/covers/690c7cb545f44bca496ce13e/c69fec35-54a1-4ab8-9187-611abe5129c2.jpg" alt="" style="display:block;margin:0 auto" />

<p><strong>SQLite</strong> is a very neat little database. It is just a single file which contains all our records. It is also easy to backup. So I chose this for my project. Now I needed a schema to store the records. My initial idea was to store the type (newspaper/book), date and status (read/not read) for each row.</p>
<p>But when I asked if this schema was good enough to Claude, it suggested that instead of adding a status to each new row, we can make it just so that whenever a user clicks on a specific date, that date and type gets added, and whenever he clicks on it again, it gets deleted. This way, the schema will be simple and there will be no redundant data at all. And I said <em>voila</em> and went with it.</p>
<img src="https://cdn.hashnode.com/uploads/covers/690c7cb545f44bca496ce13e/817f4a26-da48-487a-9904-ca1291e513a0.png" alt="" style="display:block;margin:0 auto" />

<p>Now you may think if we just combined the day, month and year to a single date column it would be even simpler, and yes it would have been, but then we would have to manually extract them every time a new row was modified, so this purpose I avoided it.</p>
<p>Moving on to backend, I used <strong>Node</strong> and <strong>Express</strong> to handle my server. I created 3 API endpoints. One to login, one to fetch the habits and one to toggle them. For logging in, I used JWT and bcrypt for authentication. Basically, instead of storing the password in plain text to check the authenticity, I stored a bcrypt hash of the password in the environment variable. This way, the real password is never even mentioned anywhere.</p>
<p>But we cannot just login every time we open the page. I need to make sure that after the user is authenticated, the browser remember this interaction. So for this, I used JWT (JSON Web Token). After successfully verifying the credentials, the browser will be provided a secured JWT token which will be used to verify future requests, without the need to login again.</p>
<p>Though these are not indefinite. I made the expiry set to 10 days, so after every 10 days the user has to login again. Just for security reasons.</p>
<p>Now I want to share a cool neat little thing called...</p>
<img src="https://cdn.hashnode.com/uploads/covers/690c7cb545f44bca496ce13e/080f46a6-d2ce-4376-94cd-4407a7a3f01c.jpg" alt="" style="display:block;margin:0 auto" />

<p><strong>COOKIES!</strong></p>
<p>I always wondered how do Amazon and Instagram remember your login credentials without you needing to enter them again and again. They use cookies! Now for storing the credentials for my project, I had 2 options, either use localStorage or use cookies.</p>
<p>I never implemented cookies before, so I thought this was the best time to do it. The process was quite simple. After logging in, the server sends a HTTP-only cookie instead of the typical response body. The browser stores it and returns it in every successive request. On backend, <em>cookie-parser</em> reads it and JWT verifies its authenticity.</p>
<img src="https://cdn.hashnode.com/uploads/covers/690c7cb545f44bca496ce13e/cd0277eb-6623-447b-920a-797f76892122.png" alt="" style="display:block;margin:0 auto" />

<p>This is how it is shown in the browser UI.</p>
<p>Now that I had built the backend. I needed both my frontend and backend to talk with each other. Now to achieve this, I used Fetch API. I created a shared apiFetch utility that attaches the credentials to every request. And in my environment variables, I set how the URLs should be handled in production.</p>
<p>After doing all this, my site was complete. But everything was working... locally. If I need to access my website from anywhere, I need to deploy it to my server.</p>
<p>This process was what took the most time. Although the deployment was simple, it kept breaking at one point because I had not stored the *.*<em><strong>env</strong></em> files in the server. A ROOKIE MISTAKE!</p>
<p>I bought the server from <strong>OVHcloud</strong>. The server is located at Gravelines, France as all the Indian and Asian servers were exhausted. I bought the server, created a new user, set up firewall, set up SSH, and then cloned my code files to it.</p>
<p>Now to serve frontend files, we need a web server. I used <strong>Nginx</strong> for this purpose. I built all the frontend files using <code>npm run build</code> and then served it. For the backend server, which we need to keep running in background, I used <strong>PM2</strong>, which does this exact task.</p>
<p>I had bought my domain from <strong>PorkBun</strong> a few months back, and I manage the DNS records using <strong>Cloudflare</strong>. So for this project I created a new subdomain called <strong>didiread</strong> to my base domain <a href="http://romitraj.dev"><strong>romitraj.dev</strong></a>. I used <strong>Certbot</strong> to generate SSL certificates for the site, then deployed it all.</p>
<p>Finally, I was able to access my website at <a href="http://didiread.romitraj.dev">didiread.romitraj.dev</a>. The login worked, the database worked and most importantly, the cookies did their job just fine.</p>
<p>At this point my project was complete. But my mentor advised me to deploy it to <strong>Docker</strong> as well.</p>
<img src="https://cdn.hashnode.com/uploads/covers/690c7cb545f44bca496ce13e/14a67d62-a6c9-42bb-8a28-a1a869af9d62.png" alt="" style="display:block;margin:0 auto" />

<p>How this works is, you basically create an image of your project, now this image contains every required file and dependency for your project to work. Now anybody can just pull this image to their system, and with a single command can run your project in their system.</p>
<p>But for this to work, you have to create a <strong>Dockerfile</strong> which as its name suggests, is a file that specifies Docker what all things to build. As my project had both frontend and backend, in order to connect them inside Docker, I had to use <strong>Supervisord</strong>, which lets you run both Nginx (to serve website files) and Node (to host the server) in a single container.</p>
<p>So I created these files, then built a docker image, and then published it to <strong>Docker Hub</strong>, which is like the GitHub for Docker images. You can check it <a href="https://hub.docker.com/r/brixdorf/did-i-read">here</a>.</p>
<p>And my website currently looks like this..</p>
<img src="https://cdn.hashnode.com/uploads/covers/690c7cb545f44bca496ce13e/75dac21d-e1e4-43db-81e7-57020de49869.png" alt="" style="display:block;margin:0 auto" />

<p>And fun fact, during this entire process of creating and deploying this thing, I did not infact read a single page of book or newspaper, which is so IRONIC!</p>
<p>You can check my <a href="https://github.com/brixdorf/did-i-read/">GitHub</a> if you want to take a look at the code files yourself. The README can guide you for all the steps you need to do.</p>
<p>So that was it then. The complete journey of my first server deployed full-stack application. Let me know about your thoughts on this. I would love to hear them all!</p>
<p>Till then, this is Romit, <em>signing off!</em></p>
]]></content:encoded></item><item><title><![CDATA[Starting off after a long hiatus]]></title><description><![CDATA["Hiatus". What does it even mean? The dictionary says, "a pause or break in continuity in a sequence or activity". Now you may ask, what is this "activity"? Well, it may surprise you, but it is actual]]></description><link>https://blog.romitraj.dev/starting-off-after-a-long-hiatus</link><guid isPermaLink="true">https://blog.romitraj.dev/starting-off-after-a-long-hiatus</guid><dc:creator><![CDATA[Romit Raj Sahu]]></dc:creator><pubDate>Wed, 18 Mar 2026 20:57:41 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/690c7cb545f44bca496ce13e/3517cbd8-b524-4c85-b1e2-00df7f63547d.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>"Hiatus". What does it even mean? The dictionary says, "a pause or break in continuity in a sequence or activity". Now you may ask, what is this "activity"? Well, it may surprise you, but it is actually... Coding!?</p>
<p>This may look like a bummer. "A CS student who has not coded in a while?". But trust me, this is not as bad as it seems. It is not like I have not touched a piece of code for 2 months, but what I mean is, sitting in a desk, and coding for hours on straight.</p>
<p>Now that is something I (a bit shamefully) admit I haven't quite done in a while. And to my credit, the subjects that are currently being taught in this trimester don't really require heavy coding.</p>
<p>So I had been out of touch with <strong>React</strong> for some time. I hadn't used it too much. I felt like in order to beat procrastination as I mentioned in my previous post, I need to do something that requires manual effort and lots of coding. So I thought of creating a project in React.</p>
<img src="https://cdn.hashnode.com/uploads/covers/690c7cb545f44bca496ce13e/3c863d43-d6ef-46d9-971b-5c4236211bf1.png" alt="" style="display:block;margin:0 auto" />

<p>Now I am thinking, what should I even build? And then it struck me, the best way to build projects they say, is to create something to fix a problem you are facing. And I did face such a problem, and that was tracking whether I have read the newspaper and book daily.</p>
<p>Reading is a very very powerful and important habit. If you are not reading books or newspapers, frankly you are missing out on a lot of good stuff.</p>
<p>My goal daily remains to read at least one chapter of a book and read the daily newspaper. But the problem is, I cannot keep a track of whether or not I have read them on a specific day. This creates a problem which being if I miss a day or two, I get lazy and then don't read for a longer period of days.</p>
<p>To fix this, the best way, is to visually see what days you have read. This will create a mental model in your brain. And if you have, suppose say read for 6 days, you would not want to break the streak and make it 7, then you keep on doing this in order to maintain your reading streak.</p>
<p>This is a good activity and so I thought of building this exact project. Thing is, many such trackers already exist on the market, but, and this is a big but, if you just keep on using everything that is available, and not build anything yourself, will you ever learn something new?</p>
<p>So I started building it. I chose <strong>React</strong> as the framework and used <strong>Tailwind</strong> for styling.</p>
<p>My plan was simple. I needed two calendars. One for tracking newspaper, and one for books. The calendar will show each day of the month, and when one clicks on a day, it turns into a green checkbox, indicating you have read that day.</p>
<p>I created the base layout, used custom fonts and icons, added support for light and dark mode.</p>
<p>For the Calendar layout, I used CSS grid for efficiently displaying the dates in cells. The dark mode switch was especially interesting. Tailwind allows you to set the background or text color of an element when it is in dark mode with a simple <code>dark:</code> snippet. And the rest of the process of detecting whether the user is in dark mode or not is handled automatically.</p>
<p>And after creating all the components, the final website looked something like this.</p>
<img src="https://cdn.hashnode.com/uploads/covers/690c7cb545f44bca496ce13e/e2cf97e0-ef8c-4b64-b12d-403b1dd6927c.png" alt="" style="display:block;margin:0 auto" />

<img src="https://cdn.hashnode.com/uploads/covers/690c7cb545f44bca496ce13e/45dc2b2d-d895-4da9-9d7e-b08ad053f488.png" alt="" style="display:block;margin:0 auto" />

<p>One more important thing remains. I want this site to be accessible from the web, and it should save the progress. And to achieve these things, I need to make sure that I am the only one who is allowed to make changes to this site, otherwise anyone can mess up the logs.</p>
<p>So, to provide security, I added a Login page.</p>
<img src="https://cdn.hashnode.com/uploads/covers/690c7cb545f44bca496ce13e/6362294c-425c-4ee4-b889-3d34526310ce.png" alt="" style="display:block;margin:0 auto" />

<p>Up until now, this is all I have created. The frontend part is basically over, now the remaining steps include saving the data to the database, creating the backend and then deploying it to my server. I will keep sharing the updates once the remaining steps are done.</p>
<p>Till then, this is Romit, signing off!</p>
]]></content:encoded></item><item><title><![CDATA[Hello there!!]]></title><description><![CDATA[I have been meaning to write this for a long long while, and no, this is not a confession... but in a way it is! Confession of Procrastination. My original idea while creating this blog was to share m]]></description><link>https://blog.romitraj.dev/hello-there</link><guid isPermaLink="true">https://blog.romitraj.dev/hello-there</guid><dc:creator><![CDATA[Romit Raj Sahu]]></dc:creator><pubDate>Mon, 16 Mar 2026 18:12:44 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/690c7cb545f44bca496ce13e/24a70a1b-a60f-4b53-8d8d-884f0ad37c30.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I have been meaning to write this for a long long while, and no, this is not a confession... but in a way it is! Confession of Procrastination. My original idea while creating this blog was to share my learnings. I wished to share everything that I learn in my journey of Computer Science in this blog... but I thought about doing this almost 2 months ago!!</p>
<p>Procrastination is a hell of a drug, you think of a wonderful idea, of how you will change things in your life, you make a plan, but instead of working on that plan.. you just don't?!</p>
<p>But the only way to defeat procrastination, is to just do it man. Like they say in the ads of Nike. You have to just start doing stuff.</p>
<p>So, here I am doing my part, by just starting to write my first blog, instead of scrolling.</p>
<p>Let me just give you a brief introduction of me. My name is Romit. I am a CS student currently in my sophomore year. I like to explore stuff. Stuff about science, history but mainly Computers (of course!).</p>
<p>I am currently trying to build up a habit of consistently writing code. This blog is just a extension of that. Here as I said before, I will share my learnings. This will act as a accountability check for me and also a log of stuff I have been doing.</p>
<p>Also, just so you know, the word <strong>Dilettante</strong> that is the name of my blog means a "person who cultivates an area of interest, such as the history, without real commitment". While searching a name for my blog (almost 2 months ago!), I found this word and thought it would really fit my theme, as I know a little about a lot of stuff lol.</p>
<p>Well, I guess that does it for my first blog. Thanks for taking your time to read till this. That really means a lot 😄!</p>
<p>This is the first one and I promise you there are lots more to come!</p>
<p>Until then, this is Romit, signing off!</p>
]]></content:encoded></item></channel></rss>