Posts

Showing posts with the label nodejs

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...

Using Prisma with PostgreSQL in NestJS

Image
Introduction Prisma is a next-generation ORM (Object-Relational Mapping) for NodeJS and TypeScript. It helps developers interact with databases intuitively and in a type-safe manner. Prisma possesses many outstanding advantages, including the ability to automatically generate optimal queries, automate the data migration process, provide powerful code auto-completion, and minimize runtime errors thanks to TypeScript's strict type-checking system. Compared to TypeORM, Prisma delivers a superior development experience thanks to a centralized, readable, and maintainable schema structure within a single file (schema.prisma). Instead of having to define complex Entity classes with multiple decorators like TypeORM, Prisma automatically generates Prisma Client based on the schema, ensuring absolute synchronization between the database and code. Additionally, Prisma's Rust-based query engine mechanism helps optimize data query performance with PostgreSQL more effectively, naturally avoi...

NestJS Practice Series

Image
Introduction NestJS is a progressive NodeJS framework designed for building efficient, reliable, and scalable server-side applications. Built on top of TypeScript (but also supporting pure JavaScript), NestJS combines elements of Object-Oriented Programming (OOP), Functional Programming (FP), and Functional Reactive Programming (FRP). The outstanding advantages of NestJS include: Modular architecture: Helps organize code scientifically, easy to maintain and expand for large projects. Powerful TypeScript support: Fully leverage static typing to minimize errors during development. Flexibility: Allows easy integration with other libraries (like Express or Fastify) and supports a wide variety of communication protocols (REST, GraphQL, WebSockets, Microservices). Rich ecosystem: Provides ready-to-use tools for processing common tasks like Validation, Caching, Database mapping (TypeORM/Prisma), and Authentication. Dependency Injection: A powerful mechanism that helps manage...

Guide to pushing docker images to AWS ECR

Image
Introduction Amazon ECR (Elastic Container Registry) is a fully managed Docker Registry (image repository) by AWS. Instead of having to operate your own Docker Hub or install a Registry on a server, you use ECR to store, manage, and deploy Docker Container Images in a highly secure and scalable manner. Advantages Deep integration with AWS: ECR works most seamlessly with Amazon EKS (Kubernetes) and ECS. You only need to declare the image path, and AWS will handle the authentication and image pulling (pull) automatically. Absolute security: Use AWS IAM for authorization. Only authorized Services or Users can push/pull images. Images are also automatically encrypted at rest. Image Scanning: ECR automatically checks the images you push to find any libraries with security vulnerabilities (CVE), giving you more peace of mind about your code. Lifecycle Policies: You can set up automatic deletion of old images and untagged images to avoid wasting storage space. High performance: Since images a...

Using AWS CDK to Create an AWS S3 Bucket

Image
Introduction In my previous post, I introduced AWS S3 and showed how to set it up using the AWS CLI and NodeJS. In this post, I’ll show you how to use the AWS CDK to manage your AWS resources - specifically, how to create an S3 bucket. The AWS Cloud Development Kit (AWS CDK) is an open-source framework for defining Infrastructure as Code (IaC). Instead of writing long, complex YAML or JSON configuration files (like CloudFormation), CDK lets you use familiar programming languages like TypeScript, Python, Java, C#, or Go to manage your AWS resources. Why use AWS CDK? Use languages you already know: You can use loops, conditions, variables, and Object-Oriented Programming (OOP) to define your infrastructure. Great IDE support: You get features like autocomplete, error checking as you type, and built-in documentation. Reusable code: You can easily package your infrastructure into libraries to share across different projects. Prerequisites First, you need an AWS account. You will also need ...