Streaker is a habit-tracking backend designed for real-world use. Built with Java 21 and Spring Boot 3, it supports JWT authentication, Docker-based deployments, and structured logging β making it suitable for production-grade environments and DevOps experimentation.
- Java 21
- Spring Boot 3
- JWT Authentication
- PostgreSQL
- Hibernate, Lombok, MapStruct
- Docker & Docker Compose
- Splunk (logging)
- JUnit & Mockito
- GitHub Actions (CI)
- PMD & JaCoCo
[Frontend SPA]
|
| HTTPS
v
[ NGINX Reverse Proxy (SSL Termination) ]
|
v
[ Streaker Backend (Spring Boot) ]
|
| -- REST API (secured via JWT)
|
| -- Docker Logging (Splunk)
|
| -- Actuator (/health, /metrics)
v
[ PostgreSQL DB ]
- Docker + Docker Compose
- Java 21 (for manual development builds)
git clone https://github.com/MRegra/streaker-business.git
cd streaker-business/backend
# Copy environment file
cp .env.template .env
# Start backend + database + logging
docker compose up --buildAccess:
- API:
http://localhost:8080 - Splunk UI:
http://localhost:8000 - Health:
http://localhost:8080/actuator/health
Streaker uses stateless JWT-based authentication.
POST /api/v1/user/login
Content-Type: application/json
{
"username": "admin",
"password": "your-password"
}Response:
{
"token": "eyJhbGciOiJIUzI1NiIsInR..."
}Include this token in all secured endpoints:
Authorization: Bearer <JWT>
Full Swagger API documentation is planned.
| Endpoint | Method | Auth | Description |
|---|---|---|---|
/api/v1/user/register |
POST | β | Register new user |
/api/v1/user/login |
POST | β | Login & get JWT token |
/api/v1/habit |
CRUD | β | Manage habits |
/api/v1/category |
CRUD | β | Habit categories |
/api/v1/streak |
CRUD | β | Track habit streaks |
/api/v1/log |
CRUD | β | Habit activity log |
/api/v1/reward |
CRUD | β | Reward tracking |
Run tests:
./mvnw testCheck coverage:
open target/site/jacoco/index.htmlPMD and other quality checks are configured in the build pipeline.
Create an .env file with these keys:
| Key | Description |
|---|---|
SPRING_DATASOURCE_URL |
JDBC connection string |
SPRING_DATASOURCE_USERNAME |
DB user |
SPRING_DATASOURCE_PASSWORD |
DB password |
JWT_SECRET |
Signing key for JWT tokens |
BOOTSTRAP_ADMIN_USERNAME |
Default admin username |
BOOTSTRAP_ADMIN_PASSWORD |
Default admin password |
BOOTSTRAP_ADMIN_EMAIL |
Admin email |
-
Actuator endpoints enabled:
/actuator/health/actuator/metrics/actuator/info
-
Logs sent to Splunk
-
Prometheus + Grafana integration (in progress)
-
Structured logging planned (JSON w/ request tracing)
We use Fluent Bit + Loki + Grafana for application logging. β See docs/logging-stack.md for details and justification.
Steps to deploy:
- Set up VPS with Docker
- Harden SSH & firewall (only allow ports 22, 80, 443)
- Clone this repository
- Copy
.envwith production secrets - Run:
docker compose -f docker-compose.prod.yml up -d- Use NGINX reverse proxy + Let's Encrypt for SSL termination
-
GitHub Actions test pipeline
-
Runs:
- Unit + integration tests
- PMD checks
- JaCoCo reports
-
Deployment integration to VPS planned
- Docker + Compose setup
- Secure backend (JWT)
- GitHub Actions for tests
- Logging to Splunk
- Swagger/OpenAPI docs
- Auth rate limiting
- Refresh token strategy
- Prometheus + Grafana
- Production deploy via GitHub SSH
This project is open for personal use and inspiration. However, I do not offer support, contributions, or issue tracking.
Use it, fork it, break it, learn from it β that's the goal.
MIT Β© MRegra
feat: -> minor bump
fix: -> patch bump
BREAKING CHANGE: -> major bump
Full docker clean-up:
docker compose down -v --remove-orphans && docker system prune -af --volumes && docker compose build --no-cache && docker compose --profile local -f docker-compose.yml up -d
docker compose down -v --remove-orphans; docker system prune -af --volumes; docker compose build --no-cache; docker compose --profile local --profile caddy --profile watchtower -f docker-compose.yml up -d
cd backend
docker build -t ghcr.io/mregra/streaker-backend:latest .
For PowerShell:
$env:CR_PAT = "your_pat_goes_year"
docker login ghcr.io -u mregra --password $env:CR_PAT
docker push ghcr.io/mregra/streaker-backend:latest
From the VPS
This one starts the watchtower:
docker compose -f docker-compose.watchtower.yml up -d
This one starts the newly created backend
docker run -d --name streaker-backend --restart always ghcr.io/mregra/streaker-backend:latest
export CR_PAT=your_ghcr_token
export DISCORD_STREAKER_WEBHOOK=https://discord.com/api/webhooks/XXX
git clone https://github.com/yourusername/streaker.git
cd streaker
./infra/deploy.sh