https://github.com/womb0comb0/slave-api
https://github.com/womb0comb0/slave-api
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/womb0comb0/slave-api
- Owner: WomB0ComB0
- License: apache-2.0
- Created: 2024-09-04T06:11:54.000Z (9 months ago)
- Default Branch: master
- Last Pushed: 2024-09-16T07:19:10.000Z (9 months ago)
- Last Synced: 2024-12-26T20:30:03.098Z (5 months ago)
- Language: TypeScript
- Homepage: https://slave-api.vercel.app/
- Size: 2 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# [slave-api](https://blog.santoshshinde.com/skeleton-for-node-js-apps-written-in-typescript-444fa1695b30) [](https://sonarcloud.io/summary/new_code?id=WomB0ComB0_slave-api)
Skeleton for Node.js applications written in TypeScript
## Purpose
Our main purpose with this Skeleton is to start server application with node js and typescript.
Try it!! I am happy to hear your feedback or any kind of new features.
## Common Features
- Quick start
- Integrated eslint, prettier and husky
- Global Error & Response Handler
- Simple and Standard scaffolding
- Based on Typescript Syntax
- Simple & Global Enviroment Configuration
- Request/Response Encryption & Decryption Implementation
- Easily Add new feature
- Integrated winston Logger
- Production Ready Skeleton
- Follwed Production Ready Best Practices: Security
- Added only used npm modules
- Swagger Documentation Support
- Unit & Integration Test Cases## Core NPM Module
- [x] `express`, `@types/express`
- [x] `@types/node`
- [x] `typescript`
- [x] `dotenv`
- [x] `cors`
- [x] `helmet`
- [x] `http-status-codes`
- [x] `winston`, `@types/winston`# [Start the application](https://blog.santoshshinde.com/skeleton-for-node-js-apps-written-in-typescript-444fa1695b30)

## Start The application in Development Mode
- Clone the Application `git clone https://github.com/WomB0ComB0/salve-api.git`
- Install the dependencies `npm install`
- Start the application `npm run dev`## Start The application in Production Mode
- Install the dependencies `npm install`
- Create the build `npm run build`
- Start the application `npm run start`
- Before starting make sure to update your `.env` values for your refrence just check `.env.example`## Project Structure
| Name | Description |
| --------------------------------- | ----------- |
| **wiki/** | You can add project documentation and insructions file here |
| **src/** | Source files |
| **src/abstractions** | Abstarct classes and Interfaces |
| **src/components** | REST API Components & Controllers |
| **src/lib** | Reusable utilises and library source code like a logger|
| **src/middleware/** | Express Middlewares like error handler feature |
| **build/** | Compiled source files will be placed here |
| **tests/** | Test cases will be placed here |
| **tests/helpers/** | Helpers for test cases will be placed here |
| **tests/unit-tests/** | Unit Test cases will be placed here |
| **tests/integration-tests/** | API routes (Integration) Test cases will be placed here|## Workflow

## Encryption
Set the `APPLY_ENCRYPTION` environment variable to `true` to enable encryption.
## Swagger API Documentation
The swagger documentation is available at the following url `${host}/docs`:
[http://localhost:8080/docs](http://localhost:8080/docs)
## Default System Health Status API
- `${host}/api/system/info` - Return the system information in response
- `${host}/system/time` - Return the current time in response
- `${host}/system/usage` - Return the process and system memory usage in response
- `${host}/system/process` - Return the process details in response
- `${host}/system/error` - Return the error generated object in response
### [Postman Collections](wiki/postman/node-boilerplate.postman_collection.json)
## Refrences
- [Skeleton for Node.js Apps written in TypeScript](https://javascript.plainenglish.io/skeleton-for-node-js-apps-written-in-typescript-444fa1695b30)
- [Setup Eslint Prettier and Husky in Node JS Typescript Project](https://gist.github.com/santoshshinde2012/e1433327e5f7a58f98fe3e6651c4d5de)## Notes
### 1. Why is my git pre-commit hook not executable by default?
- Because files are not executable by default; they must be set to be executable.
```
chmod ug+x .husky/*
chmod ug+x .git/hooks/*
```### 2. [Production Best Practices: Security](https://expressjs.com/en/advanced/best-practice-security.html)
- Don’t use deprecated or vulnerable versions of Express
- Use TLS
- Use Helmet
- Use cookies securely
- Prevent brute-force attacks against authorization
- Ensure your dependencies are secure
- Avoid other known vulnerabilities
- Additional considerations### 3. Tutorials
- [Skeleton for Node.js Apps written in TypeScript (with Setup Instructions for ESLint, Prettier, and Husky)](https://blog.santoshshinde.com/skeleton-for-node-js-apps-written-in-typescript-444fa1695b30)
- [Global Error and Response Handler in Node JS with Express and Typescript](https://blog.santoshshinde.com/global-error-and-response-handler-in-node-js-with-express-and-typescript-913ec06d74b3)
- [Testing with Jest in TypeScript and Node.js for Beginners](https://blog.santoshshinde.com/beginners-guide-to-testing-jest-with-node-typescript-1f46a1b87dad)
- [Static Code Analysis for Node.js and TypeScript Project using SonarQube](https://blog.santoshshinde.com/static-code-analysis-for-node-js-and-typescript-project-using-sonarqube-8f90799add06)
- [Visualization of Node.js Event Emitter](https://blog.santoshshinde.com/visualization-of-node-js-event-emitter-4f7c9fe3a477)
### Please connect with me on Twitter [@shindesan2012](https://twitter.com/shindesan2012) & [https://blog.santoshshinde.com](https://blog.santoshshinde.com/)