This is just a project to show a nice project structure that fits well almost any project that tries to archive a nice Clean/Hexagonal Architecture.
This is just a couple of ideas and my own opinion, feel free to customize to fet
your project needs as well as your ideas, or even use the steps below to reproduce
the scafold from scratch... Then, after know how to do, Im pretty sure that you
will never comeback to this repository... if you think that is the case, ⭐️ STAR me up! ⭐
yarn init -y
mkdit src
git init
Consider to add a .gitignore
file
yarn add typescript eslint sucrase jest ts-jest -D
yarn tsc --init
yarn add @types/node @types/jest -D
Add "include": ["**/*.*"]
and "exclude": ["node_modules", "dist"]
to tsconfig.json
,
then, add/uncomment "outDir": "./dist"
and "rootDir": "./src"
References | TypeScript | @types/...
yarn jest --init
Then, add preset: "ts-jest"
to jest.config.js
References | Jest | Jest with Typescript (ts-jest)
yarn eslint --init
yarn add -D eslint-config-standard-with-typescript
rm package-lock.json && yarn
Then, on .eslintrc.js
:
- Change
extends: 'standard-with-typescript'
- Add
project: './tsconfig.json'
toparserOptions
- Add
jest: true
toenv
If you are on a JetBrains IDE:
- On
Settings
>Code Style
>JavaScript
,- then,
Set from...
>JavaScript Standard Style
- then,
- On
Settings
>Code Style
>TypeScript
,- then,
Set from...
>JavaScript
(to copy from the step above) - on the Cog icon:
Export
>EditorConfig File
- then,
- On
Settings
, search forESLint
- check:
Automatic ESLint configuration
- check:
Run eslint --fix on save
... the ESLint magic is ready!
- check:
References | ESLint | Standard | Standard with TypeScript
Choose your weapons, they say... Both Sucrase and TS-node are like Babel but better/easier/faster/no-setup. I chose Sucrase here because Sucrase is faster, but TS-node is a more complex solution.
References | Sucrase | TS-node
yarn add awilix express apollo-server-express graphql
Then, check src folder from this repo if you need some ideas
References | Awilix | Express | Apollo Server | Apollo Server with Express | GraphQL
Also... check package.json
for some smart scripts 😉
[]: https://github.com/standard/eslint-config-standard-with-typescript#readme