Skip to content

BartugKaan/workshop-managment-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Workshop Management Platform

A comprehensive SaaS backend solution for small and medium-sized businesses that offer workshops, courses, and training services. Built with Spring Boot 3.3 and PostgreSQL, this platform enables business owners to manage instructors, customers, courses, enrollments, and financial operations from a single, secure API.

🎯 Overview

The Workshop Management Platform provides a multi-tenant architecture where each business account has complete data isolation. Business owners can:

  • Manage Instructors - Add, update, and track instructors with their specializations
  • Manage Customers - Maintain a customer database with contact information (CRM)
  • Manage Courses - Create workshops with pricing, capacity, scheduling, and instructor assignments
  • Handle Enrollments - Register customers to courses and track payment status
  • Track Finances - Automatic income recording from paid enrollments, manual income/expense entries, and financial summaries

πŸ—οΈ Architecture

src/main/java/com/bartugcelebi/workshopmanagment/
β”œβ”€β”€ config/          # Security, CORS, OpenAPI configurations
β”œβ”€β”€ controller/      # REST API endpoints
β”œβ”€β”€ dto/             # Data Transfer Objects (Request/Response)
β”œβ”€β”€ exception/       # Global exception handling
β”œβ”€β”€ jwt/             # JWT authentication filters
β”œβ”€β”€ mapper/          # MapStruct entity-DTO mappers
β”œβ”€β”€ model/
β”‚   β”œβ”€β”€ abstracts/   # Base entity classes
β”‚   β”œβ”€β”€ entities/    # JPA entities
β”‚   └── enums/       # Enumeration types
β”œβ”€β”€ repository/      # Spring Data JPA repositories
└── service/
    β”œβ”€β”€ base/        # Base service interfaces
    β”œβ”€β”€ impl/        # Service implementations
    └── security/    # Security-related services

πŸ› οΈ Tech Stack

Category Technology
Framework Spring Boot 3.3.0
Language Java 17
Database PostgreSQL 15
Security Spring Security + JWT (jjwt 0.11.5)
ORM Spring Data JPA / Hibernate
Validation Jakarta Bean Validation
Mapping MapStruct 1.6.3
Documentation SpringDoc OpenAPI (Swagger UI)
Build Tool Maven
Containerization Docker Compose
Code Generation Lombok

πŸ“‹ Prerequisites

  • Java 17 or higher
  • Maven 3.8+
  • Docker & Docker Compose (for PostgreSQL)
  • Git

πŸš€ Getting Started

1. Clone the Repository

git clone https://github.com/your-username/workshop-managment.git
cd workshop-managment

2. Configure Environment Variables

Create a .env file in the project root:

# Database Configuration
DB_NAME=workshop_db
DB_USER=postgres
DB_PASSWORD=your_secure_password

# JWT Configuration
JWT_SECRET_KEY=your_base64_encoded_secret_key_at_least_256_bits

⚠️ Security Note: Generate a strong secret key for production. The JWT secret should be at least 256 bits (32 characters) and Base64 encoded.

3. Start PostgreSQL Database

docker-compose up -d

This will start a PostgreSQL 15 container with the configured credentials.

4. Build and Run the Application

# Build the project
./mvnw clean install

# Run the application
./mvnw spring-boot:run

The application will start on http://localhost:8080.

5. Access API Documentation

Open your browser and navigate to:

πŸ“‘ API Endpoints

Authentication

Method Endpoint Description
POST /api/v1/auth/register Register a new business account
POST /api/v1/auth/login Login and receive JWT tokens
POST /api/v1/auth/refresh Refresh access token

Instructors

Method Endpoint Description
GET /api/v1/instructors Get all instructors
GET /api/v1/instructors/paged Get instructors with pagination
GET /api/v1/instructors/{id} Get instructor by ID
POST /api/v1/instructors Create a new instructor
PUT /api/v1/instructors/{id} Update an instructor
DELETE /api/v1/instructors/{id} Delete an instructor

Customers

Method Endpoint Description
GET /api/v1/customers Get all customers
GET /api/v1/customers/paged Get customers with pagination
GET /api/v1/customers/{id} Get customer by ID
POST /api/v1/customers Create a new customer
PUT /api/v1/customers/{id} Update a customer
DELETE /api/v1/customers/{id} Delete a customer

Courses

Method Endpoint Description
GET /api/v1/courses Get all courses
GET /api/v1/courses/paged Get courses with pagination
GET /api/v1/courses/{id} Get course by ID
POST /api/v1/courses Create a new course
PUT /api/v1/courses/{id} Update a course
DELETE /api/v1/courses/{id} Delete a course

Enrollments

Method Endpoint Description
POST /api/v1/enrollments Enroll a customer in a course
PATCH /api/v1/enrollments/{id}/payment Update payment status

Financial Transactions

Method Endpoint Description
GET /api/v1/transactions Get all transactions
POST /api/v1/transactions/manual Create a manual transaction
GET /api/v1/transactions/summary Get financial summary for date range

πŸ” Authentication

