An open API service indexing awesome lists of open source software.

https://github.com/femcoders-sitme/sitme

SitMe is a smart backend system for managing table and meeting room reservations within companies. Built with Java 21, Spring Boot, and MySQL, it provides secure JWT authentication, role-based access, concurrency management, and admin tools for efficient reservation policies.
https://github.com/femcoders-sitme/sitme

cloudinary docker docker-compose github-actions h2-database hibernate-validator java jwt-authentication mailhog-docker maven mockito-junit-test mysql-database spring-data-jpa spring-security springboot swagger test-automation

Last synced: 8 months ago
JSON representation

SitMe is a smart backend system for managing table and meeting room reservations within companies. Built with Java 21, Spring Boot, and MySQL, it provides secure JWT authentication, role-based access, concurrency management, and admin tools for efficient reservation policies.

Awesome Lists containing this project

README

          

# SitMe - Workspace Reservation System

![Java](https://img.shields.io/badge/Java-21-orange?logo=java&logoColor=white)
![Spring Boot](https://img.shields.io/badge/Spring%20Boot-3.5.5-brightgreen?logo=springboot&logoColor=white)
![MySQL](https://img.shields.io/badge/MySQL-8.0-blue?logo=mysql&logoColor=white)
![Docker](https://img.shields.io/badge/Docker-Supported-2496ED?logo=docker&logoColor=white)
![GitHub Actions](https://img.shields.io/badge/CI-GitHub%20Actions-purple?logo=githubactions&logoColor=white)
![License](https://img.shields.io/badge/License-Educational-yellow)

**SitMe** is a Spring Boot application for managing workspace reservations, built with modern Java technologies and containerized with Docker.


## πŸ“‘ Table of Contents

- [πŸš€ Features](#-features)
- [πŸ› οΈ Tech Stack](#tech-stack)
- [πŸ“‹ Prerequisites](#-prerequisites)
- [πŸ—οΈ Project Structure](#project-structure)
- [βš™οΈ Configuration](#configuration)
- [πŸš€ Getting Started](#-getting-started)
- [πŸ§ͺ Testing](#-testing)
- [πŸ“š API Documentation](#-api-documentation)
- [πŸ”§ Key Features](#-key-features)
- [🐳 Docker Support](#-docker-support)
- [πŸ”„ CI/CD Pipeline](#-cicd-pipeline)
- [πŸ“ API Usage Examples](#-api-usage-examples)
- [🀝 Contributing](#-contributing)
- [πŸ‘©β€πŸ’» Team](#team)
- [πŸ“„ License](#-license)
- [πŸ†˜ Support](#-support)


## πŸš€ Features

- **User Management**: Registration, authentication, and profile management with JWT tokens
- **Space Management**: Create and manage different types of workspaces (rooms and tables)
- **Reservation System**: Book spaces for different time slots (morning, afternoon, full day)
- **Image Upload**: Profile and space images via Cloudinary integration
- **Email Notifications**: Automated registration confirmation emails
- **Role-based Security**: Admin and user roles with different permissions
- **RESTful API**: Comprehensive REST endpoints with Swagger documentation
- **Database Integration**: MySQL with JPA/Hibernate
- **Health Checks**: Actuator endpoints to monitor application status
- **Containerization**: Full Docker support with multi-stage builds


πŸ› οΈ Tech Stack

- **Backend**: Java 21, Spring Boot 3.5.5
- **Database**: MySQL 8.0
- **Security**: Spring Security with JWT authentication
- **Image Storage**: Cloudinary
- **Email**: Spring Mail (configured for MailHog in development)
- **Testing**: JUnit, Mockito
- **API Documentation**: Swagger/OpenAPI 3
- **Containerization**: Docker, Docker Compose
- **Build Tool**: Maven
- **CI/CD**: GitHub Actions


## πŸ“‹ Prerequisites

- Java 21
- Maven 3.9+
- Docker and Docker Compose
- MySQL 8.0 (if running locally without Docker)


πŸ—οΈ Project Structure

```
src/
β”œβ”€β”€ main/java/com/femcoders/sitme/
β”‚ β”œβ”€β”€ cloudinary/ # Image upload service
β”‚ β”œβ”€β”€ email/ # Email notifications
β”‚ β”œβ”€β”€ reservation/ # Reservation management
β”‚ β”œβ”€β”€ security/ # JWT security configuration
β”‚ β”œβ”€β”€ shared/ # Common utilities and exceptions
β”‚ β”œβ”€β”€ space/ # Workspace management
β”‚ └── user/ # User management and authentication
└── main/resources/
β”œβ”€β”€ application.properties
└── data.sql # Initial data setup
```


βš™οΈ Configuration

### Environment Variables

Create a `.env` file in the project root:

```env
# Database Configuration
DB_URL=jdbc:mysql://localhost:3306/sitme
DB_USERNAME=your_db_username
DB_PASSWORD=your_db_password

# JWT Configuration
JWT_SECRET_KEY=your_jwt_secret_key
JWT_EXPIRATION=1800000

# Server Configuration
SERVER_PORT=8080

# Cloudinary Configuration (for image uploads)
CLOUDINARY_NAME=your_cloudinary_name
CLOUDINARY_KEY=your_cloudinary_api_key
CLOUDINARY_SECRET=your_cloudinary_secret

# Docker Hub (for CI/CD)
DOCKER_USERNAME=your_docker_username
DOCKER_PASSWORD=your_docker_password
```


## πŸš€ Getting Started

### Option 1: Using Docker Compose (Recommended)

1. **Clone the repository**:
```bash
git clone
cd sitme
```

2. **Start the application**:
```bash
docker-compose up -d
```

3. **Access the application**:
- API: http://localhost:8081
- Database: localhost:3306
- Swagger Documentation: http://localhost:8081/swagger-ui.html

### Option 2: Local Development

1. **Install dependencies**:
```bash
mvn clean install
```

2. **Run the application**:
```bash
mvn spring-boot:run
```

3. **Access the application**:
- API: http://localhost:8080
- Swagger Documentation: http://localhost:8080/swagger-ui.html


## πŸ§ͺ Testing

### Run Unit Tests
```bash
mvn test
```

### Run Integration Tests with Docker
```bash
docker-compose -f docker-compose-test.yml up --abort-on-container-exit
```

The test suite includes:
- Unit tests for all service layers using Mockito
- Integration tests for REST endpoints


## πŸ“š API Documentation

### Authentication Endpoints

- `POST /api/auth/register` - User registration
- `POST /api/auth/login` - User login (returns JWT token)

### User Management

- `GET /api/users/{id}` - Get user by ID (Admin only)
- `PUT /api/users/{id}` - Update user profile (Admin only)
- `POST /api/users/{id}/image` - Upload user profile image
- `DELETE /api/users/{id}/image` - Delete user profile image

### Space Management

- `GET /api/spaces` - Get all spaces
- `GET /api/spaces/filter/type?type={TYPE}` - Filter spaces by type (ROOM/TABLE)
- `GET /api/spaces/filter/available` - Get available spaces only
- `POST /api/spaces` - Create new space (Admin only)
- `PUT /api/spaces/{id}` - Update space (Admin only)
- `DELETE /api/spaces/{id}` - Delete space (Admin only)

### Reservation Management

- `GET /api/reservations` - Get all reservations (Admin only)
- `GET /api/reservations/{id}` - Get reservation by ID (Admin only)

### Default Users

The application comes with preloaded test data:

- **Admin**: username: `admin`, password: `Password123.`
- **Test Users**: username: `debora`, `roberto`, `jenni`, etc. (password: `Password123.`)


## πŸ”§ Key Features

### Security
- JWT-based authentication
- Role-based authorization (USER/ADMIN roles)
- Password encryption with BCrypt
- CORS configuration for API access

### Observability
- Spring Boot Actuator integration for health checks and monitoring endpoints

### Image Management
- Cloudinary integration for image storage
- File validation (size and format)
- Automatic cleanup when images are deleted

### Email System
- Registration confirmation emails
- Configurable SMTP settings
- MailHog integration for development

### Database
- MySQL with JPA/Hibernate
- Automatic schema creation
- Pre-loaded test data
- Connection pooling


## 🐳 Docker Support

### Development
```bash
docker-compose up -d
```

### Testing
```bash
docker-compose -f docker-compose-test.yml up --abort-on-container-exit
```

### Production Build
The application uses multi-stage Docker builds for optimized production images.


## πŸ”„ CI/CD Pipeline

GitHub Actions workflows included:

- **Test**: Runs on pull requests
- **Build**: Builds and pushes Docker images on main branch pushes
- **Release**: Creates releases and pushes tagged images


## πŸ“ API Usage Examples

### Register a new user
```bash
curl -X POST http://localhost:8080/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"username": "maria",
"email": "maria@example.com",
"password": "SecurePass123!"
}'
```

### Login
```bash
curl -X POST http://localhost:8080/api/auth/login \
-H "Content-Type: application/json" \
-d '{
"identifier": "maria",
"password": "SecurePass123!"
}'
```

### Get all spaces
```bash
curl -X GET http://localhost:8080/api/spaces
```


## 🀝 Contributing

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests for new functionality
5. Submit a pull request


πŸ‘©β€πŸ’» Team

- **DΓ©bora Rubio** – Team Leader, Scrum Master and Developer
- **Lara Pla** – Product Owner and Developer
- **Mariia Sycheva** – Developer
- **Mayleris Echezuria** – Developer
- **Vita Poperechna** – Developer
- **Saba Ur Rehman** – Developer


## πŸ“„ License

This project is part of a learning bootcamp and is intended for educational purposes.


## πŸ†˜ Support

For questions or issues, please create an issue in the repository or contact the development team.


---

**Built with πŸ’œ using Spring Boot and modern Java technologies**