BBackend CourseLeroy Labs
0/0
Search the course

Project inventory

This is the full analysis of each project, ordered by complexity. Each one builds on the last. All five use Java 25, Spring Boot, PostgreSQL, Liquibase and Maven.

Store Hostel Report-Manager-2 IR3D SperoTek
Spring Boot 4.0.6 4.0.6 3.5.8 4.1.0 4.1.2
Size Small ~15 modules ~400 files, 16 modules ~820 files, 23 modules 11 Modulith modules
Architecture Package-by-layer Package-by-feature Modular monolith Modular monolith + pluggable providers Spring Modulith (enforced)
Postgres Plain PostGIS 18 16 RDS 18
Auth JWT (stateless refresh) JWT + rotated refresh JWT cookie + hashed refresh + OAuth2 Google JWT kid-rotation, Google/Apple, TOTP, passkeys Hybrid JWT + server sessions, Argon2, MFA, passkeys, SAML/OIDC SSO
Async n/a @Async, STOMP, Web Push RabbitMQ + DLQ, SSE RabbitMQ, WebSocket chat, Expo/FCM Outbox (Modulith events)
Money Stripe Manual MoMo reference n/a Paystack + double-entry wallet ledger Double-entry accounting ledger
Deploy n/a AWS CDK → Fargate, OIDC CI Docker + Watchtower, GH Actions CloudFormation, EC2 + SSM, ECR, Cloudflare Tunnel Docker, Cloudflare Tunnel (no CI yet)
Tests contextLoads + CartTest Unit + @WebMvcTest Testcontainers ~95 integration tests Testcontainers + Mailpit + architecture tests

1. Spring-Boot-Store (Level 1)

