-
Setting up monitoring with NestJS, Prometheus and Grafana
A production application went down and was recovered six hours later after users started reaching support and developers rebooted the app. This happened on a real production system at my friend’s company. Money was lost, the customers were angry, and the developers scratched their heads about how it could happen. This is an excellent example of how monitoring and alerting could have solved the problem or reduced the downtime to the minimum. Sometimes developers neglect these tools to move faster, but having them for any production system is essential. In this article, I will follow you through setting up metrics and monitoring using a NestJS web application. No sophisticated setup is needed; everything is done on a local machine with the help of Docker.
continue... -
How to Set Up Terraform State Management using AWS S3 and DynamoDB
Terraform is a widely-used tool that helps provisioning infrastructure. Its power and simplicity made it a popular choice for many developers. However, if used incorrectly, Terraform can cause significant harm, including downtime or even data loss without the possibility of restoration. This becomes particularly relevant when multiple team members work on the same Terraform configuration independently. In this blog post, I will explain how to properly set up Terraform State Management for working in a team.
continue... -
Automating Website Release with Terraform, AWS, and GitHub Actions
So you’ve built a website, and you want to release it to the world? There are many unique ways this can be done. One of them is using AWS S3. It is simple, cheap, and convenient if you already use AWS. In this post, I will explain how to configure an S3 bucket to host a website, how to create the corresponding AWS resources using Terraform, and last but not least, how to automate the process so that whenever you push changes to your GitHub repository, they will be released automatically.
continue... -
How to Verify a Solana Wallet Signature Using Java?
One of the most common tasks when dealing with wallets is proving that the user is really the owner of the wallet. Every time a user links a wallet to a website, the website has to prove ownership. This can be easily done on the front-end side with JavaScript, but oftentimes it is not enough. If a wallet is stored on the backend, it is required to prove ownership on the backend as well. What if the backend is written in Java? In this blog post, I will explain how to verify a Solana wallet signature on the backend using Java.
continue... -
Communicating with Solana RPC using Java
Solana is one of the most popular blockchains with increasing adoption. However, when it comes to development experience and client libraries, predominantly only JavaScript and Rust are used. But what if you have an existing project in Java and want to integrate Solana? What about Android? This is where sol4k comes into play.
continue... -
Reducing NodeJS Artefacts Size Using Multi-Stage Docker Builds
Delivering a Node application as a Docker image is easy, and it works straight away. Most likely because of this simplicity many don’t even know it is done incorrectly. In this article, I am going to explain how to build a Docker image for a Node application and how multi-stage builds can help in this.
continue... -
Role-Based Authorization with JWT Using NestJS
Authentication and Authorization can be implemented in different ways using NestJS. The framework has great documentation for that purpose. However, when it comes to implementing a concrete scenario, there are many small details that have to be taken into account. In this article, I will walk you through the steps needed to set up JWT-based authentication and configure authorization to handle different roles.
continue... -
Unwrapping Use-Site Targets in Kotlin
I like Kotlin for its expressiveness. Its interoperability with Java allows the developer to easily use the existing Java ecosystem while enjoying a modern language. When it comes to annotations Kotlin handles them almost the same as Java. In Kotlin, a single syntax construction might be compiled into several JVM constructions. A Kotlin property would produce a JVM field, a getter, and optionally a setter. This is where annotation use-site targets are useful.
continue... -
A Better Structure for Kotlin Projects
When I write programs in Kotlin I usually don’t think about where to put my source files and how to structure packages; my build tool knows it better. After years of working with Java and then with Kotlin, it is not a surprise that code lies in
continue...src/main/kotlin
and tests insrc/test/kotlin
. I know where theresources
are and how they are packaged. Paths likecom/companyname/projectname
are paths corresponding to package names. This all looks familiar. However, we are so used to such setups that we often don’t understand what inconveniences they bring. In this article, I will explain what’s wrong with these defaults and how we can do better. -
My Two-Years-Long Journey in Learning German
When I started learning German I was curious about what I could expect from the language, how fast I would learn it, and what experience I would have. At the time, most of the stories I could find on the Internet were about people reaching fluency in half a year and guides about repeating their success. I would gladly read something close to how regular people learn. Learning English was tough. I didn’t expect German to be any easier. Now, after two years, I want to share my experience. I will try to explain my motivation, how I learn, what resources I use, how it went, how much it cost, and where I am right now. I do it for myself, but I hope other language learners might find it useful.
continue... -
Twitter Integration Plugin for JetBrains IDEs
I have implemented a small IntelliJ plugin to post code to Twitter. I often see tweets with code, so I thought why not make a better way to tweet. When you have the plugin installed, you can right-click on a selected piece of code, press “Tweet” and your IDE will redirect you to the Tweet creation window in your browser with the selected text.
continue... -
Using 'any' Matchers in Unit Tests Is a Code Smell
If you’ve worked with JUnit and Mockito, you must be familiar with matchers. They provide a way to verify parameters during method invocation. Among many of those, there is a group that allows matching any object as a condition. Their names all start with the word ‘any’:
continue...Matchers.any()
,Matchers.anyString()
,anyCollection()
, etc. If in your project, you find many of such calls there is a high chance that something is wrong with your code. Let me explain why. -
Why Would a Java Engineer Love Frontend Development?
It often happens that backend developers don’t like working with a frontend. Even more, some hate frontend development. The complaints are always the same: JavaScript is hell, there’s no types, it’s hard to predict the result, all that cross-browser stuff is a pain and many more. I was one of those guys but now I’m on the other side as the situation with JavaScript has changed. Sure, they still invent a new framework a day, what I mean is that working with a frontend is not a pain anymore. I’m going to explain some of the reasons I like frontend development and particularly why I like Angular with TypeScript.
continue... -
Why You Need to Implement Your Own IntelliJ IDEA Plugin
IntelliJ IDEA is a powerful tool that aims at increasing productivity. It speeds up the development process and optimizes most of the standard use cases such as code formatting, code generation, navigation, etc. However, the utility of IntelliJ IDEA is not limited to these processes. For instance, I set up my IDE to generate tests prefixed with the word ‘should’. My IDE also automatically adds annotations to test classes depending on their names. But what could make an IDE even more useful is implementing an own plugin that will optimize processes that cannot be customized via standard tools. What exactly could be achieved thereby? And how complex is it? This is what I’ll try to address in this blog.
continue... -
Why Event Sourcing Is Not a Choice for Your Next Project
Event-driven architecture has become extremely popular nowadays. It is easy to start and it can easily be integrated with popular Java frameworks like Spring. I have been working on event sourcing for the past six months. In this period, I have collected some thoughts on the subject of event-driven architecture. Despite all its features, I believe that such architecture should be applied very carefully in terms of understanding its consequences.
continue... -
Implementing do-while Loop in Scala
I have recently completed a Scala course on Coursera. Now that doesn’t turn me into a Scala programmer; however, the knowledge I acquired certainly has been very helpful with my everyday projects, especially when it comes to applying that knowledge to Java stream API. One of the tasks proposed by Martin Odersky was to implement a do-while loop using only Scala built-in features. This statement made a great impression on me. It’s proof of the power of the language and its features. In this blog post, I want to share the implementation of the do-while loop in Scala with you.
continue... -
Shipping Docker with a Java Application
Docker is not a new technology anymore. In the meanwhile, it has become an everyday tool for many developers. However, there are still a lot of people out there who haven’t tried Docker. In this article, I’m going to show you how to ship a standalone Java application in a Docker container.
continue...