bb125396f27268067616bb9703ee36dd43e6d522
Deploy to LXC / deploy (push) Successful in 20s
Set @page margins to top:0 right:0.5mm bottom:0 left:2mm matching the working configuration found for DK-11209 labels. Updated setup hint text on all print pages. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
buildfor_life_repair
Inventory and repair tracking system for vintage computers and audio equipment. Built with SvelteKit, PostgreSQL, and Tailwind CSS.
Features
- Device tracking — computers, audio equipment, peripherals with full specs, images, documents
- Component tracking — individual parts (BlueSCSI, RAM, logic boards, etc.) linked to devices
- Installation log — full history of component installs/removals with timestamps
- Operation/repair log — per-device repair, inspection, cleaning, modification history
- QR code labels — printable labels for devices and components, scannable for quick lookup
- Global search — find devices/components by ID, name, or scanned QR code
- Dark mode — follows system preference or manual toggle
Prerequisites
- Node.js 18+
- PostgreSQL 14+ (or Docker)
Setup
1. Install dependencies
npm install
2. Set up the database
Option A: Use your own PostgreSQL instance
CREATE USER bflr WITH PASSWORD 'bflr_dev';
CREATE DATABASE buildfor_life_repair OWNER bflr;
\c buildfor_life_repair
GRANT ALL PRIVILEGES ON DATABASE buildfor_life_repair TO bflr;
GRANT ALL ON SCHEMA public TO bflr;
Option B: Use Docker
docker compose up -d
3. Configure environment
Copy the example env file and edit as needed:
cp .env.example .env
Edit .env with your database connection string:
DATABASE_URL=postgresql://bflr:bflr_dev@localhost:5432/buildfor_life_repair
UPLOAD_DIR=static/uploads
BASE_URL=http://localhost:5173
4. Run database migrations
Push the schema to your database:
npm run db:push
Or generate and run migrations:
npm run db:generate
npm run db:migrate
5. Start the dev server
npm run dev
The app will be available at http://localhost:5173.
Database commands
| Command | Description |
|---|---|
npm run db:push |
Push schema changes directly to the database |
npm run db:generate |
Generate SQL migration files from schema changes |
npm run db:migrate |
Run pending migrations |
npm run db:studio |
Open Drizzle Studio (visual database browser) |
Build for production
npm run build
npm run preview
NixOS
This project includes a Nix flake with a dev shell, package, and NixOS module.
Development shell
nix develop
npm install
npm run dev
Or with direnv (.envrc is included):
direnv allow
npm install
npm run dev
Build with Nix
nix build
NixOS module (deploy as a service)
Add this flake to your NixOS configuration inputs, then:
# flake.nix
{
inputs.buildfor-life-repair.url = "git+https://git.b4l.co.th/B4L/buildfor_life_repair.git";
}
# configuration.nix
{ inputs, ... }:
{
imports = [ inputs.buildfor-life-repair.nixosModules.default ];
services.buildfor-life-repair = {
enable = true;
port = 3000;
databaseUrl = "postgresql://bflr:password@localhost:5432/buildfor_life_repair";
baseUrl = "https://repair.example.com";
openFirewall = true;
};
}
Or use an environment file for secrets:
services.buildfor-life-repair = {
enable = true;
port = 3000;
environmentFile = "/run/secrets/bflr-env"; # contains DATABASE_URL=...
baseUrl = "https://repair.example.com";
};
The module creates a systemd service with:
- Dedicated
bflruser/group - Upload directory at
/var/lib/buildfor-life-repair/uploads - Systemd hardening (NoNewPrivileges, ProtectSystem, PrivateTmp)
- Auto-restart on failure
- Optional firewall rule
Tech stack
- Frontend: SvelteKit 5, Svelte 5 (runes), Tailwind CSS v4
- Backend: SvelteKit server, Drizzle ORM, PostgreSQL
- Validation: Zod
- Other: sharp (image thumbnails), qrcode (QR generation), date-fns
Description
Languages
Svelte
64.8%
TypeScript
33.1%
Nix
1.8%
HTML
0.2%
JavaScript
0.1%