Skip to content

Latest commit

 

History

16 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Printer Manager

A modern web application for managing printers and tracking their usage counters. Built with Spring Boot backend and React + TypeScript + Chakra UI frontend, fully containerized with Docker.

Features

  • View all printers in a beautiful grid layout
  • Add new printers with detailed information
  • Edit existing printer information
  • Delete printers
  • Track printer counters
  • Responsive design with light/dark mode support
  • RESTful API backend
  • Fully containerized with Docker

Tech Stack

Backend

  • Java 20
  • Spring Boot 3.3.2
  • Spring Data JPA
  • MySQL 8.0
  • SNMP4J (for printer communication)
  • Spring Actuator (for monitoring)

Frontend

  • React 18
  • TypeScript
  • Chakra UI
  • Vite
  • Axios
  • React Router

DevOps

  • Docker
  • Docker Compose
  • Nginx (for serving React app)

Prerequisites

  • Docker and Docker Compose installed
  • Ports 80, 8080, and 3306 available

Quick Start with Docker

  1. Clone the repository:
git clone <repository-url>
cd printer-tool
  1. Start all services with Docker Compose:
docker-compose up -d
  1. Wait for all services to be healthy (about 1-2 minutes)

  2. Access the application:

Development Setup

Backend Development

  1. Navigate to the project root:
cd printer-tool
  1. Run with Maven:
./mvnw spring-boot:run

The backend will start on http://localhost:8080

Frontend Development

  1. Navigate to the frontend directory:
cd frontend
  1. Install dependencies:
npm install
  1. Start the development server:
npm run dev

The frontend will start on http://localhost:3000

  1. Build for production:
npm run build

API Endpoints

Printers

  • GET /api/printers - Get all printers
  • GET /api/printers/{id} - Get printer by ID
  • POST /api/printers - Create new printer
  • PUT /api/printers/{id} - Update printer
  • DELETE /api/printers/{id} - Delete printer

Counters

  • GET /api/counters - Get all counters
  • GET /api/counters/ip/{ip} - Get counters by IP
  • POST /api/counters - Create new counter

Docker Commands

Build and start services:

docker-compose up -d

Stop services:

docker-compose down

View logs:

docker-compose logs -f

Rebuild services:

docker-compose up -d --build

Remove all data (including database):

docker-compose down -v

Environment Variables

Backend

Configure in src/main/resources/application.properties:

  • Database connection settings
  • Server port
  • JPA/Hibernate settings
  • Logging levels

Frontend

Create a .env file in the frontend directory:

VITE_API_URL=http://localhost:8080/api

Database

The application uses MySQL 8.0. The database schema is automatically created and updated by Hibernate.

Default credentials:

  • Database: printer_manager
  • User: printer_user
  • Password: printer_password
  • Root password: root_password

Project Structure

printer-tool/
├── src/                          # Backend source code
│   ├── main/
│   │   ├── java/
│   │   │   └── com/example/printer_manager/
│   │   │       ├── controller/   # REST controllers
│   │   │       ├── model/        # JPA entities
│   │   │       ├── repository/   # Data repositories
│   │   │       ├── service/      # Business logic
│   │   │       └── config/       # Configuration classes
│   │   └── resources/
│   │       ├── application.properties
│   │       ├── static/
│   │       └── templates/
│   └── test/                     # Backend tests
├── frontend/                     # Frontend React app
│   ├── src/
│   │   ├── components/          # React components
│   │   ├── pages/               # Page components
│   │   ├── services/            # API services
│   │   ├── types/               # TypeScript types
│   │   ├── App.tsx
│   │   └── main.tsx
│   ├── Dockerfile
│   ├── nginx.conf
│   ├── package.json
│   └── vite.config.ts
├── Dockerfile                    # Backend Dockerfile
├── docker-compose.yml
├── pom.xml
└── README.md

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

This project is licensed under the MIT License.

Support

For issues and questions, please open an issue on GitHub.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages