DEV Community

Building a Cyber Threat Task Platform with Kotlin Multiplatform, Ktor, Node.js and React (Strict 3-Role RBAC)

Short answer: SVT Task Manager is a full-stack task dispatch and approval platform for Cyber Threat Intelligence (CTI) and OSINT teams. One Kotlin Multiplatform codebase powers the Android and iOS apps, a Node.js + Express + TypeScript API handles auth and business rules, and a React 19 portal gives super admins an organization-wide view.

The glue is a strict 3-role RBAC model enforced on both the client and the server. I'm Padmakar Garg, a Senior Android Developer working on secure messaging and mobile security. This article walks through the architecture and the decisions behind the project. Code snippets are simplified to explain the ideas.

Why build this?

Security teams don't just need a generic to-do list. A threat hunting task has an owner, a severity, a checklist, evidence, and, most importantly, someone senior who verifies the result before it's closed. Existing task tools either lack that review loop or bury it under features.

So the requirements were clear:

  • Tasks assigned to squads and individuals, with urgency from Low to Critical.
  • A two-way approval flow: analysts submit findings, managers approve or send back with remarks.
  • Strict roles, because who can add whom to the organization matters in a security team.
  • Native mobile apps for the field, plus a web console for oversight.

The architecture at a glance

Android (Compose), iOS (SwiftUI host + Compose), and Super Admin Portal (React 19 + Vite) all connect to a KMP shared core (shared/) with domain -> data (Ktor) -> state -> UI, which talks via JSON / HTTP and Fetch + JWT to a Node.js / Express / TypeScript API (v1) with JWT auth and requireRole middleware, backed by MongoDB (Mongoose).

Three deliverables, one API contract. The mobile apps and the web portal never talk to the database directly; every rule lives in the backend.

The strict 3-role RBAC model

Role design drives everything else, so I defined it first:

Role Scope Who they can add
super_admin Whole organization: squads, managers, audit exports Managers and OSINT analysts
manager Squad leadership, task assignment, approvals OSINT analysts only
osint_analyst Investigations, checklists, submissions Nobody

Enforce it on the server, always

The UI hides buttons a role shouldn't see, but hiding a button is not security. The API decides. A small middleware guards each route:

type Role = 'super_admin' | 'manager' | 'osint_analyst';

export const requireRole = (...allowed: Role[]) => (req: Request, res: Response, next: NextFunction) => {
  const role = req.user?.role as Role | undefined;
  if (!role || !allowed.includes(role)) {
    return res.status(403).json({ message: 'Forbidden' });
  }
  next();
};

// Only leadership can create and assign tasks
router.post('/', authenticate, requireRole('super_admin', 'manager'), createTask);

The "who can add whom" rule is a lookup table instead of scattered if statements:

const CAN_CREATE: Record<Role, Role[]> = {
  super_admin: ['manager', 'osint_analyst'],
  manager: ['osint_analyst'],
  osint_analyst: [],
};

if (!CAN_CREATE[actor.role].includes(newMemberRole)) {
  return res.status(403).json({ message: 'You cannot add this role' });
}

A single table is easy to audit and easy to test, which matters when the rule is the security boundary.

One shared core for Android and iOS

The shared/ module is a Kotlin Multiplatform library with four layers:

shared/src/commonMain/kotlin/.../
├── domain/ # use cases: auth, tasks, approvals, personnel
├── model/ # User, TaskItem, ApprovalItem
├── data/ # Ktor API client, repositories, persistent storage
├── state/ # TaskStore (reactive Compose state)
└── ui/ # Compose Multiplatform screens, themes, dialogs

The Android app and the iOS app are thin hosts. androidApp/ holds MainActivity, and iosApp/ holds a small SwiftUI shell that embeds the shared Compose UI. Almost everything else, including screens, is written once.

Reactive state with a simple store

Instead of scattering state across screens, a TaskStore owns it and exposes Compose state:

class TaskStore(
  private val getTasks: GetTasksUseCase,
  private val scope: CoroutineScope
) {
  var tasks by mutableStateOf<List<TaskItem>>(emptyList())
    private set
  var isLoading by mutableStateOf(false)
    private set

  fun refresh(tab: TaskTab) {
    scope.launch {
      isLoading = true
      tasks = getTasks(tab).getOrDefault(tasks)
      isLoading = false
    }
  }
}

Screens just read store.tasks. When the store changes, Compose recomposes. There's no hidden state to keep in sync.

Talking to the backend with Ktor

Ktor is the HTTP client in commonMain, so networking is shared too. The only platform-specific piece is the base URL during development:

// commonMain
expect val baseUrl: String

// androidMain (emulator reaches the host machine on 10.0.2.2)
actual val baseUrl: String = "http://10.0.2.2:5000/api/v1"

A practical tip for real devices: run adb reverse tcp:5000 tcp:5000 so the phone reaches your local backend over USB. For anything beyond local development, use HTTPS only.

