-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from aquariophilie/feature/initial-release-of-t…
…he-boilerplate#1 Feature/initial release of the boilerplate#1
- Loading branch information
Showing
42 changed files
with
10,295 additions
and
1,529 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
npm-debug.log | ||
.git | ||
.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root = true | ||
|
||
[*.ts] | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Node environment | ||
NODE_ENV=development | ||
|
||
# JSON web token (JWT) secret: this keeps our apps user authentication secure | ||
# JWT configurations, no secret used | ||
JWT_ALGO=ES256 | ||
JWT_EXP=5m | ||
JWT_PRIVATE=./private.pem | ||
JWT_PUBLIC=./public.pem | ||
JWT_REFRESH_EXP=30d | ||
|
||
# Mongo DB | ||
# Local development | ||
MONGODB_NAME= | ||
MONGODB_PASS= | ||
MONGODB_URI= | ||
MONGODB_USER= | ||
|
||
# Port | ||
PORT=4000 | ||
|
||
# Debug | ||
LOG_LEVEL=debug | ||
|
||
# EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
{ | ||
"ignorePatterns": [ | ||
"**/*.json" | ||
], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"airbnb" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"settings": { | ||
"react": { | ||
"version": "latest" | ||
} | ||
}, | ||
"rules": { | ||
"indent": [ | ||
"error", | ||
4 | ||
], | ||
"import/no-unresolved": "off", | ||
"@typescript-eslint/indent": [ | ||
"error", | ||
4 | ||
], | ||
"quotes": [ | ||
2, | ||
"single", | ||
{ | ||
"avoidEscape": true | ||
} | ||
], | ||
"@typescript-eslint/no-unused-vars": "error", | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"max-len": [ | ||
2, | ||
160, | ||
4, | ||
{ | ||
"ignoreUrls": true | ||
} | ||
], | ||
"lines-between-class-members": "off", | ||
"prefer-object-spread": "off", | ||
"padded-blocks": "off", | ||
"import/extensions": "off", | ||
"import/prefer-default-export": "off", | ||
"object-curly-newline": [ | ||
"error", | ||
{ | ||
"ObjectExpression": { | ||
"multiline": true, | ||
"minProperties": 2 | ||
}, | ||
"ObjectPattern": { | ||
"multiline": true | ||
}, | ||
"ImportDeclaration": "never", | ||
"ExportDeclaration": { | ||
"multiline": true, | ||
"minProperties": 3 | ||
} | ||
} | ||
], | ||
"no-useless-constructor": "off", | ||
"no-empty-function": [ | ||
"error", | ||
{ | ||
"allow": [ | ||
"functions", | ||
"constructors" | ||
] | ||
} | ||
], | ||
"class-methods-use-this": "off", | ||
"no-underscore-dangle": [ | ||
"error", | ||
{ | ||
"allow": [ | ||
"_id" | ||
] | ||
} | ||
], | ||
"no-param-reassign": [ | ||
"error", | ||
{ | ||
"props": false | ||
} | ||
], | ||
"@typescript-eslint/no-var-requires": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
engine-strict=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM node:16 | ||
|
||
# Create app directory | ||
WORKDIR /usr/src/app | ||
|
||
# Install app dependencies | ||
# A wildcard is used to ensure both package.json AND package-lock.json are copied | ||
# where available (npm@5+) | ||
COPY package*.json ./ | ||
|
||
RUN npm install | ||
# If you are building your code for production | ||
# RUN npm ci --only=production | ||
|
||
# Bundle app source | ||
COPY . . | ||
|
||
EXPOSE 4000 | ||
CMD [ "npm" , "run", "start:prod" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// In this file you can configure migrate-mongo | ||
require('dotenv').config(); | ||
|
||
// Set the NODE_ENV to 'development' by default | ||
process.env.NODE_ENV = process.env.NODE_ENV || 'development'; | ||
|
||
const config = { | ||
mongodb: { | ||
// TODO Change (or review) the url to your MongoDB: | ||
url: process.env.MONGODB_URI || 'mongodb://localhost:27017', | ||
|
||
// TODO Change this to your database name: | ||
databaseName: process.env.MONGODB_NAME || '', | ||
|
||
options: { | ||
useNewUrlParser: true, // removes a deprecation warning when connecting | ||
useUnifiedTopology: true, // removes a deprecating warning when connecting | ||
// connectTimeoutMS: 3600000, // increase connection timeout to 1 hour | ||
// socketTimeoutMS: 3600000, // increase socket timeout to 1 hour | ||
auth: { | ||
username: process.env.MONGODB_USER || '', | ||
password: process.env.MONGODB_PASS || '', | ||
}, | ||
}, | ||
}, | ||
|
||
// The migrations dir, can be an relative or absolute path. Only edit this when really necessary. | ||
migrationsDir: 'migrations', | ||
|
||
// The mongodb collection where the applied changes are stored. Only edit this when really necessary. | ||
changelogCollectionName: 'changelog', | ||
|
||
// The file extension to create migrations and search for in migration dir | ||
migrationFileExtension: '.js', | ||
|
||
// Enable the algorithm to create a checksum of the file contents and use that in the comparison to determin | ||
// if the file should be run. Requires that scripts are coded to be run multiple times. | ||
useFileHash: false, | ||
}; | ||
|
||
// Return the config as a promise | ||
module.exports = config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module.exports = { | ||
async up(db) { | ||
// TODO write your migration here. | ||
await db.createCollection('users'); | ||
await db.collection('users').createIndex({ email: 1 }); | ||
await db.collection('users').createIndex({ role: 1 }); | ||
|
||
await db.createCollection('refreshTokens'); | ||
await db.collection('refreshTokens').createIndex({ userId: 1 }); | ||
await db.collection('refreshTokens').createIndex({ expires: 1 }); | ||
|
||
}, | ||
|
||
async down(db) { | ||
await db.dropCollection('users'); | ||
await db.dropCollection('refreshTokens'); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"watch": [ | ||
"src" | ||
], | ||
"ext": "ts,json", | ||
"ignore": [ | ||
"src/**/*.spec.ts" | ||
], | ||
"exec": "tsc && node dist/app.js" | ||
} |
Oops, something went wrong.