Prerequisites
Before installing Secure Link API, ensure you have the following installed:- Java 21+ (required)
- Maven 3.6+ (for building the project)
- MySQL 8.4+ (for development and production)
- Git (for cloning the repository)
Installation Steps
Clone the Repository
Clone the Secure Link API repository from GitHub:
The
main branch contains the API-only version (v1.0.0-api). For the full-stack version with Angular frontend, check out the full branch.Configure Environment Variables
Copy the example environment file and configure your settings:Edit the
.env file with your MySQL database credentials:.env
Set Up MySQL Database
You can either install MySQL locally or use Docker. For Docker, see the Docker Deployment guide.Manual MySQL Setup:
Flyway migrations will automatically create the database schema on first run.
Build the Project
Build the project using Maven:This will:
- Download all dependencies
- Compile the Java code
- Run unit tests
- Package the application as a JAR file
Run the Application
Start the application with the Or run the packaged JAR:The API will start on
dev profile:http://localhost:8080Running Tests
The project uses thetest profile with an in-memory H2 database for testing:
- Link creation and validation
- File upload functionality
- Access control and expiration logic
- Password protection
- Audit logging
- Metrics collection
Development Workflow
For active development, you can use Spring Boot DevTools for hot reloading:The application automatically creates the
/tmp/uploads/ directory for file storage. You can customize this path in the configuration.Troubleshooting
Database Connection Issues
If you encounter database connection errors:- Verify MySQL is running:
mysql -u your_username -p - Check the database exists:
SHOW DATABASES; - Verify credentials in
.envfile - Ensure the port matches your MySQL configuration
Port Already in Use
If port 8080 is already in use, change it inapplication.properties:
Flyway Migration Errors
If Flyway fails to migrate:Next Steps
- Configure the application for your environment
- Deploy with Docker for production
- Explore the API Reference
