Overview
Pro Stock Tool follows a classic three-tier architecture pattern separating frontend presentation, business logic, and data access layers. The project is organized into distinct directories, each serving a specific purpose in the application.Root Directory Structure
Directory Details
controllers/ - Frontend Logic
controllers/ - Frontend Logic
Contains JavaScript files that handle client-side interactions and API communication.Key Files:
bodega.js- Warehouse management controllercategorias.js- Category/subcategory managementproveedores.js- Supplier managementparametros.js- System parameters configurationheader-footer.js- Shared navigation and layoutregistro.js- User registration logic
- DOM manipulation and event handling
- API requests using Fetch API
- Client-side validation
- UI state management
- Modal and form interactions
database/ - Backend API
database/ - Backend API
PHP endpoints that handle HTTP methods (GET, POST, PUT, DELETE) and database operations.Key Files:
conexion.php- Database connection configurationbodega.php- Warehouse CRUD operationscategorias.php- Category CRUD operationssubcategorias.php- Subcategory CRUD operationsproveedores.php- Supplier CRUD operationsparametros.php- System parameters CRUDregistro.php- User registration endpoint
- RESTful API endpoints
- Database queries and transactions
- Input validation and sanitization
- JSON response formatting
- CORS header management
view/ - HTML Pages
view/ - HTML Pages
HTML templates for different sections of the application.Key Files:
index.html- Dashboard/home pagebodega.html- Warehouse management interfacecategoria.html- Category management interfaceproveedores.html- Supplier management interfaceparametros.html- System parameters interface
- Each page includes its corresponding CSS and JS files
- Uses
header-footer.jsfor consistent navigation - Follows semantic HTML5 structure
styles/ - CSS Stylesheets
styles/ - CSS Stylesheets
CSS files providing styling for each module.Key Files:
header-footer.css- Navigation and layout stylesbodega.css- Warehouse page stylescategorias.css- Category page stylesproveedores.css- Supplier page stylesparametros.css- Parameters page stylesStyle-Registro.css- Registration form stylesStyleInicio.css- Login page styles
- Component-based CSS organization
- Consistent color scheme (primary:
#2e6df6,#4a90e2) - Responsive design patterns
- Modal and card-based layouts
img/ - Image Assets
img/ - Image Assets
Static images including logos, icons, and graphics.Contents:
Pro-Stock-Sinfondo.png- Main logo (transparent background)- Product images
- UI icons and graphics
Architecture Pattern
Pro Stock Tool implements a Model-View-Controller (MVC) pattern:
- Model: PHP endpoints in
database/handle data operations - View: HTML templates in
view/and root directory - Controller: JavaScript files in
controllers/manage user interactions
Request Flow
Module Organization
Each major feature follows a consistent file naming convention:Frontend
view/{module}.htmlController
controllers/{module}.jsBackend
database/{module}.phpStyles
styles/{module}.cssview/bodega.html- User interfacecontrollers/bodega.js- Client logicdatabase/bodega.php- API endpointstyles/bodega.css- Styling
Database Connection
Thedatabase/conexion.php file serves as the central database configuration:
database/conexion.php
Path Resolution
The project uses relative paths based on file location:Best Practices
Separation of Concerns
Keep HTML, CSS, and JavaScript in separate files for maintainability
Consistent Naming
Use matching file names across layers (e.g.,
bodega.html, bodega.js, bodega.php)Modular Design
Each module is self-contained with its own view, controller, and endpoint
Shared Components
Common functionality like
header-footer.js is reused across pagesNext Steps
Coding Standards
Learn about code conventions and patterns
Troubleshooting
Common issues and solutions