GithubHelp home page GithubHelp logo

helene-nguyen / architecture-api Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 234 KB

Work on new way architecture API - NodeJS ExpressJS Typescript

JavaScript 0.69% Makefile 1.10% PLpgSQL 10.18% Shell 16.63% TypeScript 71.40%

architecture-api's Introduction

Architecture API - Clean architecture


Introduction

This repository contains a starter template for user authentication and CRUD operations.

This API was inspired by some concepts from the hexagonal architecture work of Dr. Alistair Cockburn in an article he wrote in 2005.

Ports & Adapters is a pattern that promotes decoupling from technology and frameworks.

Summary

Requirements

Having NodeJS installed.

Install all dependencies:

npm i

Don't forget to add .env file. You'll find an example.

Tools and versions

  • OS

    • Linux OS -
    • Windows OS -
  • IDE

    • VSCodium v1.77.3
  • NodeJS v20.0.0

  • Typescript v5.0.4

  • Dependencies

"dependencies": {
    "ajv": "^8.12.0",
    "bcrypt": "^5.1.0",
    "debug": "^4.3.4",
    "dotenv": "^16.0.3",
    "express-session": "^1.17.3",
    "helmet": "^6.1.5",
    "jsonwebtoken": "^9.0.0",
    "nodemailer": "^6.9.1",
    "pg": "^8.10.0",
    "swagger-jsdoc": "^6.2.8",
    "swagger-ui-express": "^4.6.2"
  }
  • Dev dependencies
  "devDependencies": {
    "@faker-js/faker": "^7.6.0",
    "@types/bcrypt": "^5.0.0",
    "@types/debug": "^4.1.7",
    "@types/express": "^4.17.17",
    "@types/express-session": "^1.17.7",
    "@types/jsonwebtoken": "^9.0.2",
    "@types/nodemailer": "^6.4.7",
    "@types/pg": "^8.6.6",
    "@types/swagger-jsdoc": "^6.0.1",
    "@types/swagger-ui-express": "^4.1.3",
    "@typescript-eslint/eslint-plugin": "^5.59.1",
    "@typescript-eslint/parser": "^5.59.1",
    "concurrently": "^8.0.1",
    "eslint": "^8.39.0",
    "typescript": "^5.0.4"
  }
  • Typescript configuration file:
{
  "compilerOptions": {
    "module": "ES2022",
    "esModuleInterop": true,
    "target": "ES2022",
    "moduleResolution": "node",
    "sourceMap": true,
    "outDir": "dist",
    "strict": true,
    "strictNullChecks": true,
    "removeComments": true,
    "resolveJsonModule": true
  },
  "lib": ["es2015"],
  "compileOnSave": true
}

Folder structure

├── src
|  ├── config
|  |  ├── database
|  |  |  └── connect.ts
|  |  └── options
|  |     ├── cors.ts
|  |     └── session.ts
|  ├── domain
|  |  ├── core
|  |  |  ├── coreController.ts
|  |  |  ├── coreDatamapper.ts
|  |  |  ├── coreModel.ts
|  |  |  └── coreRouter.ts
|  |  ├── main
|  |  |  ├── controller.ts
|  |  |  ├── datamapper.ts
|  |  |  ├── model.ts
|  |  |  ├── router.ts
|  |  |  ├── schema.ts
|  |  |  └── Types.ts
|  |  └── user
|  |     ├── controller.ts
|  |     ├── datamapper.ts
|  |     ├── model.ts
|  |     ├── router.ts
|  |     ├── schema.ts
|  |     └── Types.ts
|  ├── index.ts
|  ├── middlewares
|     ├── dataMailerTypes.ts
|     ├── express
|     |  └── index.d.ts
|     └── userTypes.ts
├── scripts
|  ├── create.sh
|  └── delete.sh
├── Makefile
├── package.json
├── README.md
├── restClient.http
├── tsconfig.json

Makefile Usage

Use for domains

make create_domain
make delete_domain

Use of Yumecho (database versioning)

  • Initialized a new database
make db_init
  • Add a new version
make db_add
  • Remove a version
make db_remove
  • Deploy a version
make db_deploy
  • Revert the action of a specific version
make db_revert
  • Check if the version is well deployed
make db_verify

Tips


Sources

architecture-api's People

Contributors

helene-nguyen avatar

Stargazers

Vincent TRAHIN avatar Francois GRUNERT avatar

Watchers

 avatar

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.