π A modern web application for creating and printing custom eyewear prescription labels with a mobile-first design approach.
Here is a Demo where you can try it out: https://nicobees.github.io/freedom-label
Have a look at the AI-based auto-fill form feature π
β οΈ This requires Chrome version 140+ and the following flags to be "Enabled"chrome://flags/#prompt-api-for-gemini-nano
chrome://flags/#prompt-api-for-gemini-nano-multimodal-input
Freedom Label Β© is a comprehensive solution for eyewear prescription label management, built as a modern web application with React frontend and FastAPI backend. The application provides an intuitive interface for creating detailed prescription labels including patient information, lens specifications, and manufacturing details.
Key Features:
- π₯ Patient information management (name, surname)
- ποΈ Comprehensive lens specifications (BC, DIA, PWR, CYL, AX, ADD, SAG)
- π Manufacturing date tracking
- π¨οΈ Direct label printing via CUPS integration
- π Light/dark theme support
- π± Mobile-first responsive design (to be fixed)
- πΎ Local storage for printed labels history
- βΏ Accessibility-focused design with ARIA support
- π Internationalization ready
- π Undo/redo history in the lens form
- !!! AI !!! Auto-fill lens form using natural language prompts, with both text and voice input (uses Chrome built-in Gemini nano model)
This is a monorepo containing three main packages:
packages/
βββ frontend/ # React + TypeScript SPA
βββ backend/ # FastAPI Python application
βββ devops/ # Docker compose & deployment configs
Please check the frontend README for detailed instructions.
- Technology Stack: React 19, TypeScript, Vite, TanStack Router, TanStack Form
- Styling: Pure CSS with CSS custom properties, mobile-first approach
- Testing: Vitest, Testing Library, jsdom
- Key Features:
- Responsive design with breakpoint-aware layouts
- Theme system with CSS layers and custom properties
- Form validation using Zod schemas
- Local persistence for printed labels
- Accessible component library
Please check the backend README for detailed instructions.
- Technology Stack: FastAPI, Python, Poetry
- Key Features:
- RESTful API for label creation and printing
- CUPS printer integration
- PDF generation for label output
- Dockerized deployment
Please check the devops README for detailed instructions.
- Deployment Target: Raspberry Pi (or any Linux server)
- Container Orchestration: Docker Compose
- CI/CD: GitHub Actions with automated builds and deployments
- Monitoring: System service integration with auto-restart capabilities
- Node.js 18+ and npm
- Python 3.11+ and Poetry
- Docker and Docker Compose
-
Clone the repository:
git clone https://github.com/nicobees/freedom-label.git cd freedom-label -
Start the backend:
cd packages/backend poetry install poetry run uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload -
Start the frontend:
cd packages/frontend npm install npm run dev -
Access the application:
- Frontend: http://localhost:5173
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
Run both services using Docker Compose:
cd packages/devops
docker-compose up -d- Navigate to Create Label: Click "Create Label" from the homepage
- Fill Patient Information: Enter patient name and surname
- Configure Lens Specifications:
- Enable left/right eye as needed
- Set values for BC, DIA, PWR, CYL, AX, ADD, SAG
- Use copy actions to mirror values between eyes
- Set Manufacturing Details: Add description and date
- Print: Click the print button to generate and print the label
Toggle between light and dark themes using the βοΈ/π button in the header.
The application includes:
- Dirty state detection for unsaved changes
- Undo/redo functionality for form edits
- Auto-save to local storage for recovery
Please check the devops README for detailed instructions.
Set up deployment variables in packages/devops/.env:
# Docker image versions
BACKEND_VERSION=b-0.0.4
FRONTEND_VERSION=f-0.0.6
# Container registry
GITHUB_USERNAME=your-username
GITHUB_REPOSITORY_NAME=freedom-label
GITHUB_IMAGE_BACKEND=freedom-label-backend
GITHUB_IMAGE_FRONTEND=freedom-label-frontend
# Deployment target
RPI_HOST=your-raspberry-pi-ip
RPI_USERNAME=your-usernamePlease check the Raspberry Pi Configuration for detailed instructions.
-
Prepare the Raspberry Pi:
# Install Docker curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh # Enable user lingering for auto-start sudo loginctl enable-linger $USER
-
Clone and configure:
git clone https://github.com/nicobees/freedom-label.git cd freedom-label/packages/devops cp .env.example .env # Edit .env with your configuration
-
Set up systemd service:
sudo cp freedom-label.service /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl enable freedom-label.service sudo systemctl start freedom-label.service -
Deploy using CI/CD:
- Push to the main branch triggers automatic deployment
- Or manually run deployment scripts in
packages/devops/scripts/
Use the provided scripts for manual updates:
cd packages/devops/scripts
./pull-images.sh --b "0.0.4" --f "0.0.6"
./deploy.sh --b "0.0.4" --f "0.0.6"cd packages/frontend
npm test # Run all tests
npm run test:coverage # Run with coverage report
npm run test:ui # Interactive test UIcd packages/backend
poetry run pytest # Run all tests
poetry run pytest --cov # Run with coverage- Frontend: ESLint + Prettier with TypeScript strict mode
- Backend: Black + isort + mypy for Python
- CSS: Pure CSS with BEM-inspired naming, mobile-first approach
- Testing: Comprehensive unit tests with Testing Library patterns
- Mobile-first responsive design
- Accessibility as a core requirement
- Progressive enhancement
- Clean separation of concerns
- Comprehensive error handling
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- List view of printed labels with search/filter
- Undo/redo feature in form editing
- Firebase backend for cloud storage and sync
- Fully automated release process (using GitHub Actions and Raspberry Pi Connect service)
