Skip to content

🚦🏎 ✍️ A full fledged, no nonsense, Node/TypeScript/Express/ESLint/Jest/Docker starter template

License

Notifications You must be signed in to change notification settings

bobbyg603/node-typescript-express-docker-starter

Repository files navigation

Node TypeScript Express Docker Starter

node typescript express docker logos

πŸ“– Definitions

Library Description
Node.js JavaScript runtime built on Chrome's V8 JavaScript engine
Express Minimal and flexible Node.js web application framework for creating APIs.
TypeScript A strongly typed programming language that builds on JavaScript, giving you better tooling at any scale.
ESLint Statically analyzes your code to quickly find problems.
Jest A delightful JavaScript testing framework with a focus on simplicity.
Docker Package software into standardized units for development, shipment and deployment

πŸ§‘β€πŸ« About

Node-TypeScript-Express-Docker-Starter is a template repo for building a Node.js APIs with TypeScript, Express and Docker. This template contains a minimal ESLint configuration to enforce coding styles, and comes equipped with Jest for unit and integration testing. Additionally, this project's API routes are structured similarly to how components are organized in an Angular project. Controllers are grouped by the API resource they serve, and the associated unit (spec.ts) and integration (e2e.ts) files live in the same directory.

πŸ§‘β€πŸ’» Development

Install Docker Desktop, VS Code and Git. Click the green Use this template button to copy this repo to your GitHub account. Once you've copied the repo, clone it to your workspace (be sure to replace my URL with the URL to the repo you generated by clicking Use this template):

Download and Install

git clone https://github.com/bobbyg603/node-typescript-express-docker-starter

Install the project's dependencies:

npm i

Testing

Run the unit and integration tests to ensure everything installed correctly:

npm test && npm run e2e

You can also run and debug tests from within the VS Code Testing Explorer by installing Jest Test Explorer.

VS Code Jest Test Explorer Debug

Developing

This template requires Node.js version 19+. A .nvmrc file has been included in this repo so that nvm can be used to quickly switch between major versions of Node.js.

Install nvm for POSIX or Windows and run the following command at the root of the repo to switch to Node.js 18:

nvm use

If you'd like to automatically build and restart the development sever when source files are changed you can can run the watch command:

npm run watch

The development server can also be started without watching the local file system or attaching the debugger:

npm start

If you'd like to attach the VS Code Debugger to a Node.js instance running on your local machine use the Launch Program task.

VS Code Launch Program

The development server should begin listening for web requests. If you navigate to http:https://localhost:3000 in your browser you should see something that resembles the following:

Development Server Running

Docker

The VS Code Debugger can also be attached to a Node.js instance running inside a Docker container via the Docker: Node.js Launch task.

Docker Node JS Launch

If you'd like to watch your file system for changes and reload your application when changes are detected you can run the build:watch command on the host machine:

npm run build:watch

Contributing

If you believe that this example can be improved, please open an issue or submit a pull request!

About

🚦🏎 ✍️ A full fledged, no nonsense, Node/TypeScript/Express/ESLint/Jest/Docker starter template

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published