Posts

All Practice Series

Image
Introduction This is a comprehensive page about the technologies I have shared in series format. You can view brief introductions and links to directly access each series you are interested in. In the field of software development, to deploy a product from the initial idea to its release, the standard process typically involves several stages as follows: Database : Designing and implementing the database according to business requirements, storing data during the system's operation. Backend : Handling the main logic of the system, communicating with the database and services. Frontend : Building the interface for users to interact with the system, which could be a desktop, mobile, or web application. This usually includes implementing UI/UX and integrating APIs from the backend. DevOps : Deploying the system for use, which can be done on a server or in the cloud. Testing : Applying testing methods to ensure the product meets the standards for release. Of course, these are just stan...

Guide to Seeding Mock Data for PostgreSQL Using Prisma and Snaplet Seed

Image
Introduction @snaplet/seed is a highly powerful library that supports automatic mock data generation for databases based on the Prisma schema. Instead of manually writing hundreds of lines of complex insert code, @snaplet/seed automatically analyzes relations in the database to generate logical, consistent and data-integrity-assured data. Standout advantages include the ability to automatically reset the database, inherently understand foreign key constraints and support concise syntax for easily creating nested data structures. Prerequisites This article is used alongside Prisma in a NestJS project, I will not specifically mention how to set up Prisma anymore, you can review the previous article to have the necessary preparation before proceeding Detail First, install the package yarn add -D @snaplet/seed Then, add the following scripts to package.json { "scripts" : { "seed:init" : "npx @snaplet/seed init prisma/seed" , "seed:sync...

Process of applying TDD to a NextJS project

Image
Introduction Test-Driven Development (TDD) is an advanced software development methodology where tests are written before the actual source code is implemented. This process operates in a repetitive cycle: Red (Write a failing test) -> Green (Write the minimum source code to make the test pass) -> Refactor (Optimize the code structure). Advantages : Improve source code quality: Minimize potential bugs right from the initial development phase. Better system design: Thinking about testing first helps you build highly modular, loosely coupled and easy-to-maintain modules. Confident Refactoring: You can comfortably improve and optimize code without fear of breaking existing features, thanks to the automated test system protection. Living documentation: Test cases act as precise specification documentation, helping team members clearly understand how the system operates. Reduce Debugging Time : TDD helps detect errors right at the moment "just finished typing". The c...