loclv / typescript-nodejs-template

Typescript Node.js Template πŸ§‘πŸΏβ€πŸ’» Project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeScript Node.js Template Project

TypeScript Node.js Project.

🌠 Using

  • pnpm - Fast, disk space efficient package manager.
  • TypeScript - a strongly typed programming language.
  • Jest - a delightful Testing Framework with a focus on simplicity.
curl -fsSL https://get.pnpm.io/install.sh | sh -
pnpm -v

πŸ”οΈ Environment

If you are using fnm - Node.js version manager:

fnm use

Set your environment variable in .env file.

πŸ§‘πŸΏβ€πŸ’» Build Setup

# install dependencies
pnpm i

# create `.env`
cp .env.development .env

# πŸ§‘πŸΏβ€πŸ’» Development: serve with hot reload
pnpm dev

pnpm lint
pnpm test

# Compile and transpile the TypeScript code:
pnpm build

# Compile and transpile the TypeScript code, and then runs the resulting `.js` application:
# Starts the app in production
pnpm start

If you want to run Unit tests every time you commit code, you can add pnpm test to .husky/pre-commit.

Deployment

In develop environment, build first:

pnpm build

In production environment, install dependencies and run builded source:

pnpm i --production --quiet
pnpm prod

🏘️ Special Directories

media

The media directory is used to store supporting files for the application. Things like requirement documentation, text outlines, etc. This is the junk drawer for the project.

src

data

The data directory holds the types (models/entities) and services (repositories) for data consumed by the application.

mock

The mock directory contains your JSON mock data for testing purposes.

Editor - vscode

Extensions

Options:

About

Typescript Node.js Template πŸ§‘πŸΏβ€πŸ’» Project


Languages

Language:TypeScript 97.4%Language:JavaScript 1.8%Language:Shell 0.8%