user-activity-dashboard Svelte Themes

User Activity Dashboard

A modern admin dashboard built with SvelteKit (Svelte 5) for managing users and analyzing login activity. The project includes OAuth authentication, a custom UI system, role-based access, and real login analytics powered by Turso and Drizzle ORM.

User Activity Dashboard

A modern admin dashboard built with SvelteKit (Svelte 5) for managing users and analyzing login activity. The project includes OAuth authentication, a custom UI system, role-based access, and real login analytics powered by Turso and Drizzle ORM.


๐Ÿงช Live Demo


๐Ÿงฐ Tech Stack

  • Framework: SvelteKit (Svelte 5)
  • Styling: Tailwind CSS + shadcn/ui + OverlayScrollbars + Lenis
  • Charts: Chart.js (+ Zoom plugin)
  • Authentication: BetterAuth (GitHub, Google, Email/Password)
  • ORM: Drizzle ORM
  • Database: Turso (libSQL)
  • Email: Resend API (custom email verification)
  • Routing: Shallow routing with Drawer (on /users/[id])
  • Deployment: Vercel

๐Ÿš€ Getting Started

# Clone the repository
git clone https://github.com/ondrejjcizek/procorp-frontend-test.git
cd procorp-frontend-test

# Install dependencies
pnpm install

# Copy environment variables
cp .env.example .env

# Push the schema to the database (required before first run)
pnpm db:push

# (Optional) Seed the database with test data
pnpm db:seed

# Start the development server
pnpm dev

๐Ÿงฉ Features

๐Ÿง‘โ€๐Ÿ’ผ Admin Area

  • โœ… Sign in via GitHub, Google, or email/password using BetterAuth
  • โœ… Email verification with custom Resend template
  • โœ… Auto role promotion for whitelisted admin emails
  • โœ… Login history auto-generated on first login
  • โœ… Device, browser, and IP tracking on every login
  • โœ… Online/offline state synced on login/logout
  • โœ… Cookie-based sessions with expiration and cache

๐Ÿ‘ฅ Users

  • ๐Ÿงช Stored in Turso DB, seedable via pnpm db:seed
  • ๐Ÿ” Fuzzy search by name/email using Fuse.js
  • ๐Ÿ“Š Sorted by online status and last active time
  • ๐Ÿงพ User detail shown in Drawer (shallow routing)
  • โš ๏ธ Suspicious users flagged with warnings
  • ๐ŸŸข Animated online/offline indicators
  • ๐Ÿ“… Joined date, role badge, and status shown
  • ๐Ÿ› ๏ธ User actions: View and Delete

๐Ÿ‘ค Account

  • ๐Ÿ“‡ Displays avatar, name, email, and role
  • ๐Ÿ“ฌ Email verification via Resend
  • ๐Ÿ“Š Activity summary:
    • Joined date
    • Last active timestamp
    • Logins in last 30 and 3 days
  • ๐Ÿ“ˆ Login frequency chart (last 30 days, Chart.js)
  • โš ๏ธ Suspicious days highlighted (โ‰ฅ 8 logins)
  • ๐Ÿงญ Admins can navigate to full user list
  • ๐Ÿ”’ Secure logout with session clear

๐Ÿ“ˆ Analytics

  • ๐Ÿ“Š Daily login trend (30 days) visualized with Chart.js
  • ๐Ÿ“‰ Spike detection based on activity thresholds
  • ๐Ÿ”„ Auto-refresh login data every 30 seconds
  • ๐Ÿ–ฑ๏ธ Pan + zoom interactions via Chart.js plugin

๐Ÿšจ Suspicious Activity Detection

  • Users are flagged if:
    • Logged in 10ร—+ per day on 3 or more days
    • Had a sudden spike (e.g. avg. 2โ€“3 โ†’ 15+)
  • โš ๏ธ Suspicious users are listed and clearly marked

๐ŸŒ API Routes

  • GET /api/users

    • Returns all users from Turso DB
    • Includes login history, activity stats, and role
    • Suspicious login detection
    • ๐Ÿ›ก๏ธ Admin-only access
  • GET /api/activity/[id]

    • Returns login history for a specific user
    • Logins in last 30 / 3 days
    • Last active timestamp
    • ๐Ÿ›ก๏ธ Admin-only access

Top categories

Loading Svelte Themes