How simplecabinet/simplecabinetwebapi works
Purpose and Entry Points
SimpleCabinetWebAPI is a Java backend exposing SimpleCabinet 2 functionality as an HTTP API, including user cabinets, launcher integration, administration, shops, payments, and update delivery. Spring Boot starts from src/main/java/com/gravitlauncher/simplecabinet/web/WebApplication.java; startup initialization is in src/main/java/com/gravitlauncher/simplecabinet/web/WebApplicationOnStartup.java.
HTTP API Boundary
Controllers are grouped by client/domain: public and cabinet APIs, privileged admin APIs, game-launcher APIs, payment-provider webhooks, and an integration endpoint for ban management. DTOs isolate API payloads from persistence models, while centralized exception handling maps domain failures to REST responses.
• src/main/java/com/gravitlauncher/simplecabinet/web/controller/AuthController.java
• src/main/java/com/gravitlauncher/simplecabinet/web/controller/launcher/LauncherAuthController.java
• src/main/java/com/gravitlauncher/simplecabinet/web/controller/admin/AdminMoneyController.java
Authentication and Authorization
Spring Security is configured around JWT issuance, parsing, and request filtering. User/session, permission, group, hardware-ID, and password-check services provide the underlying identity and account controls; controllers operate behind this security boundary.
• src/main/java/com/gravitlauncher/simplecabinet/web/configuration/SecurityConfig.java
• src/main/java/com/gravitlauncher/simplecabinet/web/configuration/jwt/JwtFilter.java
• src/main/java/com/gravitlauncher/simplecabinet/web/service/user/SessionService.java
Core Persistence and Domain Services
The service layer implements business operations over JPA-style model/repository pairs. Persistent domains include users and balances, servers/bans/reputation/news, audit records, shop orders, and launcher-update metadata. Database evolution is managed with Liquibase changelogs.
• src/main/java/com/gravitlauncher/simplecabinet/web/model/user/User.java
• src/main/java/com/gravitlauncher/simplecabinet/web/repository/user/UserRepository.java
• src/main/resources/db/changelog/db.changelog-master.yaml
Registration, Account, and Moderation Flow
Registration and authentication create/manage user records, confirmation/reset preparation, sessions, user assets, and balances. Administrative and cabinet endpoints then manage profile details, security, sessions, hardware, moderation, groups, reputation, bans, and audit history.
• src/main/java/com/gravitlauncher/simplecabinet/web/service/RegisterService.java
• src/main/java/com/gravitlauncher/simplecabinet/web/service/PrepareUserService.java
• src/main/java/com/gravitlauncher/simplecabinet/web/service/AuditService.java
Commerce and Payment Flow
Shop APIs create group, item, or service orders; payment services initiate provider-specific payments and record payment/order state. Webhook controllers receive asynchronous provider callbacks. Delivery is separated by product type, including LuckPerms group fulfillment and database-backed item delivery.
• src/main/java/com/gravitlauncher/simplecabinet/web/service/shop/ShopService.java
• src/main/java/com/gravitlauncher/simplecabinet/web/service/payment/StripePaymentService.java
• src/main/java/com/gravitlauncher/simplecabinet/web/controller/payment/StripeWebhookController.java
Launcher Updates and External Infrastructure
Launcher-facing APIs authenticate clients, expose profiles, check servers, and distribute artifacts/update directories. Artifact storage is abstracted behind local-file or S3 implementations. Configurable integrations include SMTP/console mail, hCaptcha, Stripe, YooKassa, FreeKassa, test payments, and S3; runtime deployment supports a JVM JAR or Docker image.
• src/main/java/com/gravitlauncher/simplecabinet/web/service/updates/LauncherArtifactService.java
• src/main/java/com/gravitlauncher/simplecabinet/web/service/storage/StorageService.java
• Dockerfile
Components 20
HTTP API
Client, admin, launcher, and payment endpoints.
- Cabinet & public APIs
src/main/java/com/gravitlauncher/simplecabinet/web/controller/AuthController.java - Admin APIs
src/main/java/com/gravitlauncher/simplecabinet/web/controller/admin/AdminMoneyController.java - Payment webhooks · Receives asynchronous provider callbacks.
src/main/java/com/gravitlauncher/simplecabinet/web/controller/payment/StripeWebhookController.java
Identity & Access
JWT security and account session controls.
- Security configuration
src/main/java/com/gravitlauncher/simplecabinet/web/configuration/SecurityConfig.java - JWT request filter
src/main/java/com/gravitlauncher/simplecabinet/web/configuration/jwt/JwtFilter.java - Sessions & account controls · Manages sessions, permissions, groups, hardware IDs, and password checks.
src/main/java/com/gravitlauncher/simplecabinet/web/service/user/SessionService.java
Core Domain
Business services and persistent records.
- Registration & preparation · Creates accounts and prepares confirmation or reset workflows.
src/main/java/com/gravitlauncher/simplecabinet/web/service/RegisterService.java - Audit service
src/main/java/com/gravitlauncher/simplecabinet/web/service/AuditService.java - Domain repositories · Users, balances, moderation, news, orders, and update metadata.
src/main/java/com/gravitlauncher/simplecabinet/web/repository/user/UserRepository.java - Database migrations
src/main/resources/db/changelog/db.changelog-master.yaml
Commerce
Orders, payment processing, and fulfillment.
- Shop orders · Creates group, item, and service orders.
src/main/java/com/gravitlauncher/simplecabinet/web/service/shop/ShopService.java - Payment processing · Initiates provider payments and records payment state.
src/main/java/com/gravitlauncher/simplecabinet/web/service/payment/StripePaymentService.java - Product fulfillment · Delivers groups through LuckPerms and items through the database.
Launcher Delivery
Launcher APIs, artifacts, and storage.
- Launcher APIs · Authenticates launcher clients and exposes profiles and servers.
src/main/java/com/gravitlauncher/simplecabinet/web/controller/launcher/LauncherAuthController.java - Launcher artifacts · Serves update directories and launcher artifacts.
src/main/java/com/gravitlauncher/simplecabinet/web/service/updates/LauncherArtifactService.java - Artifact storage · Uses local files or S3 implementations.
src/main/java/com/gravitlauncher/simplecabinet/web/service/storage/StorageService.java
Other components
- Spring Boot app
src/main/java/com/gravitlauncher/simplecabinet/web/WebApplication.java - Startup initialization
src/main/java/com/gravitlauncher/simplecabinet/web/WebApplicationOnStartup.java - External providers · Payment providers, SMTP, hCaptcha, S3, and LuckPerms.
- Docker image
Dockerfile
Connections 26
- Spring Boot app → Startup initialization: initializes
- Spring Boot app → Security configuration: configures
- Spring Boot app → Cabinet & public APIs: serves
- Spring Boot app → Admin APIs: serves
- Spring Boot app → Payment webhooks: serves
- Spring Boot app → Launcher APIs: serves
- Security configuration → JWT request filter: installs
- JWT request filter → Sessions & account controls: validates access with
- Cabinet & public APIs → Registration & preparation: registers accounts
- Cabinet & public APIs → Sessions & account controls: manages accounts
- Admin APIs → Audit service: records actions
- Registration & preparation → Domain repositories: persists
- Sessions & account controls → Domain repositories: reads and updates
- Audit service → Domain repositories: stores records
- Database migrations → Domain repositories: evolves schema
- Cabinet & public APIs → Shop orders: creates orders
- Shop orders → Payment processing: initiates payment
- Payment webhooks → Payment processing: confirms callbacks
- Payment processing → External providers: uses providers
- Payment processing → Product fulfillment: triggers paid delivery
- Product fulfillment → Domain repositories: updates order state
- Product fulfillment → External providers: provisions groups
- Launcher APIs → Launcher artifacts: requests updates
- Launcher artifacts → Artifact storage: loads artifacts
- Artifact storage → External providers: uses S3 when configured
- Docker image → Spring Boot app: packages