Skip to content

Commit d94fe49

Browse files
committed
initial commit
0 parents  commit d94fe49

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+6811
-0
lines changed

‎.env‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
DATABASE_URL="postgresql://postgres:123@localhost:5434/nest?schema=public"
2+
JWT_SECRET='super-secret'

‎.env.test‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
DATABASE_URL="postgresql://postgres:123@localhost:5435/nest?schema=public"
2+
JWT_SECRET='super-secret'

‎.eslintrc.js‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
module.exports = {
2+
parser: '@typescript-eslint/parser',
3+
parserOptions: {
4+
project: 'tsconfig.json',
5+
sourceType: 'module',
6+
},
7+
plugins: ['@typescript-eslint/eslint-plugin'],
8+
extends: [
9+
'plugin:@typescript-eslint/recommended',
10+
'plugin:prettier/recommended',
11+
],
12+
root: true,
13+
env: {
14+
node: true,
15+
jest: true,
16+
},
17+
ignorePatterns: ['.eslintrc.js'],
18+
rules: {
19+
'@typescript-eslint/interface-name-prefix': 'off',
20+
'@typescript-eslint/explicit-function-return-type': 'off',
21+
'@typescript-eslint/explicit-module-boundary-types': 'off',
22+
'@typescript-eslint/no-explicit-any': 'off',
23+
},
24+
};

