The project structure for helping new api using any http server ( Using express for these boilerplate )
bin/
config/
routes/
/src/
|- data/
|-- connections/
|-- repositories/
|-- structures/
|- domain/
|- handlers/
|- middlewares/
|- routes/
|- services/
|- utils/
/tests/
This structure, is based on some designs like DDD, Middleware Based NodeJS and the folders has the follow objectives:
bin/ - Binaries folder, can be used for routines postinstall of npm.
config/ - All of the configurations autoload of the project, like database variables.
config/routes/ - Autoload of routes for less dependency.
src/data/ - Contains the files for manipulating the connection ( repositories, structures, connection )
src/domain/ - Following the concept of DDD, the domain can be a domain of your application.
src/handlers/ - Following the concept of Middleware Based, the handlers manipulate the requests and delegate to your services.
src/middlewares/ - Middleware of routes, can be Auth, Roles...
src/routes/ - All routes for your project ( Obs: The route need has the name like *.route.js inside folder routes/ ).
src/services/ - Services for your application.
src/utils/ - Utils for your application, parser, and any util.
tests/ - Tests, actually using JEST.
npm install
npm test
- dotenv: Loads environment variables from .env file
- express: Fast, unopinionated, minimalist web framework
- express-rescue: A wrapper for async functions which makes sure all async errors are passed to your errors handler
- filter-files: Recursively read directories and return a list of files, filtered to have only the files for which the (optional) filter function returns
true
. Sync and async. - is-directory: Returns true if a filepath exists on the file system and it's directory.
- lodash: Lodash modular utilities.
- mongodb: The official MongoDB driver for Node.js
- @types/dotenv: TypeScript definitions for dotenv
- @types/express: TypeScript definitions for Express
- @types/node: TypeScript definitions for Node.js
- chai: BDD/TDD assertion library for node.js and the browser. Test framework agnostic.
- mocha: simple, flexible, fun test framework
- nodemon: Simple monitor script for use during development of a node.js app.
- tslint: An extensible static analysis linter for the TypeScript language
- typescript: TypeScript is a language for application scale JavaScript development
MIT
Please read CONTRIBUITING.md
Please read TODO