Prerequisites
Before installing the Municipal Permits System, ensure you have the following installed:- Node.js (v12 or higher recommended)
- MySQL (v5.7 or higher)
- npm (comes with Node.js)
Installation Steps
Set Up the Database
Create the MySQL database and tables using the provided SQL script:Or manually execute the SQL commands:The database includes the following tables:
permisos_bebidas- Alcoholic beverage permitspermisos_eventos- Special event permitspermisos_publicidad- Advertising and propaganda permitsusuarios- System users
The complete database schema is located in
database/database.sqlInstall Dependencies
Navigate to the project directory and install required npm packages:This will install the following dependencies:
Key Dependencies
- express - Web application framework
- mysql - MySQL database driver
- bcryptjs - Password hashing
- ejs - Template engine for views
- express-session - Session management
- socket.io - Real-time bidirectional communication
- multer - File upload handling
- html-pdf - PDF generation from HTML
- phantomjs - Headless browser for PDF rendering
Create Required Directories
Create the directory structure for file uploads:These directories are used for:
temps/- Temporary file storage during uploadbebidas/- Alcoholic beverage permit documentseventos/- Event permit documentspublicidad/- Advertising permit documents
Start the Application
For development with auto-reload:For production:The server will start on port 4000 by default.
Initial Admin User
The application automatically creates a default administrator account on first startup.
src/lib/createAdmin.js with the following credentials:
- Username:
ADMIN - Password:
ADMINS - Role: Desarrollador (Developer)
Verify Installation
To verify the installation was successful:- Check the console for the message:
¡Servidor Iniciado Correctamente! - Verify database connection:
¡Base de Datos Conectada! - Log in with the default admin credentials
- Navigate to the Users section to create additional users
Troubleshooting
Database Connection Issues
If you see¡La conexión con la Base de Datos ha sido rechazada!:
- Verify MySQL is running
- Check database credentials in
src/keys.js - Ensure the database
asuntos_publicosexists
Port Already in Use
If port 4000 is already in use, modify the port insrc/index.js:17:
File Upload Errors
Ensure all required directories exist and have proper write permissions:Next Steps
Configuration
Configure server settings and environment variables
Security
Learn about security best practices