https://github.com/carrilloapps/node-ts-skeleton
https://github.com/carrilloapps/node-ts-skeleton
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/carrilloapps/node-ts-skeleton
- Owner: carrilloapps
- License: bsd-3-clause
- Created: 2024-11-26T20:24:30.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-11-26T20:42:52.000Z (over 1 year ago)
- Last Synced: 2025-02-13T02:43:49.989Z (over 1 year ago)
- Language: TypeScript
- Size: 78.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# node-ts-skeleton






[](https://github.com/carrilloapps/node-ts-skeleton/releases/)
[](#license)
[](https://github.com/carrilloapps/node-ts-skeleton/issues)
## Description
This is a skeleton project intended for projects requiring the use of Node with TypeScript. The solution is initially designed for general use but provides capabilities for unit testing, HTTP, and environment variable management.
### Libraries
This project primarily includes the following libraries and elements.
## Installation
Follow these steps to set up the project on your local machine:
1. **Clone the repository**
Clone the project repository from GitHub:
```bash
git clone https://github.com/carrilloapps/node-ts-skeleton.git
cd nodets
```
2. **Install the dependencies**
Install the project dependencies using npm:
```bash
npm install --legacy-peer-deps
```
3. **Configure environment variables**
Create a `.env` file in the `src/app` directory and define your environment variables as needed. Here's an example:
```bash
PORT=3000
NODE_ENV=development
```
4. **Start the project**
Start the project using the following command:
```bash
npm start
```
5. **Run the tests**
To run the unit tests, use:
```bash
npm test
```
This command will run all the tests in the `src/test` directory.
6. **Build the project**
To build the project, use:
```bash
npm run build
```
This command will compile the TypeScript code into JavaScript and place it in the `dist` directory.
## Usage
Examples of how to use the project after installation. For example:
``` bash
npm start
```
This command will start the project with the default configuration:
- [Jest](https://jestjs.io/) for unit testing
- [DotEnv](https://www.npmjs.com/package/dotenv) for environment variables
- [Winston](https://www.npmjs.com/package/winston) for logging
- [TypeScript](https://www.typescriptlang.org/) for code compilation
- [Eslint](https://eslint.org/) for code linting
- [Prettier](https://prettier.io/) for code formatting
- [Husky](https://www.npmjs.com/package/husky) for pre-commit hooks
- [Nodemon](https://nodemon.io/) for development server
- [TS-node](https://www.npmjs.com/package/ts-node) for TypeScript Node integration
## Examples
The `main.ts` file is the main application file where an example of how to use the project can be seen.
``` typescript
import logger from "app/app.logger";
import env from "app/app.env";
export function main() {
logger.info("Starting app...");
logger.info(`Environment: ${env.apiKey}`);
}
main();
```
## Contribution
Guide to contribute to the project. For example:
1. Fork the repository.
2. Create a new branch (`git checkout -b feature/new-feature`).
3. Make your changes and commit them (`git commit -am 'Add new feature'`).
4. Push your changes (`git push origin feature/new-feature`).
5. Open a Pull Request.
## License
Released under [BSD 3-Clause License](/LICENSE) by [@carrilloapps](https://github.com/carrilloapps).