System requirements
Backend requirements
- Python: 3.8 or higher
- Operating System: Linux, macOS, or Windows
- Memory: Minimum 512MB RAM
- Storage: 100MB for application and database
Frontend requirements
- Node.js: 18.0 or higher
- npm: 9.0 or higher (or yarn/pnpm equivalent)
- Modern web browser: Chrome, Firefox, Safari, or Edge
Installation methods
- Development
- Production
Development installation
This setup is ideal for local development and testing.Step 1: Clone the repository
Step 2: Backend setup
Install dependencies
- Flask 3.1.1 - Web framework
- SQLAlchemy 2.0.41 - ORM for database operations
- Flask-CORS 6.0.0 - Cross-origin resource sharing
- Flask-JWT-Extended 4.7.1 - JWT authentication support
- bcrypt 4.3.0 - Password hashing
- python-dotenv 1.1.1 - Environment variable management
Database initialization
The database is automatically created when you first run the application:This will:
- Create the SQLite database file
inventory.db - Generate all required tables
- Seed initial roles (admin, gestor, consultor)
- Create the default admin user
The database file is created in the
backend directory by default.Step 3: Frontend setup
Install Node.js dependencies
- React 19.2.0 - UI framework
- Vite 7.3.1 - Build tool and dev server
- Tailwind CSS 4.2.1 - Utility-first CSS framework
Step 4: Verify installation
Configuration
Backend configuration
The backend is configured throughbackend/main.py and backend/Database/config.py.
Database configuration
By default, the system uses SQLite:Secret key configuration
The secret key is used for password reset tokens. In production, set this via environment variable:CORS configuration
CORS is configured inmain.py:31:
Frontend configuration
The frontend uses Vite for building and development. Configuration is infrontend/vite.config.js.
API endpoint configuration
Update the API base URL in your API client configuration to point to your backend:Database management
Automatic initialization
On first run, the application automatically:- Creates all database tables
- Seeds three predefined roles:
- admin - Full system access
- gestor - Inventory management access
- consultor - Read-only access
- Creates the default admin user
Manual database operations
The database schema is defined using SQLAlchemy models. Tables are created automatically via:backend/main.py:27 on application startup.
Database migrations
For schema changes, you can use thealter_db.py script:
Resetting the database
To start fresh with a clean database:Initial user setup
The system automatically creates a default admin user:- Username: admin
- Email: [email protected]
- Password: Admin1234!
- Role: admin
User/Domain/user_service.py.
To create additional users:
- Log in as admin
- Navigate to Users in the sidebar
- Click Create User
- Assign appropriate role (admin, gestor, or consultor)
Running the application
Development mode
Production mode
Logging
The application includes comprehensive logging:- Location:
backend/logs/ - Format: Structured JSON logs with timestamps
- Levels: DEBUG, INFO, WARNING, ERROR
- API requests and responses
- Authentication attempts
- Database operations
- Error traces
Security considerations
Password hashing
Passwords are hashed using bcrypt with automatic salt generation
Role-based access
All endpoints are protected with role-based middleware
Audit logging
All system actions are logged for compliance
CORS protection
Configure allowed origins to prevent unauthorized access
Hardening checklist
- Change default admin password
- Set strong
SECRET_KEYvia environment variable - Configure restrictive CORS origins
- Use HTTPS in production
- Enable rate limiting on API endpoints
- Regular database backups
- Keep dependencies updated
- Review audit logs regularly
Troubleshooting
Common issues
Import errors when starting backend
Import errors when starting backend
Ensure virtual environment is activated and dependencies are installed:
Database locked errors
Database locked errors
SQLite has limitations with concurrent writes. For high-traffic environments, migrate to PostgreSQL or MySQL.
CORS errors in browser console
CORS errors in browser console
Verify the backend CORS configuration includes your frontend URL:
Port already in use
Port already in use
Change the port in
main.py or kill the process using the port:Frontend build fails
Frontend build fails
Clear node_modules and reinstall:
Health checks
The system provides health check endpoints for monitoring:Next steps
Quickstart Guide
Get started with the basics
API Documentation
Explore available endpoints
User Management
Set up roles and permissions
Deployment Guide
Deploy to production
For questions or issues, consult the application logs in
backend/logs/ or review the source code documentation.