An e-commerce API with users, products, categories, carts, orders and Stripe checkout.

  • Structure: package-by-layer (controllers/, services/, repositories/, entities/, dtos/, mappers/, filters/, payment/).
  • Database:
    • Liquibase changelogs 001–005.
    • gen_random_uuid(), NUMERIC(10,2) CHECK (price > 0), explicit FK indexes, UNIQUE (cart_id, product_id), ON DELETE CASCADE.
    • Order items snapshot their prices.
  • JPA:
    • @OneToMany with cascade and orphanRemoval, @OneToOne with @MapsId (shared primary key), @ManyToMany wishlist.
    • @EntityGraph everywhere.
    • Rich entity methods (Cart.addItem, Order.fromCart).
  • API:
    • MapStruct (expressions, @MappingTarget), Bean Validation + a custom @Lowercase.
    • ResponseEntity.created(uri), a sort whitelist, springdoc.
  • Security: stateless JWT (jjwt), BCrypt, /admin/** role rule, ownership check on orders, refresh JWT in an HttpOnly cookie.
  • Payments: a PaymentGateway port with a Stripe adapter, Checkout Session with order_id metadata, webhook signature verification, compensation on failure.
  • Findings, all fixed in Store PR #1:
    • ✅ Cart lookup compared the wrong id. Now compares the product id, covered by CartTest.
    • ✅ No admin check on product writes and no owner check on user GET/PUT/DELETE. Both are now enforced.
    • ✅ Hard-coded DB password, now read from env vars. The old value is still in git history.
    • ✅ The JWT was parsed three times per request. It’s now parsed once.
    • ✅ System.out logging replaced with SLF4J. Env var typos fixed.
    • ℹ️ /carts/** stays open by design (anonymous guest carts keyed by a random UUID).

2. Hostel-Web-App (Level 2)

A hostel booking platform (React + TS frontend, Spring backend, AWS CDK infrastructure).

  • Structure: package-by-feature modules (booking, hostel, room, waitlist, complaint, review, map, notification, audit, …). Rich domain factories (Booking.createBooking).
  • Database:
    • PostGIS (Point locations, ST_DWithin, ST_Distance, GIST indexes).
    • GIN on tag arrays, partial indexes and partial unique indexes, a composite index for the occupancy query.
    • CHECK constraints and @OnDelete RESTRICT/CASCADE/SET NULL.
    • Native CTE queries into projections, Specifications.
    • @Version optimistic locking plus PESSIMISTIC_WRITE on approval, and a @Modifying bulk reject.
  • Security:
    • JWT, with the user reloaded on every request.
    • Rotated DB refresh tokens with reuse detection.
    • One-time tokens hashed with SHA-256 (15-minute reset), anti-enumeration, BCrypt(12).
    • A sliding-window rate limiter, CORS config, STOMP CONNECT auth, an AOP @Audited aspect.
  • Real-time: STOMP user queues, VAPID Web Push (dead subscriptions deactivated).
  • Integrations: Cloudinary signed direct uploads, a manual MoMo payment reference plus a deadline sweeper.
  • Ops:
    • Multi-stage Docker, compose with watch, healthchecks and a pgAdmin profile.
    • AWS CDK: RDS with a generated secret, ALB + Fargate in private subnets, an ACM cert, circuit-breaker rollback.
    • GitHub OIDC deploys.
  • Tests: unit tests, @WebMvcTest security tests, CDK tests.
  • Findings, all fixed in Hostel PR #1:
    • ✅ JWT lifetime unit mismatch (milliseconds read as seconds, giving roughly 20-day tokens). Lifetimes are now typed Durations.
    • ✅ Refresh tokens were stored in plaintext. They’re now stored as SHA-256 hashes.
    • ✅ The rate limiter trusted the client’s X-Forwarded-For header. It now uses Tomcat’s trusted-proxy resolution.

3. Report-Manager-2 (Level 3)

Financial and statistical reporting for an organisation’s unit hierarchy.

  • Structure: a modular monolith (domain/application/web/infrastructure per module); the Strategy pattern for report generators.
  • Database:
    • 27 entities; a BaseEntity with UUID ids and soft delete.
    • A self-referencing unit tree, many-to-many roles and permissions.
    • 119 @Query methods (many native), Specifications that include row-level access rules.
    • 24 indexes, 22 changesets including seed data.
    • @TransactionalEventListener(AFTER_COMMIT).
  • Security:
    • HS512 JWT in an HttpOnly cookie (with a Bearer fallback).
    • Hashed refresh tokens with a cap of 5, a session list, revoke-others, and breach detection.
    • Google OAuth2 with a cookie-based authorization request store.
    • Permission-based @PreAuthorize (123 uses), a security headers filter, maintenance mode.
  • Messaging: RabbitMQ direct exchange + DLX/DLQ per queue, retries, ExportDeadLetterConsumer, and a ResilientPublisher in-process fallback.
  • Real-time: SSE with a 25-second heartbeat. Caching: @Cacheable (in-memory).
  • Other:
    • 11 schedulers (reminders, quarter close, retention purges).
    • POI and OpenPDF exports stored as DB blobs.
    • Gmail/SES email with 12 templates and staging redirection.
    • Web Push.
    • @Auditable AOP before/after auditing.
  • Ops: distroless images, compose with Prometheus and Grafana, GitHub Actions to the registry, Watchtower, Sentry with PII scrubbing, Log4j2.
  • Tests: Testcontainers singleton Postgres, Awaitility.
  • Findings:
    • CSRF is disabled even though the JWT is sent in a cookie.
    • CORS max-age is about 10 years.
    • The validation starter may be missing.
    • .env files are tracked in git.

4. IR3D / Kontentt (Level 4)

A creator campaign platform: brands fund campaigns, creators submit clips, views are verified, and earnings are paid out.

  • Structure: a large modular monolith (23 modules) with pluggable stub/real providers for payments, storage, content matching, view tracking, ads and profile verification.
  • Database:
    • 58 entities and 99 changesets on RDS.
    • Pessimistic locks on wallet, hold and refund rows.
    • A double-entry ledger with nightly reconciliation.
    • Query repositories for admin dashboards, partial unique indexes.
  • Security:
    • JWT kid key rotation and hashed, rotated refresh tokens with device labels.
    • Google OIDC, Sign in with Apple (with token revocation), passkeys (webauthn4j), TOTP with AES-GCM encrypted secrets, step-up MFA, staff MFA enforcement.
    • @RequiresPermission (148 uses), an XSS filter, @NoHtml, an SSRF-safe fetcher.
    • Paystack HMAC-SHA512 webhooks, an encrypted OAuth token store, PKCE for social linking, CloudFront signed cookies.
  • Real-time: a STOMP chat with authorised subscriptions, presence, typing and delivery receipts. Expo and FCM push.
  • Messaging: RabbitMQ per-module queues and DLQs, a TransactionalRabbitPublisher (sends after commit), an admin dead-letter viewer.
  • Other:
    • 19 scheduled jobs with run recording.
    • S3 + CloudFront / Cloudinary, ffmpeg transcoding, and a dry-run migration from Cloudinary to S3.
    • yt-dlp + perceptual-hash content matching.
    • i18n (en, fr), activity and audit aspects.
  • Ops:
    • CloudFormation (ECR, EC2, IAM, RDS).
    • ARM images tagged by SHA, deployed via SSM send-command.
    • Config in SSM Parameter Store, Cloudflare Tunnel, CloudWatch logs, Actuator on a separate port, Sentry.
  • Tests: about 95 integration tests on Testcontainers.
  • Findings:
    • Scheduled jobs and the STOMP broker only work on a single node (ShedLock and a broker relay are planned).
    • Key files sit in the working tree.

5. SperoTek Accounting (Level 5, in development)

A multi-tenant accounting SaaS.

  • Structure: Spring Modulith (accesscontrol, approvals, audit, coa, company, identity, ledger, notification, periods, reporting, shared). It has public api/ packages, package-private implementations, events between modules, and boundaries verified by tests.
  • Database:
    • UUIDv7 ids.
    • @TenantId shared-schema multi-tenancy with composite tenant foreign keys.
    • NUMERIC(19,4) amounts, one-sided-line CHECK constraints, deferrable unique constraints.
    • Immutability triggers (posted journals, append-only audit, no TRUNCATE).
    • Partial unique idempotency indexes, advisory locks for gap-free numbering.
    • JPA for aggregates and JdbcClient for reports.
  • Domain:
    • Double-entry ledger: balance rules, open-period checks, reversals instead of edits, base currency locked after first posting.
    • Chart-of-accounts templates and CSV import, fiscal years and periods.
    • An approval workflow with policies, delegations and escalation.
  • Security:
    • HS256 JWT with a key ring plus server-side sessions (idle and absolute timeouts, a cap of 5, a rotation grace window).
    • A Strict SameSite refresh cookie, a custom CSRF guard.
    • Argon2id, password policy and history, HIBP checks, lockout.
    • TOTP, email codes and recovery codes, step-up MFA, passkeys.
    • Google sign-in, SAML2 and OIDC company SSO with DNS-over-HTTPS domain verification.
    • Per-company permissions via an aspect, company API tokens.
    • AES-GCM key ring encryption at rest.
    • Bucket4j tiered rate limits, security headers, a production secrets check.
  • Async: a Modulith JDBC event publication registry (outbox), an encrypted email outbox with a resubmitter and monitor, bounded per-module executors, schedulers.
  • Other: Thymeleaf HTML/text/subject email templates, Mailpit, OpenPDF and fastexcel exports, an OpenAPI config, correlation-id MDC, compliance reports.
  • Ops: non-root Docker with memory flags, compose (Postgres, Mailpit, app, web, cloudflared), graceful shutdown. No CI yet.
  • Tests: an IT base-class hierarchy, tenant isolation contract tests, email restart tests, a report benchmark, Modulith and architecture tests, JaCoCo.