Identify and Remove Unused Files in Next.js Projects

Summary of my bookmarked links and Github repositories from Nov 23rd, 2021


  • Dependency Injection in TypeScript

    This article explains the concept of dependency injection and its implementation in Node.js using TypeScript and the TypeDI library. It discusses the Dependency Injection Principle, which suggests that classes should receive their dependencies instead of instantiating them. The article introduces Inversion of Control (IoC) and explains that a DI framework is required to apply the dependency injection principle. TypeScript and TypeDI are used as examples in this article. The article also provides code examples and a GitHub repository for reference. It covers the setup process, dependencies, and the structure of a dummy RESTful server with controllers, models, repositories, and services.

  • Infrastructure as Code: the next big shift is here

    This blog post explores the evolution of software infrastructure and highlights the significance of Infrastructure as Code (IaC). It discusses the impact of virtualization, the emergence of DevOps culture, and the role of public cloud infrastructure and container orchestration. The article introduces Crossplane as a powerful tool that leverages Kubernetes and promotes collaboration between application teams and platform teams. It emphasizes the benefits of Crossplane, such as composable infrastructure, self-service provisioning, increased automation, standardized collaboration, and the use of a ubiquitous language (Kubernetes API). The post acknowledges the complexity and YAML proliferation associated with Crossplane but considers it a revolutionary solution for infrastructure provisioning and management.

  • How To Effectively Scale Your Web Application

    This article discusses various scaling solutions for web applications. It emphasizes the importance of selecting appropriate scaling patterns and covers the processes involved in scaling your web server effectively. The two main scaling patterns discussed are vertical scaling (scaling up) and horizontal scaling (scaling out). The article explains the limitations of vertical scaling and the benefits of horizontal scaling, which offers fault-tolerant infrastructure and cost advantages. Additionally, it mentions the use of load balancers for traffic distribution and highlights the role of cloud service providers in simplifying scaling processes. Other topics covered include session storage, caching database queries, and using a content delivery network (CDN) to serve static assets. The article concludes by mentioning the upcoming final part of the series on scaling the client-side with front-end performance patterns.

  • Clean API Call With React Hooks

    This blog post discusses how to make API calls more consistent and reusable throughout a React application using React hooks. It highlights the repetitive tasks involved in API calls and the need for a higher level of abstraction. The author demonstrates refactoring the code to create a reusable API calling layer by encapsulating the common functionalities in a custom hook. The post emphasizes separating responsibilities, abstracting API client-related code, and creating a low-level component for data display. It concludes by emphasizing the importance of writing clean and maintainable code in React applications.

  • I Was Shocked To Catch A Candidate Cheating In An Online Interview

    The author shares their experience of interviewing a candidate for a backend and cloud team. Despite being impressed initially, they observed a pattern of cheating as the candidate copied code and provided bookish definitions during the interview. The author expresses shock and disappointment, considering the candidate's prestigious educational background. They warn readers about the prevalence of such behavior in the online recruitment landscape and advise caution while conducting interviews online.

  • Code Quality Automation: What’s Around the Corner?

    Continuous code quality assessment is essential for maintaining a maintainable code base. The process can be divided into two sections: proactive and preventive. Proactive measures involve establishing code style guides and using automated tools like linters to enforce best practices. Preventive measures include implementing quality gates and conducting manual code reviews. Static code analysis is the first stage of automation, where code is evaluated without context to identify non-compliant segments. Several popular tools, such as SonarCloud, DeepSource, and Embold, automate static code analysis. AI-powered automation is the future, using classification learning algorithms and supervised learning to detect coding mistakes. Tools like Embold, Code Defect AI, AI Reviewer, and DeepCode leverage AI for code quality improvement. DevSecOps tools like Codacy, SonarCloud, and WhiteSource integrate security into the development workflow and automate code quality evaluation, reducing manual effort.

Github repositories

  • pacocoursey/next-unused

    next-unused is a tool designed for Next.js projects that helps you identify unused files. To get started, install it as a devDependency using Yarn. Then, add a script in your package.json to run the tool and list any unused files. You can configure next-unused by adding properties to your package.json, such as aliases, directories to include or exclude, and entrypoints. An example demonstrates how to use next-unused to find an unused file in a Next.js setup. The script was initially written by Shu and Luc.