Contents
This is a fresh & blank template, with some of the most common and helpful (but basic) modules included, as well as automatic logging configured out the box. After installation and starting the application, you will have a simple and empty HTTP REST Server hosted locally, ready-to-go. Everything inclusive of this template will be completely up to date, and updated each time it is installed, so it will never depreciate and is safe to use over time repeatedly. This is the perfect starting point for any project, as you can simply install this template and then start importing your own modules, or writing your own code, without any hassle. Completely compatible with any vision or modules.
A new project can be written in either TypeScript or JavaScript, without any further changes needed, however this template is set up and intended for TS, making use of it's typesetting, pre-compiling abilities, and simplicity in an object-oriented approach.
This template is completely unrestricted, and free for anyone to use, unlimited, with no credit or acknowledgements needed. There are no signs of any ownership, or personal touches, inside the codebase.
- Typescript - Write in TypeScript (or JS), Compiles down to JavaScript.
- NodeJS - Node Runtime Environment.
- ExpressJS - Server & Router Infrastructure Framework.
- EJS - Serves Client Views.
- ESLint - Code Parsing, Styling & Error Checking.
- Mocha-Chai - Testing with Mocha Framework, using the Chai Library.
- Nodemon - Restart Application without Compiling, on a Change to Watched Files.
- Rimraf - Directory Cleaner Tool.
- Dotenv - Project Secrets Stored in a Local .env File.
- SimpleTxtLogger - Logging tool.
- @types/* - Various JS->TS Typesetting modules, to import types. Needed to use a JavaScript module with TypeScript when strict settings are enabled, or to make use of TS only features against a imported module.
- See Complete Instructions to create this template yourself, without any of the extra optional modules.
For help or guidance in downloading and running the application, see the following subsections.
You must have npm (node package manager) and Nodejs installed on your system!
- Update npm:
npm install npm@latest -g
- Clone/Download:
git clone https://github.com/tberey/typescript-node-fresh-start-template.git
- Install:
npm install
- Start:
npm run start
Endpoint | Action/Desc. | Full URI (hosted locally, for some port; e.g.: 3000, which is default for this template) |
---|---|---|
|
Homepage: The client-side landing page. |
|
The following steps are complete instruction to create this template, but without any of the extra modules, and begin a brand new project in Nodejs with TypeScript from a blank slate. The commands are shell commands, to be carried out in a terminal, console or other shell environment.
- Create a new local directory and change current directory to new one:
mkdir <PROJECT_NAME> && cd <PROJECT_NAME>
- Initialize a new package.json file:
npm init -y
- Install TypeScript dependencies:
npm i --save-dev typescript ts-node
- Initialize a new tsconfig.json file:
npx tsc --init
- [Optional] Some basic parameters to use in the tsconfig.json file. My settings for this file can be found here also, to copy & paste. Otherwise, adjust this further with own preferences, or leave it as is.
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"declaration": true,
"sourceMap": true,
"outDir": "build",
"rootDir": "./",
"strict": true,
"esModuleInterop": true
}
}
- Create main.ts, the entry point into the application:
echo "console.log('Hello, World');" > main.ts
- [Optional] Some basic information and scripts, for the package.json file:
{
"name": "<App-Name>",
"version": "1.0.0",
"description": "<App_Desc>",
"main": "build/main.js",
"types": "build/main.d.ts"
"scripts": {
"setup": "npm update && npm install",
"build": "tsc",
"start": "node build/main.js",
"start:src": "ts-node main.ts"
}
}
- [Optional] Install, compile and start application (it won't do much yet, but you're off to a running start now):
npm run setup
npm run build
npm run start
^ Step 8.: These commands require the optional Step 7 to have been followed, to work as intended.
'npm run setup' installs and updates the project and it's dependencies, 'build' will compile the project into browser/app runnable JS, and 'start' will run the project, from the compiled files in build. 'start:src' runs the project from the source TS file, so compilation is not necessary.
Below is the refined and confirmed roadmap, that has been planned for completion. See open issues and also the project board, for any other proposed features or known issues, which may not be listed below.
Feature/Task/Bugfix | Details | Version (if released) | Notes |
---|---|---|---|
Bug#1 | Bug details... | 0.0.1 | example#1 |
Feature#4 | Feature details... | example#2 |
Version | Date | Changes |
---|---|---|
1.0.0 | 2021-07-09 |
|
1.0.1 | 2021-07-14 |
|
1.0.2 | 2021-08-01 |
|
1.0.3 | 2021-08-03 |
|
Contributions are welcomed and, of course, greatly appreciated.
- Fork the Project.
- Create your Feature Branch (
git checkout -b feature/Feature
) - Commit your Changes (
git commit -m 'Add some Feature'
) - Push to the Branch (
git push origin feature/Feature
) - Open a Pull Request.
Tom Berey; Project Manager, Lead Developer, Principal Tester & Customer Services;
tomberey1@gmail.com;