236 lines
4.4 KiB
Markdown
236 lines
4.4 KiB
Markdown
# ============================================================================
|
|
# GUIA - Como Subir o ZIP em Desenvolvimento (Dev)
|
|
# ============================================================================
|
|
|
|
## 1. DESCOMPACTAR O ZIP
|
|
|
|
```bash
|
|
# No Mac/Linux:
|
|
cd ~/Documentos # ou onde voce guarda os projetos
|
|
unzip avanzato-site-v1.5.0-FINAL.zip -d avanzato-site
|
|
|
|
# No Windows (PowerShell):
|
|
Expand-Archive -Path "avanzato-site-v1.5.0-FINAL.zip" -DestinationPath "avanzato-site"
|
|
```
|
|
|
|
---
|
|
|
|
## 2. ENTRAR NA PASTA
|
|
|
|
```bash
|
|
cd avanzato-site
|
|
```
|
|
|
|
Estrutura que voce vera:
|
|
```
|
|
avanzato-site/
|
|
src/ ← Codigo fonte React
|
|
api/ ← Backend tRPC + Hono
|
|
db/ ← Schema do banco
|
|
dist/ ← Build pronto (frontend)
|
|
public/ ← Imagens, logos, favicon
|
|
package.json ← Dependencias
|
|
...
|
|
```
|
|
|
|
---
|
|
|
|
## 3. INSTALAR DEPENDENCIAS
|
|
|
|
```bash
|
|
npm install
|
|
```
|
|
|
|
Se der erro de esbuild:
|
|
```bash
|
|
npm config set allow-scripts true
|
|
npm rebuild esbuild --foreground-scripts
|
|
```
|
|
|
|
---
|
|
|
|
## 4. CONFIGURAR O BANCO DE DADOS (MySQL)
|
|
|
|
O projeto precisa de MySQL rodando. Voce tem 2 opcoes:
|
|
|
|
### OPCAO A - MySQL Local (se ja tem instalado)
|
|
|
|
```bash
|
|
# Verificar se MySQL esta rodando
|
|
mysql -u root -p
|
|
|
|
# Criar banco de dados
|
|
CREATE DATABASE avanzato CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
```
|
|
|
|
Editar o arquivo `.env`:
|
|
```bash
|
|
# Abrir .env e verificar DATABASE_URL
|
|
DATABASE_URL="mysql://root:SUA_SENHA@localhost:3306/avanzato"
|
|
```
|
|
|
|
### OPCAO B - Docker (mais facil)
|
|
|
|
```bash
|
|
# Rodar MySQL em Docker
|
|
docker run -d \
|
|
--name mysql-avanzato \
|
|
-e MYSQL_ROOT_PASSWORD=senha123 \
|
|
-e MYSQL_DATABASE=avanzato \
|
|
-p 3306:3306 \
|
|
mysql:8
|
|
|
|
# Esperar 30 segundos e verificar
|
|
docker logs mysql-avanzato
|
|
```
|
|
|
|
Editar `.env`:
|
|
```
|
|
DATABASE_URL="mysql://root:senha123@localhost:3306/avanzato"
|
|
```
|
|
|
|
### OPCAO C - Sem banco (frontend apenas)
|
|
|
|
Se quiser ver so o frontend, pule para o passo 6 e use:
|
|
```bash
|
|
npm run build
|
|
npx serve dist/
|
|
```
|
|
|
|
---
|
|
|
|
## 5. SINCRONIZAR O BANCO
|
|
|
|
```bash
|
|
npm run db:push
|
|
```
|
|
|
|
Isso cria todas as tabelas automaticamente.
|
|
|
|
Para popular com dados iniciais (formulario UEA):
|
|
```bash
|
|
npx tsx db/seed.ts
|
|
```
|
|
|
|
---
|
|
|
|
## 6. INICIAR O SERVIDOR
|
|
|
|
```bash
|
|
npm run dev
|
|
```
|
|
|
|
Acesse: **http://localhost:3000**
|
|
|
|
---
|
|
|
|
## 7. COMANDOS UTEIS
|
|
|
|
| Comando | O que faz |
|
|
|---------|-----------|
|
|
| `npm run dev` | Inicia servidor dev (porta 3000) |
|
|
| `npm run build` | Build para producao (gera dist/) |
|
|
| `npm run check` | Verifica erros de TypeScript |
|
|
| `npm run db:push` | Sincroniza schema com o banco |
|
|
| `npm start` | Inicia servidor de producao |
|
|
|
|
---
|
|
|
|
## 8. PROBLEMAS COMUNS
|
|
|
|
### "Cannot find module"
|
|
```bash
|
|
rm -rf node_modules package-lock.json
|
|
npm install
|
|
```
|
|
|
|
### "esbuild permission denied"
|
|
```bash
|
|
npm config set allow-scripts true
|
|
npm rebuild esbuild --foreground-scripts
|
|
```
|
|
|
|
### "Database connection refused"
|
|
```bash
|
|
# Verificar se MySQL esta rodando
|
|
mysql -u root -p -e "SHOW DATABASES;"
|
|
|
|
# Ou com Docker
|
|
docker ps | grep mysql
|
|
```
|
|
|
|
### Tela branca no navegador
|
|
```bash
|
|
# Verificar console do navegador (F12)
|
|
# Verificar se o backend esta rodando
|
|
curl http://localhost:3000/api/trpc/ping
|
|
```
|
|
|
|
### Porta 3000 ocupada
|
|
```bash
|
|
# Mac/Linux
|
|
lsof -ti:3000 | xargs kill -9
|
|
|
|
# Windows
|
|
netstat -ano | findstr :3000
|
|
taskkill /PID <NUMERO> /F
|
|
```
|
|
|
|
---
|
|
|
|
## 9. ESTRUTURA DAS ROTAS
|
|
|
|
```
|
|
http://localhost:3000/
|
|
/ ← Site principal (Home)
|
|
/sobre ← Sobre nos
|
|
/servicos/* ← 10 paginas de servicos
|
|
/tecnologias ← Tecnologias
|
|
/ferramentas ← 7 ferramentas gratuitas
|
|
/avaliacao ← Avaliador de TI
|
|
/cases ← Cases de sucesso
|
|
/blog ← Blog
|
|
/contato ← Contato
|
|
/area-do-cliente ← Painel admin
|
|
/formulario/:codigo ← Formulario publico
|
|
/uea-prodem-angola ← Ambiente UEA-PRODEM
|
|
/status ← Pagina de status/versao
|
|
```
|
|
|
|
---
|
|
|
|
## 10. PARA PRODUCAO
|
|
|
|
```bash
|
|
# 1. Build
|
|
npm run build
|
|
|
|
# 2. O conteudo fica em dist/
|
|
# 3. Copiar tudo de dist/ para o servidor
|
|
# 4. Configurar Nginx (ver nginx/avanzato.conf)
|
|
```
|
|
|
|
---
|
|
|
|
## RESUMO RAPIDO
|
|
|
|
```bash
|
|
# 1x - Setup inicial
|
|
cd avanzato-site
|
|
npm install
|
|
npm config set allow-scripts true
|
|
npm rebuild esbuild --foreground-scripts
|
|
|
|
# 1x - Banco (se usar MySQL)
|
|
npm run db:push
|
|
npx tsx db/seed.ts
|
|
|
|
# Sempre que quiser rodar
|
|
npm run dev
|
|
# Acesse: http://localhost:3000
|
|
```
|
|
|
|
---
|
|
|
|
Duvidas? Verifique o arquivo `.env` e confirme que DATABASE_URL esta correto.
|