Skip to content

DeepsanBhandari/workflow-approval-system

Repository files navigation

Workflow Approval Management System

Production-ready backend system for managing multi-level approval workflows with secure role-based access control, audit trails, and cloud deployment.


🌍 Live Production Deployment

Base URL:
https://workflow-approval-system-production.up.railway.app

Health Check:
/actuator/health


Overview

This system enables organizations to manage structured approval workflows instead of relying on emails or spreadsheets.

  • Employees submit requests
  • Managers review at Level 1
  • Admins provide final approval
  • Full audit tracking of every action
  • Strict workflow state transition validation

🏗 Architecture

  • Layered Architecture (Controller → Service → Repository)
  • DTO Pattern using MapStruct
  • Stateless JWT Authentication
  • PostgreSQL relational database
  • Dockerized container setup
  • Cloud deployment via Railway

Core Features

  • Role-Based Access Control (ADMIN, MANAGER, EMPLOYEE)
  • Multi-level sequential approval workflow
  • Approve / Reject / Request Changes
  • Full workflow history & audit trail
  • JWT authentication & authorization
  • Global exception handling
  • Environment-based configuration
  • Docker & docker-compose support

🛠 Tech Stack

Technology Version
Java 17
Spring Boot 3.2.3
Spring Security Latest
JWT (JJWT) 0.11.5
PostgreSQL 15
Maven 3.x
Docker Latest
MapStruct 1.5.5.Final
Lombok 1.18.30

🖥 Running Locally (Manual Setup)

Prerequisites

  • Java 17
  • Maven
  • PostgreSQL running locally

Step 1 — Create Database

CREATE DATABASE workflow_db;

Default configuration:

Host: localhost
Port: 5432
Database: workflow_db
Username: postgres
Password: 1234

Step 2 — Build & Run

mvn clean install
mvn spring-boot:run

Application URL:

http://localhost:8080

Health Check:

http://localhost:8080/actuator/health

🐳 Run with Docker (Recommended)

docker-compose up --build

Stop containers:

docker-compose down

Remove database volume:

docker-compose down -v

☁ Cloud Deployment (Railway)

Deployed using Railway with managed PostgreSQL and environment-based configuration.

Required environment variables:

DATABASE_URL=
DATABASE_USERNAME=
DATABASE_PASSWORD=
JWT_SECRET=
JWT_EXPIRATION_MS=86400000
DDL_AUTO=update

🔄 API Usage Flow

Postman collection included:

WorkflowApprovalSystem.postman_collection.json

1️⃣ Register User

POST /api/auth/register

2️⃣ Login

POST /api/auth/login

Use JWT token in header:

Authorization: Bearer <TOKEN>

3️⃣ Create Workflow

POST /api/workflows

4️⃣ Submit Workflow

POST /api/workflows/{id}/submit

5️⃣ Approve / Reject / Request Changes

POST /api/workflows/{id}/approve

Supported actions:

  • APPROVE
  • REJECT
  • REQUEST_CHANGES

6️⃣ View Audit History

GET /api/workflows/{id}/history

📂 Project Structure

src/main/java/com/workflow/
 ├── config/
 ├── controller/
 ├── dto/
 ├── entity/
 ├── enums/
 ├── exception/
 ├── mapper/
 ├── repository/
 ├── security/
 └── service/

🔒 Security Implementation

  • BCrypt password hashing
  • JWT token validation filter
  • Role-based endpoint protection
  • Stateless authentication

📈 Backend Skills Demonstrated

  • Secure REST API design
  • Business rule enforcement
  • Database relationship modeling
  • Multi-level workflow logic
  • Production containerization
  • Cloud deployment configuration

📜 License

MIT License

About

Production-ready Workflow Approval Management System built with Spring Boot, featuring multi-level approvals, role-based access control, JWT authentication, audit trails, and Docker support.

Topics

Resources

Stars

Watchers

Forks

Contributors