GithubHelp home page GithubHelp logo

rafaelgss / node-architeture-project-design Goto Github PK

View Code? Open in Web Editor NEW
11.0 3.0 0.0 208 KB

:bookmark_tabs: A Node.js service structure - Package CLI (napd)

License: MIT License

JavaScript 84.65% TypeScript 15.35%
nodejs-starterpack nodejs-api-boilerplate starter-kit nodejs-boilerplate

node-architeture-project-design's Introduction

NodeJS API Structure

The project structure for helping new api using any http server ( Using express for these boilerplate )

Install from CLI

HERE

Structure

bin/
config/
  routes/
/src/
|- data/
|-- connections/
|-- repositories/
|-- structures/    
|- domain/
|- handlers/
|- middlewares/
|- routes/
|- services/
|- utils/
/tests/

Concept of Structure

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.

Tests

npm install
npm test

Dependencies

  • 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

Dev Dependencies

  • @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

License

MIT

CONTRIBUITING

Please read CONTRIBUITING.md

TODO

Please read TODO

node-architeture-project-design's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

node-architeture-project-design's Issues

Add more information to the README

Hi, @RafaelGSS I want to contribute to this project, I noticed that the project README has very little information, so we can add a CONTRIBUTING.md, add more sections talking about the project and so on...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.