- Added shared styles for UI components in `src/components/styles.ts`. - Created configuration constants in `src/lib/config.ts`. - Implemented date formatting and greeting functions in `src/lib/dates.ts` and corresponding tests in `src/lib/dates.test.ts`. - Developed incident management functions in `src/lib/incidents.ts` with tests in `src/lib/incidents.test.ts`. - Established navigation structure in `src/lib/navigation.ts`. - Seeded demo data for incidents and users in `src/lib/seed.ts`. - Defined tone classes for UI elements in `src/lib/tones.ts`. - Created type definitions for incidents and related entities in `src/lib/types.ts`. - Set up main application entry point in `src/main.tsx`. - Developed various pages including About, Analytics, Incidents, Locations, Overview, and Report Incident. - Configured testing setup in `src/test/setup.ts` and TypeScript configurations. - Integrated Vite for development and testing with appropriate plugins.
2.0 KiB
Open SafetyLog EHS
Free, open-source accident and safety tracking for manufacturing: incident and near-miss reporting, investigations, corrective actions and (planned) OSHA record keeping.
Status: early prototype. The UI runs on in-memory demo data; nothing is saved yet. See docs/ROADMAP.md for the plan and docs/TODO.md for open items.
Getting started
Requires Node.js 22.12 or later (see .nvmrc).
npm install
npm run dev
Scripts
| Command | What it does |
|---|---|
npm run dev |
Start the dev server |
npm run build |
Production build to dist/ |
npm run lint |
Lint with Oxlint (warnings fail) |
npm run typecheck |
Type-check with TypeScript |
npm test |
Unit and component tests (Vitest) |
npm run test:e2e |
End-to-end tests (Playwright, desktop and mobile). Run npx playwright install chromium once first |
npm run check |
Lint, typecheck, test and build in one go |
CI runs the same checks on every push and pull request (.gitea/workflows/ci.yml).
Project layout
src/
pages/ One component per route
components/ Shared UI (layout, tables, form pieces) and shared class strings in styles.ts
lib/ Types, domain logic, demo data; no React components
index.css Tailwind import and design tokens (@theme)
e2e/ Playwright tests
docs/ Roadmap and design notes
Styling is Tailwind CSS v4. Colors, fonts and small text sizes are defined as theme tokens in src/index.css. Fonts are bundled through Fontsource, so the app makes no third-party requests and works on isolated plant networks.
Contributing
See CONTRIBUTING.md. Everyone taking part follows our Code of Conduct.
License
GNU Affero General Public License v3.0. If you run a modified version as a network service, you must offer its source code to its users. The app's About page links to the source; set VITE_SOURCE_URL at build time to point it at your fork.