DEV Community

Cover image for Building a Secure Employee Management System Using Ballerina, PostgreSQL, Docker, and React
Adithya
Adithya

Posted on

Building a Secure Employee Management System Using Ballerina, PostgreSQL, Docker, and React

Introduction

Building software is not only about writing code. It is about understanding how different technologies work together to solve real-world problems.

As a Software Engineering student, I wanted to create a project that goes beyond a basic CRUD application. My goal was to build an enterprise-style system with proper backend architecture, database integration, security, and deployment practices.

For this reason, I developed an Employee Management System using Ballerina as the backend technology, together with React, PostgreSQL, and Docker.

This project helped me explore:

  • REST API development
  • Database integration
  • User authentication
  • Role-based authorization
  • Containerized deployment
  • Modern integration concepts using Ballerina

Project Overview

The Employee Management System is a web-based application designed to manage employee information securely.

The system supports two types of users:

Administrator

Administrators can:

  • Register users
  • Add employees
  • Update employee details
  • Delete employees
  • View employee records

Normal Users

Normal users can:

  • Login to the system
  • View employee information

The project was designed with a simple but practical enterprise architecture.


Why I Selected Ballerina for Backend Development

While exploring backend technologies, I wanted to learn a language that focuses not only on application logic but also on communication and integrations.

Ballerina is a cloud-native programming language developed by WSO2 that is designed for building integration-focused applications.

Some reasons I selected Ballerina:

  • Simple REST API development
  • Built-in support for network communication
  • Strong type system
  • Clean service-oriented programming model
  • Database connectivity support
  • Suitable for enterprise integration scenarios

Learning Ballerina gave me a different perspective on backend development because APIs and integrations are treated as important parts of the language itself.


System Architecture

The application follows this architecture:

                React Frontend
                      |
                      |
                      ↓
              Ballerina REST API
                      |
        -----------------------------
        |                           |
        ↓                           ↓
 PostgreSQL Database          Authentication
                                      |
                                      ↓
                                JWT Security
Enter fullscreen mode Exit fullscreen mode

The frontend communicates with the Ballerina backend through REST APIs.

The backend handles:

  • Business logic
  • Authentication
  • Authorization
  • Database operations

(Add your architecture diagram screenshot here)


Developing REST APIs with Ballerina

One of the most interesting parts of this project was developing REST APIs using Ballerina.

Ballerina provides a clean way to define HTTP services.

Example:

service /api on new http:Listener(5000) {

    resource function get employees()
        returns Employee[]|error {

        return getEmployees();

    }
}
Enter fullscreen mode Exit fullscreen mode

This approach makes API development readable and easy to understand.

The backend provides APIs for:

  • User registration
  • User login
  • Employee retrieval
  • Employee creation
  • Employee updating
  • Employee deletion

PostgreSQL Database Integration

The application uses PostgreSQL as the database management system.

The main database tables are:

Users Table

Stores:

  • User ID
  • Username
  • Password information
  • User role

Employees Table

Stores:

  • Employee ID
  • Employee name
  • Email
  • Department information

Ballerina's PostgreSQL connector was used to communicate between the application and the database.

This helped me understand how Ballerina can integrate with external data sources in real applications.


Authentication and Role-Based Authorization

Security was an important requirement of this project.

Instead of implementing only a basic login system, I implemented:

  • User registration
  • Login authentication
  • JWT-based authentication
  • Role-based authorization

The authentication flow:

User Login
      |
      ↓
Validate Credentials
      |
      ↓
Generate JWT Token
      |
      ↓
Access Protected APIs
Enter fullscreen mode Exit fullscreen mode

The system separates permissions based on user roles.

ADMIN

✓ Create Employee
✓ Update Employee
✓ Delete Employee
✓ View Employees


USER

✓ View Employees
Enter fullscreen mode Exit fullscreen mode

This helped me understand how enterprise applications protect sensitive operations.

(Add login API screenshot here)


Docker Containerization

To make the application easier to run and maintain, I used Docker.

The application runs with two main containers:

Employee API Container

        +

PostgreSQL Database Container
Enter fullscreen mode Exit fullscreen mode

Docker provided several benefits:

  • Consistent development environment
  • Easier setup process
  • Better portability
  • Simplified deployment

The complete application can be started using Docker Compose.

(Add Docker screenshot here)


Exploring Ballerina MCP Capabilities

As an additional learning activity, I explored Ballerina MCP capabilities.

I created a small MCP server to understand how Ballerina can support modern communication patterns and integration scenarios.

This exploration helped me understand that Ballerina can be used not only for traditional REST APIs but also for newer approaches where applications need to communicate with different tools and systems.


Challenges I Faced and Lessons Learned

During this project, I faced several challenges that improved my software engineering skills.

Learning a New Programming Language

Ballerina has its own approach to service development and integrations.

Understanding its syntax and service-oriented model required learning a different way of thinking about backend development.

Implementing Security

Adding authentication and authorization helped me understand:

  • Secure API design
  • Token-based authentication
  • Permission management

Deployment Experience

Using Docker helped me understand how applications can be packaged and run consistently across different environments.


Technologies Used

Frontend

  • React.js
  • Tailwind CSS
  • Axios

Backend

  • Ballerina
  • REST APIs
  • JWT Authentication

Database

  • PostgreSQL

DevOps

  • Docker
  • Docker Compose

Additional Technology

  • Ballerina MCP

Project Highlights

Through this project, I implemented:

✅ Secure REST API backend
✅ User registration and authentication
✅ JWT token-based security
✅ Role-based authorization
✅ PostgreSQL database integration
✅ Docker-based deployment
✅ React frontend integration
✅ Ballerina MCP exploration


Conclusion

Building this Employee Management System was a valuable learning experience that improved my understanding of backend engineering and enterprise application development.

Through this project, I learned how Ballerina can simplify API development and integration-focused application design.

This project also helped me understand how modern applications combine frontend technologies, backend services, databases, security mechanisms, and deployment tools to create complete software solutions.

I believe continuous learning and experimenting with new technologies are essential for becoming a better software engineer, and this project was an important step in my journey.


Ballerina | React | PostgreSQL | Docker | JWT | MCP

Top comments (0)