This is a simple frontend for CutSolver, my solver backend for ideal stock cutting lengths.
This tool can be used to solve the common problem of finding the perfect placement of cuts for specified lengths. It seems like no other free service tackles this specific problem in an easy-to-use format, so this is my attempt.
You are very welcome to share how you use this tool!
This Solver is using integers exclusively, as there is no need for arbitrary precision (yet). Feel free to shift your numbers a few decimals if you need fractions. It has no concept of units, so you can use whatever you want.
Nerd talk: This is the 2D "Cutting Stock Problem", which is NP-hard. It can be reduced to the Bin-Packing-Problem ( BPP). No efficient algorithm exists to calculate a perfect solution in an acceptable timeframe, therefore brute force (perfect solution) is used for small jobs (<10 entries) and FFD (fast solution) for larger ones. When multiple solutions yield equal total trimmings, the solver breaks ties deterministically to favor larger, reusable scrap pieces over fragmented cut-offs.
It's also my first vue project, you should keep looking for better references.
Use the provided service at https://cutsolver.modisch.me, host this service yourself if you want to waste an hour of your time.
Enter the length of your stock, enter the assumed width of your cutting device (e.g. hacksaw with 3mm) and enter the number and length that you desire.
-
Copy environment template
cp .env.example .env
-
Edit
.envwith your values:DOMAIN_NAME=cutsolver.modisch.me EMAIL_ADDRESS=your-email@example.com -
Start containers
docker compose -f docker-compose.prod.yml up -d
-
Reload Caddy
docker exec caddy caddy reload
Ports 80/443 must be available on the host.
Remember to host a backend instance for yourself!
Set the backend path by adding a VUE_APP_BACKEND_SOLVER_URL to your environment or compose file.
See docker compose for details.
Note on backend URL substitution & routing:
- In the Docker image,
entrypoint.shrunsenvsubstto replace the literal string$VUE_APP_BACKEND_SOLVER_URLin the compiled JS bundle (/usr/share/nginx/html/js/app.*.js) before starting Nginx.- In
src/App.vue, trailing slashes are automatically sanitized (cleanBaseUrl = this.solverUrl.replace(/\/+$/, '')) so API routes (e.g./solve) resolve cleanly regardless of whether the environment variable has a trailing slash.
Start that file with docker-compose up [-d] and have fun!
Feel free to contact me or make a pull-request if you want to participate. Do look through open issues, you might see one you can help with.
- Update
versionin bothpackage.jsonandpackage-lock.json. - Commit your changes and tag manually:
git tag vX.Y.Z git push origin main git push origin vX.Y.Z
GitHub Actions CI will automatically run unit tests, compile the Vue SPA bundle, and build/publish multi-arch Docker images (linux/amd64,linux/arm64) to Docker Hub (modischfabrications/cutsolver_frontend:<VERSION>) and GHCR. Note: 32-bit ARM (linux/arm/v7) is retired.
I assume you know what you are doing if you want to develop and install it manually.
Here are some hints for you if you need some help regardless:
- Initial setup:
npm install - Compiles and hot-reloads for development::
npm run serve - Compiles and minifies for production:
npm run build - Run Linter:
npm run lint - Run Tests:
npm run test:unit
Update all dependencies completely with vue upgrade && npm install whenever possible, webdev is perpetually broken.
npm outdated in combination with npm install TODO@latest can be used to migrate to new major versions.
Make sure to test before committing any updates!
Prebuilt multi-arch images (linux/amd64,linux/arm64) are built and published automatically to Docker Hub and GHCR upon pushing a release tag.
For local production container builds:
docker build -t modischfabrications/cutsolver_frontend:local .Everything should be handled by Docker and/or NPM.
This project uses:
- Vue (2): web framework
- Vue Bootstrap: style
- VueShowdown: markdown parsing
- Eslint: linting and code-formatting
- Jest: testing
