LogSmart

Template-based digital logging system for food safety compliance — SvelteKit + Rust (Axum) + PostgreSQL + MongoDB

full-stacksveltekitrustaxumpostgresqlmongodbcloudflare-pagesdocker-swarm
LogSmart template designer screenshot

LogSmart is a template-based digital logging system initially designed for the food service industry. It replaces paper logs with an instant, secure, and eco-friendly solution that optimizes daily operations. Features a custom WYSIWYG template designer, AI-assisted template generation, scheduled logs, built-in report generation, and simple user administration tools.

LogSmart originated as a group startup project for university, winning the ‘Best Team’ award nominated by lecturers and additionally winning £500 from the Plymouth Innovate Startup Competition.

Architecture

Front-end

  • Framework: SvelteKit 2 (Svelte 5 runes)
  • Styling: Tailwind CSS v4
  • Runtime: Bun
  • Hosting: Cloudflare Pages
  • Type safety: OpenAPI → TypeScript via openapi-typescript

Back-end

  • Language: Rust
  • Framework: Axum
  • Databases:
    • PostgreSQL (authentication, security logs, users, companies, branches, attendance)
    • MongoDB (templates, template versions, log entries, report runs)
  • Hosting: Oracle VPS (ARM64) via Docker Swarm

Polyglot Persistence

DatabaseResponsibility
PostgreSQLUsers, companies, branches, invitations, clock events, passkeys, password resets, security logs
MongoDBTemplates, template versions, log entries, report runs

The backend uses a strict codegen chain: Rust DTOs (dto.rs) with utoipa annotations → OpenAPI JSON spec (gen_spec.rs binary) → TypeScript definitions (api-types.d.ts) consumed by the frontend.

CI/CD & Deployment

  • Branching: feature/*main (integration) → prod (auto-deploy)
  • GitHub Actions: Automated PR workflow creates/updates mainprod PR
  • Front-end: bun run deploy → Wrangler → Cloudflare Pages
  • Back-end: Nix builds ARM64 Docker image → Docker Swarm on Oracle VPS

Key Features

Template Designer

Drag-and-drop WYSIWYG editor for creating custom logging templates. Supports text, number, temperature, checkbox, select, photo, and signature fields. Templates are versioned in MongoDB for auditability.

AI-Assisted Generation

Describe logging needs in plain English; the AI generates a complete template structure with appropriate field types and validation rules.

Scheduled Logs & Reminders

Assign templates to users/branches with cron-like schedules. Dashboard shows due/overdue forms per user and location.

Reporting

Async report generation with PDF/CSV exports. Filter by date range, branch, template, user. Reports run as background jobs with status tracking.

Authentication & Authorization

  • JWT-based sessions with refresh tokens
  • Sign in with Google Oauth
  • WebAuthn/Passkey support
  • Role-based access (Admin, Manager, Staff)
  • Company/branch isolation (multi-tenant)

Time & Attendance

Clock in/out. Real-time attendance dashboard for managers.

Screenshots

logsmart-template-designer.png

Local Development

Bash Bash

Testing

Bash Bash
Bash Bash