Prerequisites
Before you begin, ensure you have the following installed:- Java 1.8 or higher
- Maven 3.6+ for dependency management
- MySQL 8.0 or higher
- Git for cloning the repository
Setup Instructions
Create MySQL Database
Create the InvestGo database in MySQL:
The application uses
spring.jpa.hibernate.ddl-auto=update, so tables will be created automatically on first run.Configure Database Connection
Update
src/main/resources/application.properties with your MySQL credentials:Install Dependencies
Use Maven to download all required dependencies:This will install:
- Spring Boot 2.7.5 (Web, JPA, Security, Validation)
- MySQL Connector
- JJWT 0.9.1 for JWT authentication
- BCrypt for password encryption
Run the Application
Start the Spring Boot application:Or run the compiled JAR:The application will start on port 8091.
Verify Startup
Check the console output for successful initialization:
On first run, InvestGo automatically seeds the database with:
- Two roles: INVERSIONISTA and ADMIN
- Default admin user with credentials
- Transaction types: Deposito and Retiro
- Supported banks (BBVA, BCP, Scotiabank, Interbank, etc.)
- Currencies: PEN (S/.) and USD ($)
- Risk levels: A, B, C with descriptions
Authentication
InvestGo uses JWT-based authentication. To access protected endpoints, you must first obtain a token.Default Admin Credentials
The application creates a default admin user on first run:The admin user has the following details:
- Name: Jeimy Apolaya Jurado
- Email: [email protected]
- Phone: 938311721
- DNI: 77454558
- Role: ADMIN (idTipoUsu: 2)
- Initial Wallet Balance: 10,000,000
Get JWT Token
Make a POST request to the authentication endpoint:Use Token in Requests
Include the token in theAuthorization header with the Bearer prefix:
Making Your First API Call
Let’s retrieve the list of active investment opportunities.List Investment Opportunities
Get Current User Details
Retrieve the authenticated user’s information:Key API Endpoints
Here are the main endpoints you’ll use:Application Architecture
InvestGo follows a layered architecture pattern:Common Issues
Database Connection Failed
Database Connection Failed
Error:
Communications link failureSolution:- Verify MySQL is running:
sudo service mysql status - Check credentials in
application.properties - Ensure database
InvestGoexists - Verify port 3306 is accessible
Port 8091 Already in Use
Port 8091 Already in Use
Error:
Port 8091 was already in useSolution:- Change the port in
application.properties:server.port=8092 - Or stop the process using port 8091:
JWT Token Expired
JWT Token Expired
Error:
401 Unauthorized or “El token ha expirado”Solution:- Generate a new token using
/generate-tokenendpoint - Tokens expire after a configured duration
Maven Build Fails
Maven Build Fails
Error: Dependency resolution errorsSolution:
Next Steps
Now that you have InvestGo running:Explore the Architecture
Learn about entities, relationships, and design patterns
API Reference
Comprehensive endpoint documentation
Development Tips:
- Enable
spring.jpa.show-sql=trueto see generated SQL queries - Use Spring DevTools for automatic restarts during development
- All dates use timezone
America/Lima- ensure consistency - CORS is configured to allow all origins (
*) - restrict in production