Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Minimal Node.js TypeScript template (Node 22 LTS, pnpm, ts-node, ESLint+Prettier, dotenv). Strict TS5. Give me a star and make me happy.

License

NotificationsYou must be signed in to change notification settings

sajaddp/typescript-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A modern, minimal template for starting TypeScript projects on Node.js with sensible defaults and a smooth developer experience.

Features

  • TypeScript 5 with strict mode and Node LTS (22) aligned config
  • Fast iteration usingts-node for development
  • Biome (formatter + linter) for consistent, high-quality code
  • Environment variables viadotenv
  • Dependency management withpnpm

Prerequisites

  • Node.js 20 or 22+ (LTS recommended)
  • pnpm 10+

Quick Start

  • Clone and install dependencies:
git clone https://github.com/sajaddp/typescript-template.gitcd typescript-templatepnpm i
  • Configure environment variables:

  • Create a.env file in the project root (if it doesn’t exist) and set:

MY_SECRET="your-secret-value"
  • Run in development mode:
pnpm dev

The app logs the value ofMY_SECRET to the console.

Scripts

  • pnpm dev: Run the app withts-node fromsrc/index.ts.
  • pnpm build: Compile TypeScript withtsc.
  • pnpm format: Format codebase with Biome's formatter.
  • pnpm lint: Run Biome in safe mode (formats and sorts imports).
  • pnpm lint:unsafe: Run Biome with unsafe fixes (also removes unused imports).

Note: Afterpnpm build, JavaScript output is emitted alongside the.ts files by default. You can setoutDir intsconfig.json (e.g.,dist) and then runnode dist/index.js.

Project Structure

.├── src/│   └── index.ts          # Entry point (example: reading an env variable)├── biome.json            # Biome configuration for formatting and lint checks├── tsconfig.json         # TypeScript configuration aligned with Node 22├── package.json          # Scripts and dependencies├── .env                  # Local environment variables└── README.MD

Code Quality

  • Biome (safe): Format and sort imports

    pnpm lint
  • Biome (unsafe): Apply safe fixes and remove unused imports

    pnpm lint:unsafe
  • Formatter-only:

    pnpm format

TypeScript Settings

  • Target:es2023
  • Module/Resolution:node16
  • Enabled:strict: true,esModuleInterop: true,resolveJsonModule: true

To emit compiled files into a separate directory, enableoutDir intsconfig.json.

Troubleshooting

  • Missing env value: Ensure.env exists andMY_SECRET is defined, then run withpnpm dev.
  • Where is the build output? WithoutoutDir,.js files are emitted next to.ts. Either runnode src/index.js or configureoutDir (e.g.,dist) and runnode dist/index.js.

License

Released under the MIT License.

About

Minimal Node.js TypeScript template (Node 22 LTS, pnpm, ts-node, ESLint+Prettier, dotenv). Strict TS5. Give me a star and make me happy.

Topics

Resources

License

Security policy

Stars

Watchers

Forks


[8]ページ先頭

©2009-2025 Movatter.jp