Note
This repository has been archived, since all related to it courses has ended.
Technically, W is a Java Spring.Boot application that provides REST API to manage users, posts, discussions, and votes in a Maria Database. The application exposes all its domain entities via dedicated controllers, trying to be structurally clean as much as possible.
- Initially developed as an assignment during the Web Development course at ITMO University.
- Later highly modified to serve as the backend for an iOS application created during the iOS Development course at VK Education.
- At the end this repository was created to preserve the work done during those courses, and represents a snapshot of the project at the time of latest course completion.
- Modular Architecture: Clear separation of concerns with dedicated controllers for each entity.
- Database Integration: Uses JPA/Hibernate for ORM with automatic schema updates.
- Configuration: Custom properties for JWT secrets, SHA salts, and media storage directories.
- Docker Ready: Easily deployable with Docker Compose, including MariaDB and phpMyAdmin support.
The application operates around four core entities:
-
User
- Represents forum users.
- Stores basic information such as name, login, and is admin privileges available or not.
- Maintains a collection of posts/discussions/votes authored by the user.
-
Post
- Acts as the primary discussion thread with a title and text body.
- Supports media attachments.
- Keeps track of associated discussions, votes, view counts and creation timestamp.
- Linked to the user who created it.
-
Discussion
- Serves as a reply to posts and other discussions.
- Supports nested discussions through an optional parent discussion link.
- Contains the discussion text, associated votes, and timestamps.
- Linked both to the user posting the comment and the corresponding post.
-
Vote
- Records upvotes or downvotes for posts and discussions.
- Associates each vote with a user and either a post or a discussion.
The API is fully documented using the OpenAPI specification. You can explore the endpoints and their usage details via the Swagger Generated Documentation.
The application configuration is handled in the application.properties file (see application.properties). Key configuration parameters include:
-
Database Connection:
- Uses environment variables (
MYSQL_URL,MYSQL_USER,MYSQL_PASSWORD) to configure the datasource.
- Uses environment variables (
-
Server Settings:
server.port=8090Sets the default port for the application.server.servlet.contextPathAllows customization of the API base path (for the reverse proxy connoisseurs).
-
Custom Application Properties:
config.shaSaltA salt used for SHA hashing of a users' passwords, provided via an environment variable.config.jwtSecretThe secret key for JWT authentication.config.mediaDirDirectory path for storing media files.
Important
To adjust these settings, supply the required environment variables. Do not explicitly change the values in file unless you know the risks.
The application is containerized and can be deployed using the provided docker-compose-dev.yml file as template. The setup includes:
-
Prepare your environment: Create an
.envfile with the necessary environment variables (database credentials, JWT secrets, etc.). -
Build and start the containers:
docker compose -f docker-compose-dev.yml up --build
-
Access the services:
- API:
http://localhost - phpMyAdmin:
http://localhost:8080
- API:
This project is licensed under the MIT License.
The project's name W is as a humorous nod to the name of the "X" social network.