The goal of this repository is to implement all the logic used to calculate the swiss taxes and serve it in a super fast service to do any kind of calculations in any kind of environment.
- Clone the repository
- yarn install (installs all the depencencies)
- yarn dev (runs the dev server)
- Nuxt 3 application with server api and static demo page (https://github.com/nuxt/nuxt)
- ./pages/index.vue shows an example page for calulcating taxes
- Live preview https://swisstaxcalculator.vercel.app/
- Inspired by https://swisstaxcalculator.estv.admin.ch/#/calculator
- ./server/api/ API routes for tax calculation and locations
- ./lib/taxes/ covers all the tax logic
- ./data/ includes all the raw and parsed data
- Income & wealth (fortune)
- (Pension) capital withdrawal
- Taxable income
- Net income
- Gross income
The speciality about the gross- and net-income types is the deductions that are made automatically based on the tax input and the possible deductions.
https://swisstaxcalculator.estv.admin.ch/#/taxdata
Some information is from https://finpension.ch/de/vergleich-kapitalbezugssteuer/ and the updated values are from the individual canton tax laws directly.
To run the service, there is no database required. All the data is either in the code files or imported from the raw data during dev / build time using the following command.
yarn importdata <year>
Raw data: ./data/raw/...
Parsed data: ./data/parsed/...
To import more tax years, just copy the raw files into the corresponding folder and run the importdata script.
The data is parsed into small chunks, mostly per canton to guarante a fast loading time and minimal memory consumption. Once loaded, the data is held in memory until the service is stopped.
In an always on environment, the data will be in memory until redeployed. This ensures maximum execution speed.
For cloud functions, the data has to be reloaded once the function was removed and reloaded into memory.
For issues and questions, please create an issue.
Please contact me ([email protected]) if you want to contribute or use this repository in your own environment or application. Thank you.