Skip to content

pfederi/lohnio

Repository files navigation

Lohnio

Lohnio is a free, self-hosted web tool for monthly payroll processing of household helpers and caregivers in Switzerland. Enter the hours – Lohnio automatically calculates gross pay, deductions, and net pay, and generates a professional PDF.

Features:

  • Payroll slip as PDF (AHV/IV/EO, ALV, holiday allowance, weekend surcharge, 13th month salary)
  • Official Swiss wage certificate ESTV Form 11 – filled automatically
  • PAIN.001 XML for direct import into e-banking
  • Employees submit their own hours via a personal link – no account required
  • Annual overview and shared account (e.g. with a partner)
  • Works on smartphones (installable as an app)

Table of Contents

  1. What you need
  2. Step 1: Set up the database
  3. Step 2: Download the code
  4. Step 3: Configure the app
  5. Step 4: Start the app
  6. Running the app online
  7. For developers

1. What you need

What Purpose Link
Node.js Runs the app nodejs.org → download LTS version
Git Downloads the code git-scm.com (often pre-installed on Mac)
Database service Stores data & manages logins We recommend Supabase – the free plan is sufficient for personal use

Check if Node.js is installed: Open Terminal (Mac: Cmd+Space → type "Terminal"), then run:

node --version

If a version number appears (e.g. v20.x.x), you're ready.


2. Step 1: Set up the database

Lohnio needs a Postgres database with authentication and Row-Level Security. The complete database schema is provided in supabase/migrations/init_schema.sql.

2.1 Create a project

  1. Sign up at supabase.com and create a new project
  2. Wait until the project is ready (about 1 minute)

2.2 Apply the schema

  1. Open the SQL Editor in the Supabase dashboard
  2. Paste the entire contents of supabase/migrations/init_schema.sql
  3. Click Run – all tables, security rules, and functions are created automatically

2.3 Set the allowed redirect URL

Go to Authentication → URL Configuration and add:

http://localhost:9999
http://localhost:9999/**

2.4 Note your credentials

You will need these in the next step:

  • The Project URL (e.g. https://xxxx.supabase.co)
  • The anon / public key (found under Project Settings → API)

3. Step 2: Download the code

Open a terminal and run:

git clone https://github.com/your-username/lohnio.git
cd lohnio
npm install

npm install downloads all dependencies. This takes about 1–2 minutes.


4. Step 3: Configure the app

Copy the example configuration file:

Mac / Linux:

cp .env.local.example .env.local

Windows:

copy .env.local.example .env.local

Open .env.local in a text editor and fill in the credentials from Step 2.4:

NEXT_PUBLIC_SUPABASE_URL=https://xxxx.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key

Save the file.


5. Step 4: Start the app

npm run dev

After about 10–20 seconds you will see:

✓ Ready on http://localhost:9999

Open your browser and go to http://localhost:9999 – Lohnio is running.

On first visit, create an account (Sign up) and you're ready to go.

The app only runs while the terminal is open. For permanent access → Step 6.


6. Running the app online

For permanent access from any device, Lohnio can be deployed to any hosting provider that supports Next.js.

Recommended: Vercel – free plan, direct GitHub integration, no server configuration needed.

  1. Push the repo to GitHub
  2. Sign in at vercel.comNew Project → select your repo → Deploy
  3. Add the environment variables in the Vercel project settings (see table below)
  4. In Supabase → Authentication → URL Configuration, add your Vercel domain as an allowed URL

Environment variables:

Variable Where to find it
NEXT_PUBLIC_SUPABASE_URL Supabase → Project Settings → API
NEXT_PUBLIC_SUPABASE_ANON_KEY Supabase → Project Settings → API
SUPABASE_SERVICE_ROLE_KEY Supabase → Project Settings → API → service_role (admin page only)
NEXT_PUBLIC_ADMIN_EMAIL Your email address (admin page only)

Build and start commands (for self-hosted deployments):

npm run build
next start        # port 3000

Install as an app on your phone:

Navigate to the app URL in your browser → "Add to Home Screen".


7. For developers

Tech stack

  • Framework: Next.js 16 (App Router) + TypeScript
  • Styling: TailwindCSS v4 + Shadcn UI
  • Data & Auth: Supabase (Postgres, RLS, Realtime)
  • PDF: jsPDF (payroll slip) + pdf-lib (ESTV Form 11)

Project structure

lohnio/
├── app/                   # Next.js routes
│   ├── payroll/           # Payroll processing
│   ├── employees/         # Employee management
│   ├── yearly/            # Annual overview + wage certificate
│   ├── stunden/           # Public hour submission (no login)
│   ├── settings/          # Settings, account sharing
│   └── auth/              # Login, signup
├── lib/
│   ├── data/schema.ts     # TypeScript types
│   ├── hooks/             # React hooks
│   ├── supabase/          # DB clients (browser, server, admin)
│   └── utils/             # Calculations, PDF, PAIN.001, etc.
├── supabase/migrations/   # init_schema.sql (one-time setup)
└── public/                # ESTV wage certificate form (PDF)

Scripts

npm run dev        # Development server on port 9999
npm run build      # Production build
npm run start      # Production server on port 3000
npm run lint       # ESLint

Code guidelines

  • Early returns for readability
  • No unnecessary abstractions
  • Accessibility: skip link, ARIA, semantic HTML
  • TypeScript strict mode

License

MIT License – free to use, adapt, and extend.