Projeto full-stack pronto para rodar localmente.
- Node.js 18+
- npm 9+
cd .\backend
npm i
cd ..\frontend
npm i
cd ..cd backend && npm i
cd ../frontend && npm i
cd ..Crie backend/.env baseado em backend/.env.example e cole seu token da API oficial do Brawl Stars.
copy backend\.env.example backend\.env
notepad backend\.envcp backend/.env.example backend/.env
nano backend/.envNa raiz do projeto:
npm run dev:all- Frontend: http://localhost:5173
- Backend: http://localhost:4000
npm run build
cd backend
npm startAbra: http://localhost:4000
- Jogador:
#ABCDEFG(exemplo) →/player/ABCDEFG - Clube:
#XXXXXXX→/club/XXXXXXX
Se BRAWL_TOKEN estiver ausente, a UI abre normalmente com dados de demonstração, mostra um aviso “Token ausente”, e desabilita buscas reais.
frontend/React + Vite + Routerbackend/Express proxy/cache + tracking (SQLite)
GET /api/healthGET /api/player/:tagGET /api/club/:tagGET /api/battlelog/:tagGET /api/rankings/players/:country(globalpermitido)GET /api/rankings/clubs/:countryGET /api/rankings/brawlers/:country?brawlerId=16000000- Tracking:
POST /api/track/start?tag=...POST /api/track/stop?tag=...GET /api/track/history/:tag
A API oficial fornece apenas as 25 batalhas mais recentes. Este projeto salva snapshots e battle logs retornados em visitas anteriores para estender o histórico sem inventar dados.
Este repositório já inclui render.yaml.
Passos (Render):
- Crie um novo Web Service a partir do seu repositório.
- Confirme:
- Build Command:
npm install && npm run build:all - Start Command:
npm run start:all
- Build Command:
- Configure as variáveis de ambiente:
BRAWL_TOKEN= seu token da API oficial (obrigatório para modo online)- (opcional)
CACHE_TTL_SECONDS,RATE_LIMIT_MAX,TRACK_AUTOMATIC
- Deploy.
Em produção, o backend serve o build do frontend e todas as chamadas /api/* funcionam na mesma origem (sem CORS).
Este projeto foi pensado para subir como um serviço web (backend serve o build do frontend).
- Suba o repositório no GitHub (ou faça upload do ZIP e conecte).
- No Render, crie um Web Service a partir do repo.
- Configure:
- Build Command:
npm install && npm run build:all - Start Command:
npm run start:all - Runtime: Node 18+
- Build Command:
- Variáveis de ambiente (Environment):
BRAWL_TOKEN= seu token da API oficial- (opcionais)
CACHE_TTL_SECONDS,RATE_LIMIT_MAX,UPSTREAM_TIMEOUT_MS
- Se
BRAWL_TOKENnão for informado, o site abre em modo DEMO (sem travar).
Se o terminal ficar repetindo postinstall em loop, isso era causado por um script postinstall chamando npm install novamente. Nesta versão o postinstall foi removido. Faça uma instalação limpa:
# na raiz
rm -rf node_modules package-lock.json
npm installNo Windows PowerShell:
rd /s /q node_modules
del package-lock.json
npm install"# repododiabo"