The TaskForge Backend is a robust, multi-tenant Spring Boot service that powers the TaskForge project management platform.
It is responsible for data persistence, business logic, authentication & authorization, rate limiting, and integrations with external infrastructure such as Keycloak, Redis, and CockroachDB.
Built with modern Java and cloud-ready components, this backend is designed to be scalable, secure, and production-ready.
- Multi-tenant architecture with strict tenant isolation
- OAuth2 / OIDC authentication using Keycloak
- Role-based access control (RBAC)
- Distributed SQL database using CockroachDB
- Rate limiting with Redis + Bucket4j
- Database migrations via Flyway
- OpenAPI 3 / Swagger documentation
- Vertical Slice Architecture for clean modularity
- Production-ready Spring Security setup
| Technology | Purpose |
|---|---|
| Java 21 | Core language |
| Spring Boot 3.4.12 | Application framework |
| Spring Data JPA | ORM / persistence |
| CockroachDB | Distributed SQL database (PostgreSQL compatible) |
| Keycloak | Identity & access management (OIDC) |
| Redis | Distributed caching & rate limiting |
| Bucket4j | Advanced rate limiting |
| Flyway | Database migrations |
| Spring Security | OAuth2 resource server |
- The backend acts as an OAuth2 Resource Server
- Authentication and authorization are handled by Keycloak
- Each request is associated with a tenant and scoped accordingly
- Data is stored in CockroachDB using a shared-database, tenant-isolated model
- Redis is used for caching and enforcing rate limits
- Features are organized using Vertical Slice Architecture
TaskForge uses a shared database, tenant-isolated multi-tenancy model:
- Each authenticated request is associated with a tenant
- Tenant context is resolved from the JWT issued by Keycloak
- All data access is scoped to the active tenant
- Cross-tenant access is prevented at the service and persistence layer
docker-compose up -d
cockroach start-single-node --insecure --background
./mvnw spring-boot:run- Backend: http://localhost:8081
- Swagger UI: http://localhost:8081/swagger-ui.html
Before running the application, ensure you have the following installed:
- Java 21 JDK (
java -version) - Docker & Docker Compose
- CockroachDB (binary or Docker)
-
Download CockroachDB from the official site.
-
Start a single-node cluster:
cockroach start-single-node \ --insecure \ --listen-addr=localhost:26257 \ --http-addr=localhost:9090 \ --background
-
Create the database:
cockroach sql --insecure --execute="CREATE DATABASE taskforge;"
docker run -d \
--name=roach1 \
-p 26257:26257 \
-p 9090:8080 \
cockroachdb/cockroach:latest-v23.1 \
start-single-node --insecureKeycloak is used for authentication, authorization, users, and roles.
-
Start Keycloak and Redis:
docker-compose up -d
-
Access the Admin Console:
- URL: http://localhost:10091
- Username:
admin - Password:
admin(or seedocker-compose.yaml)
-
Import Realm Configuration:
-
Go to Create Realm
-
Import
config/keycloak/realm-export.json -
This sets up:
taskforgerealm- Clients
- Roles
-
-
(Optional) Import users from
users-export.jsonor create test users manually.
Redis is started automatically via Docker Compose.
-
Host:
localhost -
Port:
6379 -
Used for:
- Rate limiting
- Caching
-
Verify configuration in:
src/main/resources/application.yaml -
Build and run:
./mvnw clean install ./mvnw spring-boot:run
-
The server starts on port 8081
Swagger UI is available at:
http://localhost:8081/swagger-ui.html
-
Obtain an access token from Keycloak
-
Click Authorize
-
Enter:
Bearer <your-access-token>
src/main/java/com/taskforge
├── config/ # Security, OpenAPI, & application config
├── features/ # Feature modules (vertical slices)
│ ├── issues/ # Issue management
│ ├── projects/ # Project management
│ ├── tenants/ # Multi-tenancy logic
│ └── ...
├── shared/ # Shared utilities & exceptions
└── TaskForgeApplication.java
- All endpoints are secured using OAuth2 Bearer Tokens
- Tokens must be issued by the
taskforgeKeycloak realm - Authorization checks are enforced at controller and service layers
- Rate limiting is applied per user / tenant
-
Database connection refused Ensure CockroachDB is running on port
26257 -
401 Unauthorized Ensure the Bearer token is valid and issued by:
http://localhost:10091/realms/taskforge -
Rate limit exceeded Bucket4j limits may be hit — wait or restart Redis
-
Port conflicts Ensure port
8081is not already in use
- Keep features isolated within their module
- Always add Flyway migrations for schema changes
- Document new endpoints in OpenAPI
- Follow standard Java and Spring Boot best practices
- Audit logging
- Webhook support
- Advanced search & filtering
- Notification system
- Observability & metrics
This project is proprietary and intended for internal or educational use.
Built with ❤️ using Java & Spring Boot