glanzlicht / MACHWEIS

Mach’s. Beleg’s. Rechne es ab. MACHWEIS ist eine Local-First-Flutter-App für schnelle, kontrollierbare Leistungsnachweise im Handwerk. Die Oberfläche läuft auf iOS, Android und im Web und ist vollständig deutschsprachig.

Verified secure showcase
180 Files 605 KB Public size 26 Redacted Dart · PHP · SQL · Markdown · XML · PLIST

Project overview

MACHWEIS is a verified code showcase with 180 visible project entries across 8 top-level modules. The primary detected language is Dart; protected files remain visible in the structure while their contents stay private.

README

MACHWEIS

Mach’s. Beleg’s. Rechne es ab.

Produktansicht

MACHWEIS Dashboard auf Laptop und Smartphone

MACHWEIS ist eine Local-First-Flutter-App für schnelle, kontrollierbare Leistungsnachweise im Handwerk. Die Oberfläche läuft auf iOS, Android und im Web und ist vollständig deutschsprachig.

Aktueller Funktionsumfang

  • lokale Firmen-, Kunden-, Auftrags- und Mitarbeiterdaten (SQLite auf Android/iOS, Browser-Speicher im Web)
  • mobile Stammdaten-Synchronisation für Kunden, Baustellen, Aufträge, Mitarbeiterprofile und Auftragszuweisungen über die serverseitigen Push-/Pull-Endpunkte
  • atomare lokale Änderungen mit Outbox, Cursor, Retry, sichtbaren Konflikten und einer ausdrücklichen Importentscheidung bei der ersten Verbindung
  • unveränderliche Berichtsversionen mit sichtbarem Prüfverlauf
  • persistente Offline-Synchronisationswarteschlange mit Retry-Strategie
  • lokale Fotodokumentation per Kamera, Galerie oder Web-Dateiauswahl
  • gebrandete PDF-Leistungsnachweise mit Unterschrift, Fotodokumentation und vorbereitetem Teilen per E-Mail
  • prüfpflichtiger KI-Assistent für Baustellennotizen mit OpenAI, Google Gemini oder eigenem Proxy
  • Rollen: Inhaber, Büro, Bauleiter und Monteur
  • strukturierte Arbeitszeit mit Leistungsdatum, Pause und Nettozeit
  • mehrere Leistungs- und Materialpositionen
  • Zusatzaufträge mit Kundenbestätigung
  • Vollständigkeitsprüfung vor Unterschrift
  • digitale Kundenunterschrift und unveränderlicher Abschluss
  • CSV-Export und vorbereitete PDF-Renderer-Schnittstelle
  • responsive Smartphone- und Webnavigation
  • aktuelle App-Version und Build-Nummer dauerhaft am unteren Rand der Navigation

Lokale Entwicklung

flutter pub get
flutter analyze
flutter test
flutter run -d chrome

Produktkontext und technische Leitplanken stehen in [docs/PRODUCT_BRIEF.md](docs/PRODUCT_BRIEF.md). Architektur und Serververtrag der KI-Unterstützung beschreibt [docs/AI_INTEGRATION.md](docs/AI_INTEGRATION.md).

Die Stammdaten-Synchronisation ist ausschließlich für iOS und Android aktiviert. Sie verwendet das Access-Token der mobilen Anmeldung und erneuert es bei Bedarf über die bestehende Authentifizierung. Im Web bleibt die Synchronisation bewusst deaktiviert.

Backend-Grundgerüst

Das separate PHP-8.4-REST-Grundgerüst liegt in [backend/](backend/README.md). Es enthält in diesem Stand ausschließlich Infrastruktur und den Health-Endpunkt; Login, Fachlogik und KI sind noch nicht enthalten.

