Skip to content

Commit e9e0580

Browse files
authored
Merge pull request #2 from pedrosilvaadev/feature/dashboard-frontend
Feature/dashboard frontend
2 parents bc27ad9 + 4885b63 commit e9e0580

41 files changed

Lines changed: 7143 additions & 5 deletions

Some content is hidden

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

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
.DS_Store
33
.env
44
.vscode/
5+
/output/
56
npm-debug.log
67
yarn-error.log
7-
yarn-debug.log
8-
package-lock.json
8+
yarn-debug.log

README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,67 @@ Bot de automacao para buscar vagas no LinkedIn com foco em Brasil remoto e expor
3535
- Desenvolvimento: `npm run dev`
3636
- Hot reload: `npm run run`
3737

38+
## Painel Frontend (React + Vite + Tailwind + shadcn)
39+
40+
Foi adicionada uma interface web para visualizar as vagas do arquivo Excel gerado em `output`.
41+
42+
### Como iniciar
43+
44+
1. Gere/atualize o arquivo Excel normalmente com o scraper
45+
2. Suba a API que le o arquivo mais recente da pasta `output`:
46+
47+
```bash
48+
npm run api
49+
```
50+
51+
3. Em outro terminal, suba o frontend:
52+
53+
```bash
54+
npm run frontend:dev
55+
```
56+
57+
4. Abra no navegador:
58+
59+
```text
60+
http://localhost:5173
61+
```
62+
63+
### Scripts adicionados
64+
65+
- `npm run api`: inicia API em `http://localhost:3001`
66+
- `npm run frontend:dev`: inicia Vite em modo desenvolvimento
67+
- `npm run frontend:build`: gera build de producao do frontend
68+
- `npm run frontend:preview`: serve build do frontend localmente
69+
70+
### Endpoints da API
71+
72+
- `GET /api/health`: health check
73+
- `GET /api/jobs/files`: lista arquivos `.xlsx` encontrados em `output`
74+
- `GET /api/jobs`: retorna vagas do arquivo mais recente
75+
- `GET /api/jobs?file=nome.xlsx`: retorna vagas de um arquivo especifico
76+
77+
## Docker (servicos separados)
78+
79+
Agora o Docker foi separado em 3 servicos:
80+
81+
- `api`: backend HTTP para leitura do XLSX
82+
- `frontend`: dashboard React/Vite
83+
- `scraper`: execucao do scraping (nao sobe por padrao)
84+
85+
### Subir dashboard + API (sem scraping automatico)
86+
87+
```bash
88+
docker compose up --build
89+
```
90+
91+
### Executar scraping manualmente
92+
93+
```bash
94+
docker compose --profile scraper run --rm scraper
95+
```
96+
97+
Com isso, `docker compose up` nao dispara mais a coleta automaticamente.
98+
3899
## Fluxo de branches (obrigatorio)
39100

40101
Este repositorio usa o seguinte fluxo:

docker-compose.yml

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,43 @@
11
services:
2-
vagas-scraper:
2+
api:
33
build:
44
context: .
55
dockerfile: Dockerfile
6-
container_name: vagas-full
6+
container_name: vagas-api
7+
command: ["node", "src/server.js"]
8+
env_file:
9+
- .env
10+
environment:
11+
- PORT=3001
12+
volumes:
13+
- ./output:/app/output
14+
ports:
15+
- "3001:3001"
16+
restart: unless-stopped
17+
18+
frontend:
19+
build:
20+
context: .
21+
dockerfile: frontend/Dockerfile
22+
container_name: vagas-frontend
23+
environment:
24+
- VITE_API_PROXY_TARGET=http://api:3001
25+
ports:
26+
- "5173:5173"
27+
depends_on:
28+
- api
29+
restart: unless-stopped
30+
31+
scraper:
32+
build:
33+
context: .
34+
dockerfile: Dockerfile
35+
container_name: vagas-scraper
36+
command: ["node", "index.js"]
737
env_file:
838
- .env
939
volumes:
1040
- ./output:/app/output
1141
restart: "no"
42+
profiles:
43+
- scraper

frontend/.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

frontend/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM node:24-alpine
2+
3+
WORKDIR /app
4+
5+
COPY frontend/package*.json ./
6+
RUN npm ci
7+
8+
COPY frontend .
9+
10+
EXPOSE 5173
11+
12+
CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0", "--port", "5173"]

frontend/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# React + Vite
2+
3+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4+
5+
Currently, two official plugins are available:
6+
7+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs)
8+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/)
9+
10+
## React Compiler
11+
12+
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
13+
14+
## Expanding the ESLint configuration
15+
16+
If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.

frontend/eslint.config.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import js from '@eslint/js'
2+
import globals from 'globals'
3+
import reactHooks from 'eslint-plugin-react-hooks'
4+
import reactRefresh from 'eslint-plugin-react-refresh'
5+
import tseslint from 'typescript-eslint'
6+
import { defineConfig, globalIgnores } from 'eslint/config'
7+
8+
export default defineConfig([
9+
globalIgnores(['dist']),
10+
{
11+
files: ['**/*.{ts,tsx}'],
12+
extends: [
13+
js.configs.recommended,
14+
...tseslint.configs.recommended,
15+
reactHooks.configs.flat.recommended,
16+
reactRefresh.configs.vite,
17+
],
18+
languageOptions: {
19+
ecmaVersion: 2020,
20+
globals: globals.browser,
21+
parserOptions: {
22+
ecmaVersion: 'latest',
23+
ecmaFeatures: { jsx: true },
24+
sourceType: 'module',
25+
},
26+
},
27+
rules: {
28+
'no-unused-vars': 'off',
29+
'@typescript-eslint/no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],
30+
'react-refresh/only-export-components': 'off',
31+
},
32+
},
33+
])

frontend/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>frontend</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.jsx"></script>
12+
</body>
13+
</html>

0 commit comments

Comments
 (0)