Skip to main content

Sales Management System API

A powerful REST API for managing products, clients, categories, and sales orders with automatic stock tracking and data validation.

Quick Example

Get Started in Minutes

Follow these steps to set up and start using the Sales Management System API

1

Clone and Install

Clone the repository and install dependencies:
git clone https://github.com/andreguti9190/Sistema-de-gestion-de-ventas--Nodejs.git
cd Sistema-de-gestion-de-ventas--Nodejs
npm install
2

Configure Database

Set up your MySQL database connection in src/config.js:
export default {
  PORT: 3000,
  HOST_DATABASE: "localhost",
  PORT_DATABASE: 3306,
  DATABASE_NAME: "erpdb",
  PASSWORD_DATABASE: "your_password",
  USER_DATABASE: "root"
}
3

Initialize Database

Run the SQL schema to create all required tables:
mysql -u root -p < src/model/database.sql
4

Start the Server

Launch the API server in development mode:
npm run dev
Your API will be available at http://localhost:3000

Explore by Resource

Complete API documentation for all resource types

Categories

Organize products into categories with CRUD operations and validation

Products

Manage product inventory with stock tracking, pricing, and category assignment

Clients

Handle customer information with email validation and sales history

Sales

Process sales orders with automatic stock deduction and order details

Key Features

Everything you need for a robust sales management system

Automatic Stock Management

Stock quantities automatically decrease when sales are created and increase when sales are deleted

Data Validation with Zod

Comprehensive validation for all API inputs ensuring data integrity and type safety

Referential Integrity

Cascading deletes and foreign key constraints prevent orphaned records and maintain data consistency

MySQL Database

Robust relational database with optimized queries and transaction support

Documentation & Resources

Learn more about the system architecture and best practices

Database Schema

Understand the database structure and relationships between tables

Architecture

Learn about the MVC architecture and code organization

Configuration

Set up environment variables and database connections

Error Handling

Handle validation errors and constraint violations properly

Ready to Get Started?

Follow our quickstart guide to build your first sales management application

View Quickstart Guide

Build docs developers (and LLMs) love