Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions jdk_21_maven/cs/rest/testing-system/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
POSTGRES_URL=jdbc:postgresql://db:5432/testing_system
POSTGRES_DB=testing_system
POSTGRES_USER=root
POSTGRES_PASSWORD=root
SECRET_KEY=
SPRING_DATA_REDIS_HOST=redis
SPRING_DATA_REDIS_PORT=6379
2 changes: 2 additions & 0 deletions jdk_21_maven/cs/rest/testing-system/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/mvnw text eol=lf
*.cmd text eol=crlf
11 changes: 11 additions & 0 deletions jdk_21_maven/cs/rest/testing-system/.github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "maven"
directory: "/"
schedule:
interval: "weekly"
34 changes: 34 additions & 0 deletions jdk_21_maven/cs/rest/testing-system/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.env
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
docker/postgres_data/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
wrapperVersion=3.3.2
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
21 changes: 21 additions & 0 deletions jdk_21_maven/cs/rest/testing-system/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 Mirodil Kamilov

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
117 changes: 117 additions & 0 deletions jdk_21_maven/cs/rest/testing-system/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# Testing System

**_Note:_** 🚧 _This project is under development. Service interruptions may occur in the production environment._ 🚧

## Overview

The Testing System REST API is a backend application that manages test creation, participation, and result evaluation.
This project showcases backend development expertise using modern technologies and the **Spring Boot framework**.

## Key Features

- **User Management**: Admins control accounts and test assignments while test takers participate with automatic
progress saving.
- **Test Management**: Admins create and assign tests with multiple question types (MCQ, Checkbox, True/False, Text).
- **Results Management**: Automatic evaluation with pass/fail status and summaries.
- **Secure and Scalable**: Role-based access control with little effort to scale, encrypted password storage, and
modular design.

For a detailed breakdown of the software requirements, refer to [this document](Software%20Requirements%20Document.pdf).

## Tech Stack

- **Backend Framework**: Spring Boot 3
- **Database**: PostgreSQL
- **Persistence**: Spring Data JDBC and Spring JDBC Template
- **Caching**: Redis (for token blocklisting & autosave test progress)
- **Security**: Spring Security (Authentication & Authorization)
- **Containerization**: Docker
- **Documentation**: Swagger UI (OpenAPI)
- **Testing & Debugging**: Postman
- **Cloud Deployment**

## Diagrams

### Entity-Relationship Diagram (ERD)

The following ER diagram shows the core database structure of the Testing System:
![ER Diagram](ER_Diagram.jpg)

### API Examples

![Example responses](example_responses.png)

For exploring and testing complete API endpoints, visit
the [Swagger UI](https://testing.mirodil.dev/api/swagger-ui.html)
or [Postman collection](https://www.postman.com/mirodil-dev/workspace/testing-system) with saved
examples.

## Installation & Setup

If you'd like to simply access the API, you can use the
already [deployed application](https://testing.mirodil.dev/api/swagger-ui.html). However, if you prefer to set it
up locally, follow the steps below.

### Prerequisites

Before starting, ensure the following tools are installed on your system:

1. [**Docker**](https://docs.docker.com/get-started/get-docker/): Version 20.10 or higher

2. **Docker Compose**: Version 1.29 or higher (included with Docker Desktop)

### Steps

Clone the Testing System project from the GitHub repository:

```bash
git clone https://github.com/mirodilkamilov/testing-system.git
cd testing-system
```

Copy `.env.example` to create your `.env` file and make sure you set `SECRET_KEY` variable. It should be at least 32
character long:

```bash
cp .env.example .env
```

Use Maven to package the application as a JAR file. Skip tests during this step since containerized PostgreSQL and Redis
won't be running yet:

```bash
./mvnw clean package -DskipTests
```

Build and start the Docker containers (you can add the -d option to run in detached mode):

```docker
docker-compose up --build
```

Once the containers are running, the application will be available at http://localhost:8080. You can navigate
to http://localhost:8080/api/swagger-ui.html to view the API documentation.

To stop and remove the containers, run:

```docker
docker-compose down
```

### Frontend Integration

To allow frontend developers to integrate with the backend during local development, CORS has been configured to permit
requests from the following origins:

- http://localhost:3000
- http://127.0.0.1:3000

If you're working on a frontend application, you can make API calls to the backend without encountering CORS-related
issues. Ensure your frontend is running on one of the allowed origins above.

## Contribute

I developed this project to showcase my Java skills and web technologies. Developers interested in building a
user-friendly interface for this application are welcome to contribute. I also invite anyone who wants to enhance and
extend the existing functionality, helping this project evolve and improve.

51 changes: 51 additions & 0 deletions jdk_21_maven/cs/rest/testing-system/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
version: '3.8'

services:
app:
container_name: testing-system
build:
context: .
dockerfile: docker/Dockerfile
ports:
- "8080:8080"
env_file:
- .env
environment:
SPRING_DATASOURCE_URL: ${POSTGRES_URL}
SPRING_DATASOURCE_USERNAME: ${POSTGRES_USER}
SPRING_DATASOURCE_PASSWORD: ${POSTGRES_PASSWORD}
SECRET_KEY: ${SECRET_KEY}
SPRING_DATA_REDIS_HOST: redis
depends_on:
- db
- redis
networks:
- testing-network

db:
image: postgres:17.2
container_name: postgres
restart: always
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
networks:
- testing-network
volumes:
- ./docker/postgres_data:/var/lib/postgresql/data
- ./docker/sql:/docker-entrypoint-initdb.d

redis:
image: redis:7.4
container_name: redis
restart: always
networks:
- testing-network

networks:
testing-network:
driver: bridge

volumes:
postgres_data:
13 changes: 13 additions & 0 deletions jdk_21_maven/cs/rest/testing-system/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM eclipse-temurin:21-jdk

# Set working directory
WORKDIR /app

# First run "./mvnw clean package" locally
COPY target/testing-system-0.0.1-SNAPSHOT.jar /app/target/testing-system.jar

# Expose port
EXPOSE 8080

# Run the Spring Boot application
ENTRYPOINT ["java", "-jar", "/app/target/testing-system.jar"]
Loading
Loading