Prerequisites
Before you begin, ensure you have the following installed on your system:Java Development Kit
JDK 17 or higherRequired for running Spring Boot microservices
MySQL Database
MySQL 8.0 or higherDatabase server for all microservices
Maven Build Tool
Maven 3.6+For building Spring Boot projects
Node.js & npm
Node.js 18+ and npmRequired for Angular frontend
System Requirements: At least 8GB RAM recommended for running all services simultaneously, 4GB minimum for development.
Database Setup
Create Databases
Run the initialization script to create all required databases:Execute this script:
Infrastructure Services Setup
Start the infrastructure services in the following order:Start Config Server
The Config Server must start first as other services depend on it for configuration.The Config Server will start on port 7070 and connect to the Git repository for configuration files:Verify: Access http://localhost:7070/jea-auth-service/default to check config server is working.
Start Registry Server
The Eureka Registry Server enables service discovery.The Registry Server will start on port 8090.Verify: Access http://localhost:8090 to see the Eureka dashboard (no services registered yet).
Startup Time: Wait 30-60 seconds after starting the Registry Server before starting other services to ensure proper registration.
Microservices Setup
Now start the business logic microservices. You can start them in any order, but the recommended sequence is:Authentication Service
${PORT:${SERVERS_PORT:0}}).This service provides:/auth/login- User authentication/auth/validate- Token validation (used by gateway)/auth/create- User creation/usuario/**- User management/rol/**- Role management
Catalog Service
/categoria/**- Category management/producto/**- Product management/imagenes/**- Product images (public access)
Sales Service
/venta/**- Sales transaction processing
- Base imponible (taxable amount)
- IGV (18% VAT)
- Total amount
Purchase Service
/compra/**- Purchase order processing
- Catalog Service (products)
- Supplier Service (suppliers)
- Payment Service (payment methods)
Parallel Startup: You can start multiple services in parallel by opening multiple terminal windows. Just ensure Config Server and Registry Server are running first.
Frontend Setup
Install Dependencies
Navigate to the Angular frontend directory and install npm packages:This will install Angular 18.2 and all required dependencies including:
- Angular Material for UI components
- Chart.js for data visualization
- jsPDF for report generation
Start Development Server
Verify Installation
Check Service Registration
Open the Eureka dashboard at http://localhost:8090You should see all 8 microservices registered:
- JEA-AUTH-SERVICE
- JEA-CATALOGO-SERVICE
- JEA-CLIENTE-SERVICE
- JEA-COMPRA-SERVICE
- JEA-PAGOS-SERVICE
- JEA-PEDIDO-SERVICE
- JEA-PROVEEDOR-SERVICE
- JEA-VENTA-SERVICE
Test Authentication
Test the authentication endpoint through the gateway:Then login:You should receive a JWT token in the response.
Test Protected Endpoint
Use the JWT token to access a protected endpoint:This should return the list of categories (initially empty).
Access Frontend
Open http://localhost:4200 in your browser.You should see the Sistema de Ventas login page.
Common Issues and Solutions
Port Already in Use
Port Already in Use
If you see “Port already in use” errors:Or change the port in the service’s
application.yml file.Service Not Registering with Eureka
Service Not Registering with Eureka
Common causes:
- Registry Server not running
- Incorrect
eureka.client.serviceUrl.defaultZoneconfiguration - Network/firewall issues
Database Connection Errors
Database Connection Errors
Verify:
- MySQL is running:
sudo systemctl status mysql - Database exists:
SHOW DATABASES; - Credentials are correct in configuration files
- MySQL user has proper permissions
Gateway Returns 401 Unauthorized
Gateway Returns 401 Unauthorized
CORS Errors in Browser
CORS Errors in Browser
If you see CORS errors in the browser console:
- Verify Gateway CORS configuration allows
http://localhost:4200 - Check that you’re accessing the API through the gateway (port 8085)
- Don’t access services directly from the browser
Development Workflow
Make Code Changes
Edit your service code using your preferred IDE (IntelliJ IDEA, VS Code, Eclipse).
Restart Service
Stop the running service (Ctrl+C) and start it again:Or use Spring Boot DevTools for automatic restart on code changes.
Production Deployment
Next Steps
Explore Features
Learn about each service’s capabilities in detail
API Documentation
Explore available endpoints and request/response formats
Architecture Deep Dive
Understand the system design patterns
Security Guide
Learn about authentication, authorization, and best practices
Getting Help
If you encounter issues:- Check service logs for error messages
- Verify all prerequisites are installed correctly
- Ensure services start in the correct order
- Review the Eureka dashboard for service health
- Test each component individually before testing the full system
Pro Tip: Use a process manager like
tmux or separate terminal tabs to manage multiple services simultaneously. Consider using Docker Compose for easier multi-service management.