The API uses JWT (JSON Web Tokens) for authentication. After registering or logging in, you'll receive:

  • Access Token: Short-lived token for API requests
  • Refresh Token: Long-lived token to obtain new access tokens

Using the Token

Include the access token in the Authorization header:

Authorization: Bearer <your_access_token>

Example: Register a Business

curl -X POST http://localhost:8080/api/v1/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "businessName": "Yoga Studio",
    "email": "contact@yogastudio.com",
    "password": "SecurePass123!",
    "phoneNumber": "+1234567890",
    "address": "123 Wellness Street"
  }'

πŸ—ƒοΈ Data Model

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Business   │───────│ Instructor  β”‚       β”‚  Customer   β”‚
β”‚             β”‚       β”‚             β”‚       β”‚             β”‚
β”‚ - id        β”‚       β”‚ - id        β”‚       β”‚ - id        β”‚
β”‚ - name      β”‚       β”‚ - name      β”‚       β”‚ - name      β”‚
β”‚ - email     β”‚       β”‚ - specialty β”‚       β”‚ - email     β”‚
β”‚ - password  β”‚       β”‚ - businessIdβ”‚       β”‚ - phone     β”‚
β”‚ - phone     β”‚       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜       β”‚ - businessIdβ”‚
β”‚ - address   β”‚              β”‚              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β”‚                     β”‚
       β”‚                     β–Ό                     β”‚
       β”‚              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”              β”‚
       β”‚              β”‚   Course    β”‚              β”‚
       β”‚              β”‚             β”‚              β”‚
       └──────────────│ - id        β”‚              β”‚
                      β”‚ - title     β”‚              β”‚
                      β”‚ - price     β”‚              β”‚
                      β”‚ - capacity  β”‚              β”‚
                      β”‚ - dates     β”‚              β”‚
                      β”‚ - businessIdβ”‚              β”‚
                      β”‚ - instructorβ”‚              β”‚
                      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β”‚
                             β”‚                    β”‚
                             β–Ό                    β–Ό
                      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                      β”‚        Enrollment           β”‚
                      β”‚                             β”‚
                      β”‚ - id                        β”‚
                      β”‚ - customerId                β”‚
                      β”‚ - courseId                  β”‚
                      β”‚ - isPaid                    β”‚
                      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                    β”‚
                                    β–Ό
                      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                      β”‚   FinancialTransaction      β”‚
                      β”‚                             β”‚
                      β”‚ - id                        β”‚
                      β”‚ - amount                    β”‚
                      β”‚ - type (INCOME/EXPENSE)     β”‚
                      β”‚ - description               β”‚
                      β”‚ - transactionDate           β”‚
                      β”‚ - businessId                β”‚
                      β”‚ - enrollmentId (optional)   β”‚
                      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”’ Security Features

  • JWT-based Authentication: Stateless authentication with access and refresh tokens
  • Password Encryption: BCrypt password hashing
  • Data Isolation: Multi-tenant architecture ensures each business can only access their own data
  • CORS Configuration: Configurable cross-origin resource sharing
  • Input Validation: Request validation using Jakarta Bean Validation

πŸ“Š Financial Management

The platform automatically tracks finances:

  1. Automatic Income: When an enrollment is marked as "paid", the course fee is automatically recorded as income
  2. Manual Transactions: Record additional income (e.g., merchandise sales) or expenses (e.g., rent, utilities, supplies)
  3. Financial Summary: Get total income, total expenses, and net profit for any date range

πŸ§ͺ Testing

# Run all tests
./mvnw test

# Run with coverage report
./mvnw test jacoco:report

πŸ“ Project Structure

workshop-managment/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main/
β”‚   β”‚   β”œβ”€β”€ java/com/bartugcelebi/workshopmanagment/
β”‚   β”‚   └── resources/
β”‚   β”‚       β”œβ”€β”€ application.properties
β”‚   β”‚       β”œβ”€β”€ static/
β”‚   β”‚       └── templates/
β”‚   └── test/
β”œβ”€β”€ .env                    # Environment variables (create this)
β”œβ”€β”€ docker-compose.yml      # PostgreSQL container setup
β”œβ”€β”€ pom.xml                 # Maven dependencies
β”œβ”€β”€ mvnw                    # Maven wrapper (Unix)
β”œβ”€β”€ mvnw.cmd                # Maven wrapper (Windows)
β”œβ”€β”€ PRD.md                  # Product Requirements Document
└── TODO.md                 # Development roadmap

🚧 Roadmap

  • Unit tests for service layer (JUnit & Mockito)
  • Integration tests for controllers (MockMvc)
  • Email notifications for enrollments
  • Public course listing page
  • Calendar-based scheduling interface
  • Payment gateway integration

πŸ‘€ Author

Bartuğ Kaan Γ‡elebi


Made with ❀️ using Spring Boot

About

A comprehensive SaaS backend solution for small and medium-sized businesses that offer workshops, courses, and training services. Built with Spring Boot 3.3 and PostgreSQL

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages