bubble-detector/
├── backend/
│ ├── main.py # FastAPI app (entry point)
│ ├── requirements.txt # Dependencies
│ └── Dockerfile # Container config
│
├── frontend/
│ └── index.html # UI simples
│
├── docker-compose.yml # Orquestração
├── setup.sh # Gera estrutura
├── start.sh # Inicia sistema
├── stop.sh # Para sistema
└── README.md # Docs
Opcional (expansão futura):
├── backend/
│ ├── fetchers.py # Data collection
│ ├── calculators.py # Metrics logic
│ ├── models.py # DB models
│ └── tasks.py # Celery jobs
└── docker/
├── postgres/
└── redis/
1. USER → Frontend (localhost:3000)
2. Frontend → API (localhost:8000/api/analyze)
3. API → Data Fetchers (CoinGecko, GitHub, Reddit, PyPI)
4. Fetchers → Calculator (6 metrics)
5. Calculator → Bubble Index
6. API → Cache (Redis) [opcional]
7. API → Database (PostgreSQL) [opcional]
8. API → Frontend (JSON response)
Busca dados de:
- PyPI: Downloads de pacotes
- GitHub: Stars, forks, commits
- Reddit: Sentiment, engagement
- HuggingFace: Model downloads
- CoinGecko: Market data
calculate_adoption() # Bass Model
calculate_hype() # Gartner Cycle
calculate_investment() # Momentum
calculate_network() # Metcalfe
calculate_feedback() # Dynamic Systems
calculate_bubble_index() # Composite
services:
api: # FastAPI (8000)
frontend: # Nginx (3000)
services:
api: # FastAPI
frontend: # Nginx
db: # PostgreSQL
redis: # Cache
worker: # Celery
beat: # Scheduler
1. Gerar estrutura
chmod +x setup.sh
./setup.sh
2. Iniciar
docker-compose up -d
3. Testar
curl http://localhost:8000/health
4. Acessar UI
open http://localhost:3000
5. Ver docs
open http://localhost:8000/docs
GET / # Status
GET /health # Health check
POST /api/analyze # Análise de bolha
curl -X POST http://localhost:8000/api/analyze \
-H "Content-Type: application/json" \
-d '{"asset": "ChatGPT"}'
{
"asset": "ChatGPT",
"bubble_index": 0.35,
"risk_level": "Moderado",
"timestamp": "2024-01-15T10:30:00"
}
| Layer | Tech | Porta | |-------|------|-------| | Frontend | HTML/JS/Tailwind | 3000 | | Backend | FastAPI/Python | 8000 | | Cache | Redis | 6379 | | DB | PostgreSQL | 5432 | | Container | Docker Compose | - |
1. Versão mínima funciona SEM PostgreSQL 2. Workers são opcionais (comentar no compose) 3. Frontend é static (pode usar React depois) 4. APIs externas são gratuitas (maioria sem key) ---
Objetivo: Funcionar comdocker-compose up -d em <5 minutos.