This is a skeleton project for building applications using Node.js, Express, and TypeScript. It comes pre-configured with essential tools and libraries, including TypeScript, ESLint, Prettier, Vitest, and Docker, to help you get started quickly and maintain code quality.
- TypeScript for type safety
- Express for building web applications
- ESLint for linting and code quality
- Prettier for code formatting
- Vitest for testing
- Docker for containerization
- Husky with lint-staged for pre-commit hooks
Before you begin, ensure you have the following installed:
- Node Version Manager (nvm) (to manage Node.js versions)
- Docker (latest version)
- Install nvm (if you haven't already):
Follow the instructions in the nvm repository to install nvm.
- Clone the repository:
git clone https://github.com/gvre/skeletos.git- Navigate to the project directory:
cd skeletos- Install Node.js using nvm:
nvm install- Enable corepack:
corepack enable- Install the dependencies:
pnpm install --frozen-lockfileThe TypeScript configuration is located in tsconfig.json. It includes settings for compiling TypeScript using strict rules.
ESLint is configured in eslint.config.js. It helps maintain code quality by enforcing coding standards. You can customize the rules as needed.
Prettier is configured in .prettierrc. It ensures consistent code formatting across the project. You can adjust the settings to fit your preferences.
Vitest is configured in vitest.config.ts. It is set up for testing TypeScript files.
The project includes a Dockerfile for containerization. This allows you to build and run your application in a Docker container.
The project uses Husky with lint-staged to automatically format code before commits. The pre-commit hook runs Prettier on staged files to ensure consistent code formatting.
To set up pre-commit hooks (if not already configured):
npx husky init
echo "pnpm exec lint-staged" > .husky/pre-commit
chmod +x .husky/pre-commitThe lint-staged configuration in package.json formats TypeScript, JavaScript, Markdown, and YAML files automatically on commit.
The following scripts are available in package.json:
pnpm run build: Compiles the TypeScript files to do syntax checking.pnpm run start: Starts the application in production mode.pnpm run dev: Starts the application in development mode with hot reloading.pnpm run test: Runs the Vitest test suite.pnpm run lint: Runs ESLint to checkpnpm run lint:circular: Runs Madge to check for circular dependencies.pnpm run lint:all: Runs ESLint and Madge.