48c5eaeb40cb3e358c746e4a31050cd15755b0de
Deploy to LXC / deploy (push) Successful in 36s
Adds a nullable lcsc_number column to parts so each part records its LCSC code for reordering -- surfaced as an "LCSC #" field on the add/edit forms (autofilled by the lookup) and as a click-through link to the LCSC product page on the detail view. The autofilled Name now comes from LCSC's human-readable "Key Attributes" summary (e.g. "RES 10kohm +/-1% 100mW 0603") scraped from the product page's SSR data, falling back to the manufacturer name if that scrape returns nothing. Also normalizes lowercase LCSC codes to uppercase so "c25804" resolves instead of dead-ending on a 404.
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
Languages
Svelte
64.9%
TypeScript
33.2%
Nix
1.6%
HTML
0.2%
JavaScript
0.1%