Skip to content

samuelhm/Vento

Repository files navigation

🛒 Vento - C2C Marketplace

Marketplace Consumer-to-Consumer desarrollado con arquitectura de microservicios. Plataforma que conecta compradores y vendedores para transacciones de productos de segunda mano con geolocalización.


🎯 Características Principales

  • Autenticación segura con JWT en cookies HttpOnly + bcrypt
  • Geolocalización de usuarios y productos con PostGIS
  • Chat en tiempo real con WebSockets (Socket.IO)
  • Gestión de imágenes con conversión automática a WebP
  • API Gateway con rate limiting y headers de seguridad

🏗️ Arquitectura

┌─────────────────────────────────────────────────────────────┐
│                        Frontend                              │
│                    React + TypeScript + Vite                 │
└─────────────────────────┬───────────────────────────────────┘
                          │ HTTPS
                          ▼
┌─────────────────────────────────────────────────────────────┐
│                     Nginx Gateway                            │
│         SSL/TLS • Rate Limiting • Security Headers           │
└─────────────────────────┬───────────────────────────────────┘
                          │
                          ▼
┌─────────────────────────────────────────────────────────────┐
│                    BFF (Backend For Frontend)                │
│              Proxy Reverso • Helmet • Error Handling         │
└────┬──────────────┬──────────────┬──────────────┬───────────┘
     │              │              │              │
     ▼              ▼              ▼              ▼
┌─────────┐   ┌──────────┐   ┌─────────┐   ┌──────────┐
│  Auth   │   │ Catalog  │   │  Media  │   │   Chat   │
│  :3001  │   │  :3002   │   │  :3003  │   │  :3004   │
└────┬────┘   └────┬─────┘   └────┬────┘   └────┬─────┘
     │             │              │              │
     └─────────────┴──────┬───────┴──────────────┘
                          │
                          ▼
              ┌───────────────────────┐
              │  PostgreSQL + PostGIS │
              │    auth_db            │
              │    catalog_db         │
              │    chat_db            │
              └───────────────────────┘

🛠️ Tech Stack

Capa Tecnología
Frontend React, TypeScript, Vite
Gateway Nginx (SSL, Rate Limiting)
Backend Fastify (Node.js)
Base de Datos PostgreSQL + PostGIS
Mensajería Socket.IO (WebSockets)
Imágenes Sharp (WebP conversion)
Contenedores Docker + Docker Compose
CI/CD GitHub Actions

🚀 Quick Start

Requisitos

  • Docker & Docker Compose
  • Make

Instalación

# Clonar repositorio
git clone https://github.com/your-org/vento.git
cd vento

# Levantar todos los servicios
make build
make up

# Acceder a la aplicación
open https://localhost

Comandos Útiles

make up       # Iniciar servicios
make down     # Detener servicios
make logs     # Ver logs en tiempo real
make re       # Rebuild completo
make fclean   # Limpieza total (volumes, images)

📦 Microservicios

Servicio Puerto Responsabilidad
Auth 3001 Autenticación, usuarios, JWT
Catalog 3002 Productos, categorías, favoritos
Media 3003 Upload de imágenes, conversión WebP
Chat 3004 Mensajería en tiempo real
BFF 3000 Proxy reverso, orquestación

🔒 Seguridad

Implementaciones

  • Passwords: bcrypt con 10 rondas de salt
  • Autenticación: JWT en cookies HttpOnly + Secure + SameSite
  • SQL Injection: Prepared statements en todas las queries
  • XSS: HttpOnly cookies, Content-Type validation
  • CSRF: SameSite=Lax, headers de seguridad
  • DDoS: Rate limiting 500 req/min por IP
  • Headers: HSTS, X-Frame-Options, X-Content-Type-Options

Capas de Protección

Nginx → Rate Limit + Security Headers
  ↓
BFF → Helmet + Error Handler
  ↓
Services → JWT Verify + Schema Validation + Prepared Statements

👥 Metodología de Trabajo

Scrum

  • Sprints: 2 semanas
  • Daily Standups: 15 minutos
  • Sprint Planning y Retrospectivas
  • Product Backlog en GitHub Projects

CI/CD Pipeline

# .github/workflows/ci.yml
- Lint (ESLint)
- Commit format (Commitlint)
- Build Docker images
- Run tests

Git Flow

Branch Propósito
main Producción estable
develop Integración
feature/* Nuevas funcionalidades
fix/* Corrección de bugs

Conventional Commits

feat: add user registration endpoint
fix: resolve login validation bug
docs: update API documentation
refactor: simplify auth middleware

📁 Estructura del Proyecto

vento/
├── docker-compose.yml      # Orquestación de servicios
├── Makefile                # Comandos de desarrollo
├── .github/                # CI/CD workflows
├── infra/
│   ├── nginx/              # Gateway configuration
│   └── postgres/           # Database initialization
└── services/
    ├── auth/               # Authentication service
    ├── bff/                # Backend for Frontend
    ├── catalog/            # Product listings
    ├── chat/               # Real-time messaging
    ├── media/              # Image processing
    └── frontend/           # React application

🧪 Testing

# Test de endpoints Auth
curl -X POST https://localhost/api/auth/signup \
  -H "Content-Type: application/json" \
  -d '{"email":"test@test.com","password":"12345678","name":"Test","lastNames":"User","lat":40.4,"lng":-3.7}'

# Test de upload Media
curl -F "files=@image.jpg" https://localhost/api/media/upload

# Verificar servicios
curl https://localhost/api/media/      # Health check
curl https://localhost/api/catalog/categories  # Categorías

📄 Documentación por Servicio

Cada microservicio tiene su propio README con:

  • Endpoints disponibles
  • Medidas de seguridad implementadas
  • Guía de integración para otros servicios
  • Variables de entorno

Ver:


👨‍💻 Equipo

todo:

📝 Licencia

Este proyecto está bajo la licencia MIT. Ver LICENSE para más detalles.

About

P2P Marketplace

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors