Skip to content

Commit 829aff2

Browse files
committed
first commit
0 parents  commit 829aff2

28 files changed

Lines changed: 17151 additions & 0 deletions

.dockerignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.devcontainer/
2+
.git/
3+
.github/
4+
.docker/dbdata/
5+
.docker/filebeatdata/
6+
.docker/elk/
7+
.docker/rabbitmq/
8+
.docker/.gitignore
9+
.history/
10+
coverage/
11+
dist/
12+
envs/
13+
node_modules/
14+
*.sqlite
15+
docker-compose*.yaml
16+
docker-compose*.yml
17+
*.md
18+
api.http
19+
create-rsa.js
20+
generate-token.js
21+
Dockerfile
22+
Dockerfile.prod

.eslintrc.js

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

.github/workflows/ci.yaml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: ['main']
6+
tags: ['v*.*.*']
7+
pull_request:
8+
branches: ['main']
9+
10+
env:
11+
REGISTRY: docker.io
12+
IMAGE_NAME: argentinaluiz/nestjs-app
13+
DOCKER_USERNAME: argentinaluiz
14+
SHA: ${{ github.event.pull_request.head.sha || github.event.after }}
15+
16+
jobs:
17+
ci:
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: write
21+
packages: write
22+
id-token: write
23+
pull-requests: write # Permitir criar e atualizar pull requests
24+
security-events: write # Enviar eventos de segurança para o Github Security
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v4
29+
30+
- name: Set up Docker Buildx
31+
uses: docker/setup-buildx-action@v3
32+
33+
- name: Log into registry ${{ env.REGISTRY }}
34+
uses: docker/login-action@v3
35+
with:
36+
registry: ${{ env.REGISTRY }}
37+
username: ${{ env.DOCKER_USERNAME }}
38+
password: ${{ secrets.DOCKER_TOKEN }}
39+
40+
- name: Build for CI
41+
id: build-ci
42+
uses: docker/build-push-action@v5.0.0
43+
with:
44+
context: .
45+
file: ./Dockerfile.prod
46+
push: false
47+
load: true
48+
target: development
49+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:ci
50+
cache-from: type=gha
51+
cache-to: type=gha,mode=max
52+
53+
- name: Run tests
54+
run: echo "Running tests..."
55+
56+
- name: Build for analysis
57+
id: build-for-analysis
58+
uses: docker/build-push-action@v5.0.0
59+
with:
60+
context: ./
61+
file: ./Dockerfile.prod
62+
push: false
63+
load: true
64+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.SHA }}
65+
cache-from: type=gha
66+
cache-to: type=gha,mode=max
67+
68+
- name: Analyze for critical and high CVEs
69+
id: docker-scout-cves
70+
uses: docker/scout-action@v1
71+
with:
72+
command: cves
73+
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.SHA }}
74+
only-severities: critical,high
75+
only-fixed: true
76+
summary: true
77+
exit-code: true
78+
79+
- name: Analyze for all CVEs
80+
id: docker-scout-all-cves
81+
uses: docker/scout-action@v1
82+
with:
83+
command: cves
84+
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.SHA }}
85+
summary: true
86+
sarif-file: sarif.output.json
87+
88+
- name: Upload SARIF result
89+
id: upload-sarif
90+
if: ${{ github.event_name != 'pull_request' }}
91+
uses: github/codeql-action/upload-sarif@v3
92+
with:
93+
sarif_file: sarif.output.json
94+
95+
- name: Build final
96+
id: build-final
97+
if: github.event_name != 'pull_request'
98+
uses: docker/build-push-action@v5.0.0
99+
with:
100+
context: ./
101+
file: ./Dockerfile.prod
102+
push: true
103+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.SHA }}
104+
cache-from: type=gha
105+
cache-to: type=gha,mode=max
106+
provenance: mode=max
107+
sbom: true
108+
109+

.gitignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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
36+
37+
.history/

.prettierrc

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

Dockerfile.prod

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
FROM node:24.10.0-slim as development
2+
3+
USER node
4+
5+
RUN mkdir /home/node/app
6+
7+
WORKDIR /home/node/app
8+
9+
COPY --chown=node:node package*.json ./
10+
RUN npm ci
11+
12+
COPY --chown=node:node . .
13+
14+
CMD [ "tail", "-f", "/dev/null" ]
15+
16+
FROM node:24.10.0-slim as builder
17+
18+
USER node
19+
20+
RUN mkdir /home/node/app
21+
22+
WORKDIR /home/node/app
23+
24+
COPY --chown=node:node --from=development /home/node/app ./
25+
RUN npm run build
26+
27+
ENV NODE_ENV production
28+
29+
RUN npm ci --only=production
30+
31+
FROM node:24.10.0-slim as production
32+
33+
USER node
34+
35+
RUN mkdir /home/node/app
36+
37+
WORKDIR /home/node/app
38+
39+
COPY --chown=node:node --from=builder /home/node/app/dist ./dist
40+
COPY --chown=node:node --from=builder /home/node/app/node_modules ./node_modules
41+
COPY --chown=node:node --from=builder /home/node/app/package.json ./
42+
43+
EXPOSE 3000
44+
45+
ENV NODE_ENV production
46+
47+
CMD [ "npm", "run", "start:prod" ]

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
![Imersão Full Stack && Full Cycle](https://events-fullcycle.s3.amazonaws.com/events-fullcycle/static/site/img/grupo_4417.png)
2+
3+
Participe gratuitamente: https://imersao.fullcycle.com.br/
4+
5+
## Sobre o repositório
6+
Esse repositório contém o código-fonte ministrado na aula Desenvolva uma aplicação com Nest.js 9 e aproveite as novidades da nova versão: [https://www.youtube.com/watch?v=1yu9084sVjs](https://www.youtube.com/watch?v=1yu9084sVjs)
7+
8+
## Rodar a aplicação
9+
10+
Execute os comandos:
11+
12+
```bash
13+
npm install
14+
npm run start:dev
15+
```
16+
17+
Acesse http://localhost:3000/bank-accounts ou use o arquivo `api.http` para testar a API usando a extensão Rest Client do VSCode ou outra ferramenta para brincar com o HTTP.

nest-cli.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"$schema": "https://json.schemastore.org/nest-cli",
3+
"collection": "@nestjs/schematics",
4+
"sourceRoot": "src"
5+
}

0 commit comments

Comments
 (0)