Skip to content

Commit fa6317b

Browse files
committed
Refactor: Update to Java 8, Fix Application Service, Security Hardening
0 parents  commit fa6317b

215 files changed

Lines changed: 8998 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/mvnw text eol=lf
2+
*.cmd text eol=crlf

.github/workflows/maven.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Java CI with Maven
2+
3+
on:
4+
push:
5+
branches: [ "main", "master" ]
6+
pull_request:
7+
branches: [ "main", "master" ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up JDK 8
17+
uses: actions/setup-java@v3
18+
with:
19+
java-version: '8'
20+
distribution: 'temurin'
21+
cache: maven
22+
23+
- name: Build with Maven
24+
run: ./mvnw clean install -DskipTests
25+
26+
# Use -DskipTests initially to ensure build passes,
27+
# but ideally this should run tests too:
28+
# run: ./mvnw clean verify

.gitignore

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Compiled class file
2+
*.class
3+
4+
# Log file
5+
*.log
6+
7+
# BlueJ files
8+
*.ctxt
9+
10+
# Mobile Tools for Java (J2ME)
11+
.mtj.tmp/
12+
13+
# Package Files #
14+
*.jar
15+
*.war
16+
*.nar
17+
*.ear
18+
*.zip
19+
*.tar.gz
20+
*.rar
21+
22+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
23+
hs_err_pid*
24+
25+
# Maven
26+
target/
27+
pom.xml.tag
28+
pom.xml.releaseBackup
29+
pom.xml.versionsBackup
30+
pom.xml.next
31+
release.properties
32+
dependency-reduced-pom.xml
33+
buildNumber
34+
.mvn/timing.properties
35+
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
36+
.mvn/wrapper/maven-wrapper.jar
37+
38+
# IDEs and Editors
39+
.idea/
40+
.vscode/
41+
*.iml
42+
.classpath
43+
.project
44+
.settings/
45+
.factorypath
46+
*.sublime-workspace
47+
*.sublime-project
48+
49+
# OS specific
50+
.DS_Store
51+
.DS_Store?
52+
._*
53+
.Spotlight-V100
54+
.Trashes
55+
ehthumbs.db
56+
Thumbs.db
57+
58+
# Service configurations containing secrets (careful with this one, verify if user wants to commit default configs)
59+
# Keeping strict ignore for safety, user can force add if needed
60+
**/src/main/resources/application-secret.yml
61+
**/src/main/resources/application-secret.properties
62+
*.env
63+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
wrapperVersion=3.3.2
18+
distributionType=only-script
19+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip

README.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# 💻 ZidioConnect Backend Microservices
2+
3+
This repository contains the backend source code for the ZidioConnect Job Portal, implemented as a **Spring Cloud Microservices Architecture**. All services are developed in Java, communicate via Eureka, and are secured using JWT.
4+
5+
## 🧱 Project Architecture & Technology Stack
6+
7+
The system is composed of 16 highly specialized services. All communication is routed through the central **API Gateway**.
8+
9+
### Core Technologies
10+
| Component | Technology | Role |
11+
| :--- | :--- | :--- |
12+
| **Language** | Java 8 (Spring Boot 2.7.x) | Primary development language. |
13+
| **Persistence** | MySQL / Spring Data JPA | Relational Database for all data persistence. |
14+
| **Discovery** | Eureka Server | Centralized Service Registry (Service IPs/Ports). |
15+
| **Routing** | API Gateway (8080) | Single entry point for the frontend; handles security and load balancing. |
16+
| **Configuration** | Config Server (8888) | Centralized management of configuration files (YAML/Properties). |
17+
| **Security** | JWT (JSON Web Tokens) | Stateless authentication and cross-service authorization. |
18+
19+
### Service Map
20+
| Service Name | Port | Function |
21+
| :--- | :--- | :--- |
22+
| **AUTH-SERVICE** | `8081` | Handles User Registration, Login, and JWT Token Issuance. |
23+
| **API-GATEWAY** | `8080` | External Access Point / Router. |
24+
| **CONFIG-SERVER** | `8888` | Configuration Source for all services. |
25+
| **RECRUITER-SERVICE** | `8085` | Recruiter Profile and Management (Optimized Search). |
26+
| **STUDENT-SERVICE** | `8083` | Student Profile and Management (Optimized Caching). |
27+
| **ADMIN-SERVICE** | `8090` | Admin CRUD and System Oversight. |
28+
| **SYSTEM-USER-SERVICE**| `8082` | Core User Management for Admins. |
29+
| **JOBPOST-SERVICE** | `8084` | Job Creation and Listing. |
30+
| **APPLICATION-SERVICE**| `8086` | Application Submission and Tracking. |
31+
| **ANALYTICS-SERVICE** | `8093` | Metrics and Reporting. |
32+
| **EMAIL-SERVICE** | `8094` | Asynchronous Email Sending. |
33+
| **FILEUPLOAD-SERVICE**| `8092` | Resume/File Storage. |
34+
| **(Other Services)** | `8087-8091` | Subscription, Payment, Paid-Status, Notification, Employee services. |
35+
36+
## 🛠️ Local Development Setup
37+
38+
To run the full microservice suite, services **must** be started in the correct sequence.
39+
40+
### 1. Prerequisites Check
41+
* **Java 8** and **Maven** installed.
42+
* **MySQL Server** running with the correct database schema created (e.g., `authdb`, `recruiterdb`, etc.).
43+
* **Internet connection** (to fetch configurations from the Config Server's Git Repo).
44+
45+
### 2. Startup Sequence (The Golden Rule)
46+
47+
Use `cd <service-name>` followed by `mvn spring-boot:run` for each service.
48+
49+
1. **START INFRASTRUCTURE FIRST (Required):**
50+
* **1. Eureka Server:** Start the `eureka-server` (`:8761`).
51+
* **2. Config Server:** Start the `config-server` (`:8888`).
52+
53+
2. **START GATEWAY & AUTHENTICATION:**
54+
* **3. Auth Service:** Start the `auth-service` (`:8081`). (Issues JWTs).
55+
* **4. API Gateway:** Start the `api-gateway` (`:8080`). (Entry Point).
56+
57+
3. **START FUNCTIONAL SERVICES:**
58+
* **5. Start All Remaining Services:** (`recruiter-service`, `student-service`, `admin-service`, etc.).
59+
60+
## 🔐 Testing and Security
61+
62+
All tests must be conducted via the **API Gateway** on port **8080**.
63+
64+
1. **Authentication:** Use `POST /api/auth/register?role=ROLE_ADMIN` to get a fresh token.
65+
2. **Access:** Use the **Bearer Token** for all subsequent calls. The authorization for each service is enforced by the **`@PreAuthorize`** annotations.
66+
67+
### 🛡️ File Upload Security
68+
The **File Upload Service** has been hardened:
69+
* **Allowed Extensions**: `pdf`, `doc`, `docx`, `jpg`, `jpeg`, `png` ONLY.
70+
* **Path Sanitization**: Filenames are sanitized to prevent path traversal.
71+
* **Relative Paths**: The API returns relative filenames (e.g., `uuid_filename.pdf`) instead of improper absolute server paths.
72+
73+
---

admin-service/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM eclipse-temurin:8-jre
2+
WORKDIR /app
3+
ARG JAR_FILE=target/*.jar
4+
COPY ${JAR_FILE} app.jar
5+
EXPOSE 8080
6+
ENTRYPOINT ["java","-jar","/app/app.jar"]

admin-service/pom.xml

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
6+
<modelVersion>4.0.0</modelVersion>
7+
8+
<parent>
9+
<groupId>com.zidio</groupId>
10+
<artifactId>zidioconnect</artifactId>
11+
<version>0.0.1-SNAPSHOT</version>
12+
<relativePath>..</relativePath>
13+
</parent>
14+
15+
<artifactId>admin-service</artifactId>
16+
<name>admin-service</name>
17+
<packaging>jar</packaging>
18+
19+
<properties>
20+
<java.version>1.8</java.version>
21+
<spring-cloud.version>2021.0.9</spring-cloud.version>
22+
</properties>
23+
24+
<!-- Import Spring Cloud BOM for dependency management -->
25+
<dependencyManagement>
26+
<dependencies>
27+
<dependency>
28+
<groupId>org.springframework.cloud</groupId>
29+
<artifactId>spring-cloud-dependencies</artifactId>
30+
<version>${spring-cloud.version}</version>
31+
<type>pom</type>
32+
<scope>import</scope>
33+
</dependency>
34+
</dependencies>
35+
</dependencyManagement>
36+
37+
<dependencies>
38+
<!-- Spring Web -->
39+
<dependency>
40+
<groupId>org.springframework.boot</groupId>
41+
<artifactId>spring-boot-starter-web</artifactId>
42+
</dependency>
43+
44+
<!-- JPA -->
45+
<dependency>
46+
<groupId>org.springframework.boot</groupId>
47+
<artifactId>spring-boot-starter-data-jpa</artifactId>
48+
</dependency>
49+
50+
<!-- Validation -->
51+
<dependency>
52+
<groupId>org.springframework.boot</groupId>
53+
<artifactId>spring-boot-starter-validation</artifactId>
54+
</dependency>
55+
56+
<!-- Spring Security (for admin auth) -->
57+
<dependency>
58+
<groupId>org.springframework.boot</groupId>
59+
<artifactId>spring-boot-starter-security</artifactId>
60+
</dependency>
61+
62+
<!-- Eureka Client -->
63+
<dependency>
64+
<groupId>org.springframework.cloud</groupId>
65+
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
66+
</dependency>
67+
68+
<!-- Databases -->
69+
<dependency>
70+
<groupId>com.h2database</groupId>
71+
<artifactId>h2</artifactId>
72+
<scope>runtime</scope>
73+
</dependency>
74+
75+
<dependency>
76+
<groupId>com.mysql</groupId>
77+
<artifactId>mysql-connector-j</artifactId>
78+
<version>8.0.33</version>
79+
<scope>runtime</scope>
80+
</dependency>
81+
82+
<!-- Actuator -->
83+
<dependency>
84+
<groupId>org.springframework.boot</groupId>
85+
<artifactId>spring-boot-starter-actuator</artifactId>
86+
</dependency>
87+
88+
<!-- Devtools (only for local development) -->
89+
<dependency>
90+
<groupId>org.springframework.boot</groupId>
91+
<artifactId>spring-boot-devtools</artifactId>
92+
<scope>runtime</scope>
93+
<optional>true</optional>
94+
</dependency>
95+
96+
<!-- Tests -->
97+
<dependency>
98+
<groupId>org.springframework.boot</groupId>
99+
<artifactId>spring-boot-starter-test</artifactId>
100+
<scope>test</scope>
101+
<exclusions>
102+
<exclusion>
103+
<groupId>org.junit.vintage</groupId>
104+
<artifactId>junit-vintage-engine</artifactId>
105+
</exclusion>
106+
</exclusions>
107+
</dependency>
108+
109+
<!-- Swagger/OpenAPI -->
110+
<dependency>
111+
<groupId>org.springdoc</groupId>
112+
<artifactId>springdoc-openapi-ui</artifactId>
113+
<version>1.7.0</version>
114+
</dependency>
115+
116+
</dependencies>
117+
118+
<build>
119+
<plugins>
120+
<!-- Java Compiler -->
121+
<plugin>
122+
<groupId>org.apache.maven.plugins</groupId>
123+
<artifactId>maven-compiler-plugin</artifactId>
124+
<configuration>
125+
<source>1.8</source>
126+
<target>1.8</target>
127+
</configuration>
128+
</plugin>
129+
130+
<!-- Spring Boot Plugin -->
131+
<plugin>
132+
<groupId>org.springframework.boot</groupId>
133+
<artifactId>spring-boot-maven-plugin</artifactId>
134+
<configuration>
135+
<fork>true</fork>
136+
</configuration>
137+
</plugin>
138+
</plugins>
139+
</build>
140+
</project>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.zidio.admin;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
6+
@SpringBootApplication
7+
public class AdminServiceApplication {
8+
public static void main(String[] args) {
9+
SpringApplication.run(AdminServiceApplication.class, args);
10+
}
11+
}

0 commit comments

Comments
 (0)