https://github.com/crazyoptimist/service-template-nodejs
NodeJS Typescript Service Template
https://github.com/crazyoptimist/service-template-nodejs
Last synced: about 1 year ago
JSON representation
NodeJS Typescript Service Template
- Host: GitHub
- URL: https://github.com/crazyoptimist/service-template-nodejs
- Owner: crazyoptimist
- Created: 2023-05-12T08:45:57.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-31T07:18:23.000Z (almost 3 years ago)
- Last Synced: 2025-02-05T23:00:50.900Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 219 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NodeJS Typescript Service Template
## Style Guide
### Project Structure
- `src/main.ts` is the starting point of the application, keep it short and simple.
- `src/helpers` is where we organize broken-down modules that runs business logics, create sub folders if needed.
- `src/config` is where we organize application global configurations and constants. Every environment variables should be verified(and maybe re-organized as nested objects if we prefer) in src/config. We should not read env vars directly like process.env.FOO, because it's hard to track what's used where.
- `src/utils` is where we organize utility functions that doesn't contain any business logics
- `src/common` is where we organize shared code which is reused and is shared between different modules, and is specific to this project. Create sub folders if needed.
- `src/scripts` is where we organize one-off scripts.
- `testdata` is where test sample data live. Create sub folders as needed.
### Naming Conventions
- Use `kebab-case` for folders
- Use `camelCase` for variables, functions, and files
- Use `PascalCase` for classes, types, interfaces, enums
- Use `ALL_UPPER_CASE` for constants
### Tests
- Place test files in the same folder as the code that the tests are written for.
## Development
- Node.js(> v18.x) is required
- Install dependencies
```bash
npm i
```
- Run the application
```bash
npm run dev
```
## Logging
- Structured logging with `pino`
## Documentation
- Organize design documentations into `docs` folder