Prerequisites
Before you begin, ensure you have the following installed on your system:Java 21 (JDK)
Required for running Spring Boot 3.5.6
Maven 3.9+
Build automation and dependency management
MySQL 8.0+
Primary database for portfolio data
Google Cloud Account
For Google Drive file uploads (optional)
Portfolio Hub API uses Spring Boot 3.5.6 which requires Java 21. Make sure you have the correct JDK version installed.
Installation Steps
Verify Maven Installation
Check that Maven 3.9+ is installed:Expected output:
Installing Maven
Installing Maven
Install Dependencies
Maven will automatically download all required dependencies based on the This command will:
pom.xml configuration:- Download all Spring Boot dependencies
- Compile the source code
- Run unit tests
- Package the application
The first build may take several minutes as Maven downloads all dependencies.
Set Up MySQL Database
Create the database schema that Portfolio Hub API will use:See the Database Setup guide for detailed MySQL configuration.
Configure Environment Variables
Portfolio Hub API requires several environment variables to be set. Create a
.env file or export these variables:Google Drive and SMTP configuration are optional for basic setup. See the Configuration guide for all available options.
Run the Application
Start the Portfolio Hub API using Maven:Or if you’re on Windows:The application will start on port 8080 by default. You should see output similar to:
Key Dependencies
Portfolio Hub API includes the following major dependencies:| Dependency | Version | Purpose |
|---|---|---|
| Spring Boot | 3.5.6 | Core framework |
| Spring Security | 6.x | JWT authentication |
| Spring Data JPA | 3.x | Database operations |
| MySQL Connector | Latest | MySQL database driver |
| Flyway | Latest | Database migrations |
| JWT (jjwt) | 0.12.6 | JSON Web Token handling |
| MapStruct | 1.6.3 | DTO mapping |
| Lombok | 1.18.40 | Reduce boilerplate code |
| SpringDoc | 2.8.14 | OpenAPI/Swagger documentation |
| Google Drive API | v3 | File upload integration |
Build Configuration
The project uses annotation processors for Lombok and MapStruct. These are configured in thepom.xml:
Running in Production
To build a production-ready JAR file:target/ directory:
Troubleshooting
Port 8080 already in use
Port 8080 already in use
Change the port by setting the Or add to
server.port property:application.properties:MySQL connection refused
MySQL connection refused
Verify that:
- MySQL server is running
- The database schema exists
- Environment variables are correctly set
- User has proper permissions
Flyway migration failures
Flyway migration failures
If migrations fail, check:
- Database user has CREATE/ALTER permissions
- The schema exists:
CREATE SCHEMA IF NOT EXISTS \studiostkoh.portafolio`;` - No manual table modifications have been made
Java version mismatch
Java version mismatch
Portfolio Hub API requires Java 21. If you have multiple Java versions:Set JAVA_HOME:Verify:
Next Steps
Configuration
Configure environment variables and application properties
Database Setup
Learn about the database schema and Flyway migrations
Authentication
Set up JWT authentication and create your first user
API Reference
Explore all available API endpoints