A robust REST API for ticket management system (Jira like) built with Spring Boot, Spring Security, and JWT Authentication. Features role-based access control, comprehensive user management, and complete API documentation.
- JWT-based stateless authentication
- Role-based access control (ADMIN/DEVELOPER)
- Password encryption with BCrypt
- Token expiration management
- Secure endpoints with Spring Security
- User registration and authentication
- Role-based permissions (ADMIN can manage users)
- Default admin user initialization
- Password management and security
- Complete ticket lifecycle management
- User assignment and tracking
- Relationship mapping between users and tickets
- Interactive Swagger UI
- OpenAPI 3.0 specification
- Comprehensive endpoint documentation
- Built-in API testing interface
Technology | Purpose |
---|---|
Java 17+ | Core programming language |
Spring Boot 3.x | Application framework |
Spring Security | Authentication & authorization |
Spring Data JPA | Database abstraction |
PostgreSQL | Primary database |
JWT (JJWT) | Token-based authentication |
OpenAPI/Swagger | API documentation |
Maven | Dependency management |
- Java 17 or higher
- Docker
- Maven 3.6+
- PostgreSQL 13+
- IDE (IntelliJ IDEA, Eclipse, VS Code)
git clone https://github.com/matiasalek/Jira-Clone-Java-Spring-Boot.git
cd Jira-Clone-Java-Spring-Boot
docker compose up
JWT_SECRET=
JWT_EXPIRATION=
APP_ADMIN_USERNAME=
APP_ADMIN_EMAIL=
APP_ADMIN_PASSWORD=
spring.application.name=jiraclone
spring.datasource.url=jdbc:postgresql://localhost:5432/postgres
spring.datasource.username=postgres
spring.datasource.password=postgres
spring.datasource.driver-class-name=org.postgresql.Driver
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
server.port=8080
spring.jackson.deserialization.read-enums-using-to-string=true
spring.jackson.serialization.write-enums-using-to-string=true
# JWT Configuration
jwt.secret=${JWT_SECRET}
jwt.expiration=${JWT_EXPIRATION}
# Default User Configuration
app.admin.username=${APP_ADMIN_USERNAME}
app.admin.email=${APP_ADMIN_EMAIL}
app.admin.password=${APP_ADMIN_PASSWORD}
mvn clean install
mvn spring-boot:run
- API Base URL:
http://localhost:8080/api
- Swagger UI:
http://localhost:8080/swagger-ui/index.html
- OpenAPI Docs:
http://localhost:8080/v3/api-docs
Method | Endpoint | Description | Access |
---|---|---|---|
POST |
/api/auth/register |
Register new user | Public |
POST |
/api/auth/login |
User login | Public |
Method | Endpoint | Description | Access |
---|---|---|---|
GET |
/api/user |
Get all users | Authenticated |
GET |
/api/user/{id} |
Get user by ID | Authenticated |
POST |
/api/user |
Create new user | Authenticated |
PUT |
/api/user/{id} |
Update user | Authenticated |
DELETE |
/api/user/{id} |
Delete user | ADMIN only |
PUT |
/api/user/{id}/change-password |
Change password | Authenticated |
POST |
/api/user/{id}/assign-ticket |
Assign ticket | Authenticated |
Method | Endpoint | Description | Access |
---|---|---|---|
GET |
/api/ticket |
Get all tickets | Authenticated |
GET |
/api/ticket/{id} |
Get ticket by ID | Authenticated |
POST |
/api/ticket |
Create new ticket | Authenticated |
PUT |
/api/ticket/{id} |
Update ticket | Authenticated |
DELETE |
/api/ticket/{id} |
Delete ticket | ADMIN only |
POST /api/auth/register
{
"username": "john_doe",
"email": "john@example.com",
"password": "securePassword123"
}
POST /api/auth/login
{
"username": "john_doe",
"password": "securePassword123"
}
{
"token": "eyJhbGciOiJIUzUxMiJ9...",
"type": "Bearer",
"username": "john_doe",
"role": "DEVELOPER",
"userId": 1
}
Authorization: Bearer eyJhbGciOiJIUzUxMiJ9...
src/main/java/com/matiasalek.jiraclone/
βββ config/ # Configuration classes
β βββ SecurityConfig.java
β βββ OpenApiConfig.java
βββ controller/ # REST controllers
β βββ AuthController.java
β βββ UserController.java
β βββ TicketController.java
βββ dto/ # Data Transfer Objects
β βββ request/
β βββ response/
βββ entity/ # JPA entities
β βββ User.java
β βββ Ticket.java
βββ enums/ # ENUMs
βββ repository/ # Data access layer
βββ service/ # Business logic
βββ security/ # Security components
β βββ JwtUtil.java
β βββ JwtRequestFilter.java
β βββ CustomUserDetailsService.java
β βββ JwtAuthenticationEntryPoint.java
βββ exception/ # Exception classes
- Stateless authentication using JSON Web Tokens
- Token payload includes user ID, username, and role
- Configurable expiration time (default: 24 hours)
- Secure token validation on every request
- DEVELOPER: Default role for new registrations
- ADMIN: Can manage users and perform administrative tasks
- Hierarchical permissions with proper authorization checks
- BCrypt hashing for password storage
- Password change functionality with validation
- Interactive API testing directly from the browser
- Comprehensive endpoint documentation
- Request/response schema definitions
- Built-in JWT authentication for testing protected endpoints
- Navigate to
http://localhost:8080/swagger-ui/index.html
- Enter:
Bearer YOUR_JWT_TOKEN
- Test any endpoint directly from the interface
# Register a new user
curl -X POST http://localhost:8080/api/auth/register \
-H "Content-Type: application/json" \
-d '{"username":"testuser","email":"test@example.com","password":"password123"}'
# Login
curl -X POST http://localhost:8080/api/auth/login \
-H "Content-Type: application/json" \
-d '{"username":"testuser","password":"password123"}'
# Access protected endpoint
curl -X GET http://localhost:8080/api/user \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
- Username:
admin
- Password:
admin123
- Role:
ADMIN
π§ Contact: matias.aleksandrowicz@gmail.com
π GitHub: github.com/matiasalek
πΌ LinkedIn: linkedin.com/in/matias-aleksandrowicz