Pular para conteúdo

Primeiros Passos

Guia para configurar o ambiente de desenvolvimento local do Oraculo.

Pre-requisitos

Clone o Repositorio

git clone https://github.com/haus-software-house/oraculo.git
cd oraculo

Configure as Variaveis de Ambiente

Copie o arquivo de exemplo:

cp .env.example .env

Edite o .env conforme necessario. Os valores default funcionam para desenvolvimento local.

Suba os Servicos

docker-compose up -d

Aguarde todos os servicos iniciarem. Voce pode verificar o status com:

docker-compose ps

Verifique os Servicos

Apos a inicializacao, verifique se tudo esta funcionando:

Servico URL Esperado
Frontend http://localhost:3000 Pagina de login
Platform API http://localhost:8085/actuator/health {"status":"UP"}
Tracker API http://localhost:8282/health {"status":"healthy"}
Models API http://localhost:8000/health {"status":"healthy"}
Grafana http://localhost:3001 Dashboard
MinIO Console http://localhost:9001 Console de storage

Fluxo de Configuracao

1. Registre um usuario

curl -X POST http://localhost:8085/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Admin",
    "email": "admin@exemplo.com",
    "password": "senha123"
  }'

2. Faca login

curl -X POST http://localhost:8085/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "admin@exemplo.com",
    "password": "senha123"
  }'

Salve o token retornado para usar nas proximas requisicoes.

3. Crie um Datasource

export TOKEN="seu-jwt-token-aqui"

curl -X POST http://localhost:8085/api/datasources \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TOKEN" \
  -d '{
    "name": "Minha Landing Page",
    "url": "https://minha-lp.com",
    "type": "VSL"
  }'

Salve o id do datasource retornado.

4. Configure um Success Event

export DATASOURCE_ID="id-do-datasource"

curl -X POST http://localhost:8085/api/datasources/$DATASOURCE_ID/success-events \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TOKEN" \
  -d '{
    "name": "Clique Comprar",
    "selector": "ID",
    "selectorValue": "btn-comprar"
  }'

5. Configure uma Action (Modal)

curl -X POST http://localhost:8085/api/datasources/$DATASOURCE_ID/actions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TOKEN" \
  -d '{
    "secondsExit": 5,
    "percentageExit": 30,
    "action": "MODAL",
    "actionValue": "<div style=\"position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.5);display:flex;align-items:center;justify-content:center;z-index:9999\"><div style=\"background:white;padding:40px;border-radius:12px;max-width:500px;text-align:center\"><h2>Espere!</h2><p>Temos uma oferta especial para voce</p><button onclick=\"this.closest('div').parentElement.remove()\">Ver Oferta</button></div></div>"
  }'

6. Instale o SDK na Landing Page

Adicione o script do Tracker SDK na sua landing page:

<script src="http://localhost:8282/sdk/tracker.js"
        data-client-id="SEU_DATASOURCE_ID"
        data-api-url="http://localhost:8282">
</script>

7. Teste

Acesse a pagina de teste do Tracker para validar:

http://localhost:8282/test

Proximos Passos