A command-line contact management application using typescript and sqlite

A command-line contact management application using typescript and sqlite

I completed a fun mini project using TypeScript that allows users to manage contacts directly from the command line.

Packages used

  • better-sqlite3 ^11.5.0

  • chalk ^5.3.0

  • chalk-animation ^2.0.3

  • drizzle-kit ^0.27.0

  • drizzle-orm ^0.36.0

  • figlet ^1.8.0

  • gradient-string ^3.0.0

  • inquirer ^12.0.1

  • prompt-sync ^4.2.0

  • vcard4-ts ^0.4.1

  • vcards-js ^2.10.0

  • zod ^3.23.8

Github link

  • Introduction to the Project

This project is a great starting point for beginners learning TypeScript.

Why Use TypeScript?

TypeScript helps prevent type errors throughout the project, making your code more reliable.

Tools and Libraries

In this project, we use Drizzle-kit and ORM along with better-sqlite3. This combination allows us to avoid writing raw SQL queries manually, which can be tedious.

Handling User Input

When working with JavaScript objects, taking user input and validating it can be boring and time-consuming. To simplify this process, I used Inquirer.js for gathering input.

Importance of Data Validation

Data validation is crucial in programming. In the JavaScript and TypeScript world, Zod stands out for its ease of use, performance, and reliability. I utilized Zod for validating user input.

User-Friendly Messages

To display welcome messages, error alerts, or success notifications in an appealing way, I used Figlet to create stylized text patterns.

Enhancing Prompts with Colors

The Chalk package adds color to Inquirer prompts, making them more visually engaging. Additionally, Chalk Animation helped me create colorful animations for welcome messages.

Adding Color Gradients

I also used Gradient String to add beautiful color gradients to the text.

Working with VCF Files

For creating and reading VCF files, I incorporated both vcards-js and vcard4-ts libraries.