backend/tests/company_profile_contract.phpPHP
<?php
declare(strict_types=1);
use Machweis\Backend\Auth\TokenService;
use Machweis\Backend\CompanyProfileService;
use Machweis\Backend\Config;
use Machweis\Backend\Kernel;
use Machweis\Backend\Logger;
use Machweis\Backend\Request;
require dirname(__DIR__) . '/src/autoload.php';
function companyCheck(bool $condition, string $message): void { if (!$condition) throw new RuntimeException($message); }
function companyUuid(): string { $hex = bin2hex(random_bytes(16)); return substr($hex,0,8).'-'.substr($hex,8,4).'-4'.substr($hex,13,3).'-8'.substr($hex,17,3).'-'.substr($hex,20); }
$config = new Config('test', false, (string)getenv('DB_HOST'), (int)getenv('DB_PORT'), (string)getenv('DB_NAME'), (string)getenv('DB_USER'), (string)getenv('DB_PASSWORD'), [], true, str_repeat('company-profile-secret-', 2));
$pdo = new PDO(sprintf('mysql:host=%s;port=%d;dbname=%s;charset=utf8mb4', $config->dbHost, $config->dbPort, $config->dbName), $config->dbUser, $config->dbPassword, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, PDO::ATTR_EMULATE_PREPARES => false]);
$tenantA = companyUuid(); $tenantB = companyUuid();
$pdo->prepare('INSERT INTO tenants (id,name,status,created_at) VALUES (?, ?, ?, UTC_TIMESTAMP()), (?, ?, ?, UTC_TIMESTAMP())')->execute([$tenantA, 'Firma A', 'active', $tenantB, 'Firma B', 'active']);
$service = new CompanyProfileService($pdo);
companyCheck($service->one($tenantA)['name'] === 'Firma A', 'tenant name must be the initial profile name');
$updated = $service->update($tenantA, ['name'=>'Firma A Neu','owner'=>'Ada Admin','email'=>'office@example.test','phone'=>'+49 30 1','address'=>'Hauptstraße 1','taxNumber'=>'12/345','reportFooter'=>'Danke']);
companyCheck($updated['name'] === 'Firma A Neu' && $updated['owner'] === 'Ada Admin', 'profile must persist all normalized fields');
companyCheck($service->one($tenantB)['name'] === 'Firma B' && $service->one($tenantB)['owner'] === '', 'profile access must remain tenant isolated');
try { $service->update($tenantA, ['name'=>'', 'email'=>'invalid']); throw new RuntimeException('invalid profile accepted'); } catch (InvalidArgumentException) {}
$tokens = new TokenService($config); $kernel = new Kernel($config, new Logger('test'));
foreach (['owner','office'] as $role) {
$token = $tokens->issueAccess(['sub'=>companyUuid(),'tid'=>$tenantA,'role'=>$role]);
$response = $kernel->handle(new Request('PATCH','/api/v1/company-profile',['authorization'=>'Bearer '.$token],json_encode(['name'=>'Firma '.$role], JSON_THROW_ON_ERROR)));
companyCheck($response->status === 200, "$role must update the company profile");
}
foreach (['supervisor','technician'] as $role) {
$token = $tokens->issueAccess(['sub'=>companyUuid(),'tid'=>$tenantA,'role'=>$role]);
$read = $kernel->handle(new Request('GET','/api/v1/company-profile',['authorization'=>'Bearer '.$token]));
companyCheck($read->status === 200, "$role must read the company profile");
$write = $kernel->handle(new Request('PATCH','/api/v1/company-profile',['authorization'=>'Bearer '.$token],'{"name":"Nicht erlaubt"}'));
companyCheck($write->status === 403, "$role must not update the company profile");
}
companyCheck($service->one($tenantB)['name'] === 'Firma B', 'HTTP updates must not cross tenant boundaries');
$pdo->prepare('DELETE FROM tenant_company_profiles WHERE tenant_id IN (?, ?)')->execute([$tenantA,$tenantB]);
$pdo->prepare('DELETE FROM tenants WHERE id IN (?, ?)')->execute([$tenantA,$tenantB]);
fwrite(STDOUT, "company_profile_contract: OK\n");

Architecture

High-level modules detected from the verified public snapshot. Protected implementation details are intentionally omitted.

backendmodule
libmodule
iosmodule
testmodule
androidmodule
docsmodule
webmodule
assetsmodule

Technology stack

DartPHPLOCKPBXPROJSQLMarkdownFlutter / Dart
Dart66.7%
PHP14.5%
LOCK4.0%
PBXPROJ3.8%
SQL3.1%
Markdown1.3%
XML0.9%
YAML0.9%