Skip to main content
The Tandex Electronics API is a robust Express.js-based REST API service designed to manage product catalogs, user authentication, and seamless integration with WooCommerce e-commerce platform.

Overview

This API provides a complete backend solution for managing electronic products, user accounts, and publishing products to WooCommerce stores. Built with modern technologies and security best practices, it offers a reliable foundation for e-commerce operations.

JWT Authentication

Secure authentication using JSON Web Tokens with 1-hour token expiration

MySQL Database

Reliable data persistence with MySQL connection pooling for optimal performance

WooCommerce Integration

Direct integration with WooCommerce REST API for product publishing

User Management

Complete user management with bcrypt password hashing and role-based access

Architecture

The API follows a modular architecture with clear separation of concerns:
  • Server Layer (server.js) - Express application setup with middleware configuration
  • Routes Layer (routes/setup/routes_setup.js) - Route definitions and JWT middleware
  • Controller Layer (routes/setup/servicios/cliente.js) - Business logic and database operations
  • Database Layer (routes/setup/dbconn/dbconn.js) - MySQL connection pooling and query management

Technology Stack

Core Framework

  • Express.js 4.17.1 - Fast, unopinionated web framework for Node.js
  • Node.js - JavaScript runtime environment

Authentication & Security

  • jsonwebtoken 8.5.1 - JWT token generation and verification
  • bcrypt 5.0.1 - Password hashing and comparison
  • cors - Cross-Origin Resource Sharing support

Database

  • mysql 2.18.1 - MySQL database driver with connection pooling
  • config 3.3.6 - Configuration management for different environments

E-commerce Integration

  • @woocommerce/woocommerce-rest-api 1.0.1 - Official WooCommerce REST API client

Utilities

  • morgan - HTTP request logging middleware
  • nodemon - Development server with auto-restart
  • xlsx - Excel file parsing for bulk product imports

Key Features

Product Management

  • Bulk product import from Excel files
  • CRUD operations for product catalog
  • Product metadata management (descriptions, prices, stock levels)
  • Track published products across platforms

User Management

  • Secure user registration with encrypted passwords
  • User profile updates and deletion
  • Role-based access control (user types)
  • Activity tracking via audit log (bitácora)

WooCommerce Integration

  • Publish products directly to WooCommerce stores
  • Automated product data mapping
  • Category and image management
  • Publication tracking and history

Security

  • JWT-based authentication for all secured endpoints
  • Password encryption using bcrypt
  • Token expiration (1 hour)
  • Authorization header validation
  • Protected routes with middleware

API Architecture

The API uses a two-tier routing structure:
  1. Public Routes - Accessible without authentication
    • / - Health check endpoint
    • /login - User authentication
    • /upload_file - File upload (limited access)
  2. Secured Routes - Protected by JWT middleware
    • All routes under /secured/* require valid JWT token
    • Includes product management, user operations, and WooCommerce integration

Configuration

The API uses a JSON-based configuration system with environment-specific settings stored in config/default.json:
config/default.json
{
    "app": {
        "port": 8080,
        "JWT_SECRET": "TANDEX2021ITMORELIA"
    },
    "db": {
        "host": "us-cdbr-east-04.cleardb.com",
        "db": "heroku_1a378f873641606",
        "user": "bb79c318681cf6",
        "password": "6fe80e9b"
    }
}
The configuration file contains sensitive credentials. In production, use environment variables or secure secret management solutions.

Getting Started

Ready to start using the Tandex Electronics API? Continue to the Quickstart Guide for step-by-step setup instructions, or jump to Authentication to learn how to secure your API requests.

Quickstart

Get the API up and running in minutes

Authentication

Learn how to authenticate your requests

Build docs developers (and LLMs) love