‎.gitignore‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# compiled output
2+
/dist
3+
/node_modules
4+
5+
# Logs
6+
logs
7+
*.log
8+
npm-debug.log*
9+
pnpm-debug.log*
10+
yarn-debug.log*
11+
yarn-error.log*
12+
lerna-debug.log*
13+
14+
# OS
15+
.DS_Store
16+
17+
# Tests
18+
/coverage
19+
/.nyc_output
20+
21+
# IDEs and editors
22+
/.idea
23+
.project
24+
.classpath
25+
.c9/
26+
*.launch
27+
.settings/
28+
*.sublime-workspace
29+
30+
# IDE - VSCode
31+
.vscode/*
32+
!.vscode/settings.json
33+
!.vscode/tasks.json
34+
!.vscode/launch.json
35+
!.vscode/extensions.json

‎.prettierrc‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all",
4+
"printWidth": 50
5+
}

‎README.md‎

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<p align="center">
2+
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" /></a>
3+
</p>
4+
5+
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
6+
[circleci-url]: https://circleci.com/gh/nestjs/nest
7+
8+
<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
9+
<p align="center">
10+
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
11+
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
12+
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
13+
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
14+
<a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a>
15+
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
16+
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
17+
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
18+
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a>
19+
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
20+
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
21+
</p>
22+
<!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
23+
[![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->
24+
25+
## Description
26+
27+
[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
28+
29+
## Installation
30+
31+
```bash
32+
$ npm install
33+
```
34+
35+
## Running the app
36+
37+
```bash
38+
# development
39+
$ npm run start
40+
41+
# watch mode
42+
$ npm run start:dev
43+
44+
# production mode
45+
$ npm run start:prod
46+
```
47+
48+
## Test
49+
50+
```bash
51+
# unit tests
52+
$ npm run test
53+
54+
# e2e tests
55+
$ npm run test:e2e
56+
57+
# test coverage
58+
$ npm run test:cov
59+
```
60+
61+
## Support
62+
63+
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
64+
65+
## Stay in touch
66+
67+
- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
68+
- Website - [https://nestjs.com](https://nestjs.com/)
69+
- Twitter - [@nestframework](https://twitter.com/nestframework)
70+
71+
## License
72+
73+
Nest is [MIT licensed](LICENSE).

‎docker-compose.yml‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
version: '3.8'
2+
services:
3+
dev-db:
4+
image: postgres:13
5+
ports:
6+
- 5434:5432
7+
environment:
8+
POSTGRES_USER: postgres
9+
POSTGRES_PASSWORD: 123
10+
POSTGRES_DB: nest
11+
networks:
12+
- freecodecamp
13+
test-db:
14+
image: postgres:13
15+
ports:
16+
- 5435:5432
17+
environment:
18+
POSTGRES_USER: postgres
19+
POSTGRES_PASSWORD: 123
20+
POSTGRES_DB: nest
21+
networks:
22+
- freecodecamp
23+
networks:
24+
freecodecamp:

‎nest-cli.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"collection": "@nestjs/schematics",
3+
"sourceRoot": "src"
4+
}

‎package.json‎

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
{
2+
"name": "nestjs-api-tutorial",
3+
"version": "0.0.1",
4+
"description": "",
5+
"author": "",
6+
"private": true,
7+
"license": "UNLICENSED",
8+
"scripts": {
9+
"prisma:dev:deploy": "prisma migrate deploy",
10+
"db:dev:rm": "docker compose rm dev-db -s -f -v",
11+
"db:dev:up": "docker compose up dev-db -d",
12+
"db:dev:restart": "yarn db:dev:rm && yarn db:dev:up && sleep 1 && yarn prisma:dev:deploy",
13+
"prisma:test:deploy": "dotenv -e .env.test -- prisma migrate deploy",
14+
"db:test:rm": "docker compose rm test-db -s -f -v",
15+
"db:test:up": "docker compose up test-db -d",
16+
"db:test:restart": "yarn db:test:rm && yarn db:test:up && sleep 1 && yarn prisma:test:deploy",
17+
"prebuild": "rimraf dist",
18+
"build": "nest build",
19+
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
20+
"start": "nest start",
21+
"start:dev": "nest start --watch",
22+
"start:debug": "nest start --debug --watch",
23+
"start:prod": "node dist/main",
24+
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
25+
"test": "jest",
26+
"test:watch": "jest --watch",
27+
"test:cov": "jest --coverage",
28+
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
29+
"pretest:e2e": "yarn db:test:restart",
30+
"test:e2e": "dotenv -e .env.test -- jest --watch --no-cache --config ./test/jest-e2e.json"
31+
},
32+
"dependencies": {
33+
"@nestjs/common": "^8.0.0",
34+
"@nestjs/config": "^1.1.6",
35+
"@nestjs/core": "^8.0.0",
36+
"@nestjs/jwt": "^8.0.0",
37+
"@nestjs/passport": "^8.1.0",
38+
"@nestjs/platform-express": "^8.0.0",
39+
"@prisma/client": "^3.8.1",
40+
"argon2": "^0.28.3",
41+
"class-transformer": "^0.5.1",
42+
"class-validator": "^0.13.2",
43+
"passport": "^0.5.2",
44+
"passport-jwt": "^4.0.0",
45+
"reflect-metadata": "^0.1.13",
46+
"rimraf": "^3.0.2",
47+
"rxjs": "^7.2.0"
48+
},
49+
"devDependencies": {
50+
"@nestjs/cli": "^8.0.0",
51+
"@nestjs/schematics": "^8.0.0",
52+
"@nestjs/testing": "^8.0.0",
53+
"@types/express": "^4.17.13",
54+
"@types/jest": "27.0.2",
55+
"@types/node": "^16.0.0",
56+
"@types/passport-jwt": "^3.0.6",
57+
"@types/supertest": "^2.0.11",
58+
"@typescript-eslint/eslint-plugin": "^5.0.0",
59+
"@typescript-eslint/parser": "^5.0.0",
60+
"dotenv-cli": "^4.1.1",
61+
"eslint": "^8.0.1",
62+
"eslint-config-prettier": "^8.3.0",
63+
"eslint-plugin-prettier": "^4.0.0",
64+
"jest": "^27.2.5",
65+
"pactum": "^3.1.3",
66+
"prettier": "^2.3.2",
67+
"prisma": "^3.8.1",
68+
"source-map-support": "^0.5.20",
69+
"supertest": "^6.1.3",
70+
"ts-jest": "^27.0.3",
71+
"ts-loader": "^9.2.3",
72+
"ts-node": "^10.0.0",
73+
"tsconfig-paths": "^3.10.1",
74+
"typescript": "^4.3.5"
75+
},
76+
"jest": {
77+
"moduleFileExtensions": [
78+
"js",
79+
"json",
80+
"ts"
81+
],
82+
"rootDir": "src",
83+
"testRegex": ".*\\.spec\\.ts$",
84+
"transform": {
85+
"^.+\\.(t|j)s$": "ts-jest"
86+
},
87+
"collectCoverageFrom": [
88+
"**/*.(t|j)s"
89+
],
90+
"coverageDirectory": "../coverage",
91+
"testEnvironment": "node"
92+
}
93+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
-- CreateTable
2+
CREATE TABLE "User" (
3+
"id" SERIAL NOT NULL,
4+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
5+
"updatedAt" TIMESTAMP(3) NOT NULL,
6+
"email" TEXT NOT NULL,
7+
"hash" TEXT NOT NULL,
8+
"firstName" TEXT,
9+
"lastName" TEXT,
10+
11+
CONSTRAINT "User_pkey" PRIMARY KEY ("id")
12+
);
13+
14+
-- CreateTable
15+
CREATE TABLE "Bookmark" (
16+
"id" SERIAL NOT NULL,
17+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
18+
"updatedAt" TIMESTAMP(3) NOT NULL,
19+
"title" TEXT NOT NULL,
20+
"description" TEXT,
21+
"link" TEXT NOT NULL,
22+
23+
CONSTRAINT "Bookmark_pkey" PRIMARY KEY ("id")
24+
);

0 commit comments

Comments
 (0)