This project demonstrates how to design, build, and deploy a production-ready Java REST API with a fully automated CI/CD pipeline and container-based infrastructure, where changes are built, tested, and deployed without manual intervention.
The focus is not only on API implementation, but on the end-to-end delivery lifecycle: clean backend architecture, automated testing, containerization, secure routing, and zero-touch deployment.
- Clean, layered Java backend architecture (DAO → Service → Controller)
- REST API design with validation and structured error handling
- Automated CI/CD pipeline from Git push to production deployment
- Containerized runtime using Docker and Docker Compose
- Reverse proxy, HTTPS, and routing with Traefik
- Environment-based configuration suitable for real deployments
Developer
│
▼
GitHub Repository
│
▼
GitHub Actions (CI/CD)
│ - Build & Test
│ - Build Docker Image
│ - Push Image
│ - Deploy via SSH
▼
Docker & Docker Compose
│
▼
Traefik (HTTPS & Routing)
│
▼
Java REST API ──► PostgreSQL
src/
├── main/java/
│ ├── controllers/ # HTTP endpoints
│ ├── daos/ # Persistence layer
│ ├── services/ # Business logic
│ ├── exceptions/ # Centralized error handling
│ ├── security/ # Authentication / access control
│ ├── util/ # Shared utilities
│ └── App.java # Application entrypoint
│
└── test/
├── unit/ # Unit tests
└── integration/ # Integration tests
The pipeline is triggered automatically on pushes to the main branch and performs:
- Source checkout
- Build and test execution (
mvn package) - Docker image build
- Image push to registry
- Remote deployment via SSH
- Zero-downtime restart using Docker Compose
This ensures that every change is tested, packaged, and deployed automatically.
- Java
- Javalin
- PostgreSQL
- JUnit
- Docker & Docker Compose
- Traefik (reverse proxy & HTTPS)
- GitHub Actions (CI/CD)
- Linux server (cloud VM)
Build and run locally:
mvn clean package
java -jar target/app.jarApplication runs at:
http://localhost:7000
Returns a list of users.
Creates a new user.
{
"username": "john",
"password": "secret"
}The API returns structured error responses for predictable client behavior:
{
"status": "error",
"message": "User not found",
"path": "/api/users/999",
"timestamp": "2025-01-20T10:15:14Z"
}This project reflects how backend services are built and operated in real production environments:
- Automated delivery instead of manual deployments
- Infrastructure-aware backend design
- Secure routing and HTTPS by default
It serves as a practical reference for building and shipping backend services reliably.
This project is a demonstration and learning project designed to showcase backend and DevOps practices. While simplified, the patterns and workflows mirror those used in real-world production systems.