Skip to main content

Prerequisites

Before you begin, ensure you have the following installed on your system:

Java 8+

JDK 8 or higher required

Maven 3.x

For dependency management

MySQL 8.0+

Database server running
You’ll also need Git to clone the repository.

Quick Installation

1

Clone the Repository

Clone the EduTec Backend repository to your local machine:
2

Set Up MySQL Database

Create a new MySQL database for the application:
Make sure to replace your_password with a secure password of your choice.
3

Configure Database Connection

Update the src/main/resources/application.properties file with your database credentials:
4

Install Dependencies

Use Maven to download all required dependencies:
The Maven wrapper (./mvnw) is included in the project and doesn’t require Maven to be installed globally.
5

Run the Application

Start the Spring Boot application:
The application will start on http://localhost:8080You should see output similar to:

Verify Installation

Once the application is running, verify that everything is working correctly.

Check Application Health

Test the application by making a request to the login endpoint:
Since this is a development build without full authentication validation, the endpoint will generate a JWT token for any username provided.

Expected Response

You should receive a JWT token response:
This token is valid for 10 hours and can be used for authenticated requests (once authentication middleware is implemented).

Understanding the Code

Now that you have the application running, let’s understand the key components:

Main Application Class

The entry point of the application is defined in EdutecApplication.java:
src/main/java/com/tecmilenio/edutec/EdutecApplication.java

Authentication Controller

The AuthController handles login requests at /auth/login:
src/main/java/com/tecmilenio/edutec/controller/AuthController.java

JWT Service

The JwtService generates secure JWT tokens for authenticated users:
src/main/java/com/tecmilenio/edutec/security/JwtService.java
The current JWT secret key is hardcoded for development purposes. In production, this should be moved to environment variables or a secure configuration service.

User Model

The User entity represents users in the database:
src/main/java/com/tecmilenio/edutec/model/User.java

Login Request DTO

The LoginRequest DTO handles incoming login data:
src/main/java/com/tecmilenio/edutec/dto/LoginRequest.java

Development Workflow

Running in Development Mode

Spring Boot DevTools is included in the project, enabling automatic restart when code changes:
Any changes to Java files will trigger an automatic application restart.

Database Schema Management

The application uses JPA’s ddl-auto=update setting, which automatically creates and updates database tables based on your entity classes.
For production deployments, consider using a migration tool like Flyway or Liquibase instead of automatic schema generation.

Common Issues

Ensure MySQL is running and accessible:
Check that the port 3306 is not blocked by a firewall.
Change the server port in application.properties:
Clear the Maven cache and rebuild:

Next Steps

Now that you have EduTec Backend running locally, you can:

Need Help?

If you encounter any issues, please open an issue on GitHub.