The workflow: create, submit, review

Two-step task creation

Creating a task is split into two short steps, which works much better on a phone than one long form:

  1. Assign to: pick a squad (for example Threat Operations & Response) and individual people.
  2. Task details: title, description, urgency, checklist steps and deadline.

Deadlines use quick presets (Today, Tomorrow, This week) plus a date and time picker for exact scheduling.

The approval loop

Open task -> analyst finishes checklist + writes dossier notes -> Submitted (pending review) -> Manager approves -> Closed (archived under "Recently Closed"), or Manager sends back -> Reopened (with mandatory remarks).

The important rule is on the send back path: remarks are mandatory, so the analyst always knows what to fix.

router.post('/:id/reject', authenticate, requireRole('super_admin', 'manager'), async (req, res) => {
  const { remarks } = req.body;
  if (!remarks?.trim()) {
    return res.status(400).json({ message: 'Remarks are required to send back a task' });
  }
  // reopen the task and store the manager's remarks
});

Closing a task is a decision, so it should leave a trail: who approved it, when, and what they said.

Native polish that users notice

Zero-flicker cold start on Android

A white flash on launch makes an app feel unfinished. The fix is a dedicated splash theme (Theme.SvtSplash) applied before the first Compose frame, so the dark brand background appears instantly. After that, a short animated splash (a glowing shield pulse) bridges into the app.

Adaptive branding

The launcher uses an Android adaptive icon (a cyber shield on a midnight slate background) generated for every density bucket, plus a 1024x1024 icon in the iOS asset catalog.

Persistent auto-login

Users sign in once and land on the dashboard on later launches. The session is cleared when they tap Sign Out. Platform storage backs this on each target.

Security note: a JWT is a credential. For production, store it with Android Keystore and iOS Keychain (behind a common expect/actual interface) rather than plain SharedPreferences or NSUserDefaults. This is the first hardening step on my roadmap, and I covered the full pattern in a separate article (linked below).

The Super Admin web portal

The React 19 + Vite + Tailwind portal is for oversight rather than daily task work:

  • Organization overview: total staff, active teams, overdue tasks and completion rate.
  • Staff directory: role filters, temporary password resets and team allocation.
  • Audit reports: one-click CSV export of task history and turnaround times, restricted to super_admin.

An AuthContext holds the 3-role state, and a small API service wraps fetch with the JWT. The portal and the mobile apps call the same endpoints, so there's one set of business rules to maintain.

API surface

Method Endpoint Purpose Roles
POST /auth/login Sign in Public
GET /auth/me Current profile Authenticated
GET /tasks Paginated tasks with tab and priority filters Authenticated
POST /tasks Create and assign a task super_admin, manager
POST /tasks/:id/submit Submit findings for review osint_analyst
GET /approvals Pending and recently closed super_admin, manager
POST /approvals/:id/approve Approve and close super_admin, manager
POST /approvals/:id/reject Send back with remarks super_admin, manager
POST /employees Add staff (role rules enforced) super_admin, manager
GET /reports/export-csv Audit export super_admin

What I learned

  • Design roles before screens. Once the permission table was settled, API routes and UI visibility fell out of it naturally.
  • Share the core, keep hosts thin. Almost all logic and UI lives in shared/, so a fix lands on Android and iOS at the same time.
  • The server is the only real authority. Client checks improve UX, but only the API protects data.
  • Small UX details compound. No launch flicker, quick date presets and a two-step form made the app feel professional.
  • Seed data speeds everything up. A seed script with one account per role let me test every permission path in minutes.

What's next

  • Move session tokens to Keystore and Keychain.
  • TLS certificate pinning per Ktor engine.
  • Refresh-token rotation and revocation.
  • Offline-first caching with background sync.
  • Server-verified device integrity (Play Integrity and App Attest).

Summary

SVT Task Manager combines a KMP mobile app, a Node.js API and a React admin portal. A strict 3-role RBAC model (super_admin, manager, osint_analyst) is enforced on the server. Shared Kotlin code covers domain, data, state and UI for Android and iOS. A mandatory-remarks approval loop keeps reviews accountable. Native details (splash, adaptive icons, auto-login) make it feel production-ready. Next up: secure token storage, pinning and attestation.

Related reading

  • One Codebase, Two Attack Surfaces: Securing Kotlin Multiplatform Apps
  • Kotlin Multiplatform for Android Developers: Share Your Business Logic with Ktor, Koin and Clean Architecture
  • How End-to-End Encryption Works in an Android Chat App (ECDH + AES-GCM in Kotlin)

About the author

Padmakar Garg is a Senior Android Developer with 8+ years of experience in Kotlin, Jetpack Compose, Kotlin Multiplatform and mobile security, building real-time encrypted messaging apps. Portfolio and blog: gargpadmakar.github.io. Connect on LinkedIn and GitHub.

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.