[TOC]
- Language: NodeJS, TypeScripts
- Database: Redis, MongoDB, PostgreSQL, ElasticSearch
- Container: Docker, Docker Compose
- Package manager: Yarn
- Linter: ESLint, Prettier
- Package and library:
- Group related files by directory, it's easy to focusing on small portions and
avoid complexity
- Organize files by feature not by function.
- Store the test files next to the code.
- Be pragmatic modules: the node philosophy about small modules and single
purpose modules
- Only build modules as needed follow YANGI principle
- Place Your Test Files Next to The Implementation
- Put your long npm scripts in a scripts directory
- Reduce cross-cutting coupling with Events
- Code flow is followable - magic directories in the filesystem. The app starts at app/server.js and you can see everything it loads and executes by following the code.
- Don't do magic things
- Don't autoload files from
- Don't do silly metaprogramming
- Be easy to locate code
- Name are meaningful and accurate
- Crufty code is fully removed, not left around in a orphan file or just commented out
- Use simple and obvious naming
- Use lower-kebab-case filenames
- Npm forbids uppercase in new package names.
- This format avoids filesystem case sensitivity issues across platforms
- Variable name must be camelCase
- For more detail, please refer to styleguide.md
Name | Description |
---|---|
.vscode/ | VSCode tasks, launch configuration and some other settings |
dist/ | Compiled source files will be placed here |
src/ | Source files |
src/config/ | Configure environment and swagger |
src/feature//.controller.ts | REST feature Controllers |
src/feature//.router.ts | Router include endpoint and middleware |
src/feature//.schema.ts | Schema of request and response |
src/feature//.test.ts | Unit test |
src/lib/ | Connection of databases |
src/models/ | Model entities of database |
src/utils/ | Additional function |
.env.example | Example Environment configurations |
.env.test | Test environment configurations |
Create .env
file. Copy content from .evn.default
into .env
. Change config in .env
corresponding to your environment
yarn install
yarn dev
yarn run test