mag-read is currently under construction. It allows for secure reading of PDFs by splitting each page into small, randomly sized parts. Additionally, it secures the display of these parts based on the domain where they are embedded.
Before you begin, ensure you have Docker and Docker Compose installed on your machine.
- Docker
- Docker Compose
- Node.js (required for development tasks like using
nodemon
)
-
Clone the repository:
git clone https://github.com/tobaz92/mag-read.git cd mag-read
-
Start the services: Navigate to the Docker directory and use
docker-compose
to start all services in detached mode.cd docker docker-compose up -d
-
Access the application: Open your browser and go to the following URL to access the application:
http://localhost:3000/
- /back: Contains the Node.js backend application with Express, handling routes, authentication, and document management.
- /rust: Rust project for image compression and conversion. Produces a binary that runs in the
optimizer
service. - /docker: Docker and Docker Compose files to orchestrate the various services.
- /docker/build-local.sh: Script for local Docker builds.
- /embedded: Directory for embedded resources and assets used by the application.
The project uses shared volumes to connect the Rust binary from the core
and optimizer
service with the Node.js backend, allowing seamless integration without manual copying.
The services are based on the following Docker images, available under the tobaz92/magread
repository:
- back: Node.js application for API and business logic management.
- reader: Module for document reading and display.
- core: Central component for document management. It extracts and splits the document into smaller parts and creates a JSON that allows the document to be reconstructed.
- optimizer: Service for image compression and conversion in Rust. This service runs in the background to avoid disrupting the user experience. It compresses visuals and creates image files in the WebP format.
To build the images locally, use the following script from the docker
directory:
./build-local.sh
For continuous development, use nodemon
to automatically reload the Node.js application:
npm install -g nodemon
nodemon
Here is an overview of the main routes available in the application:
Method | Route | Description |
---|---|---|
POST | /sign-up |
Register a new user |
POST | /login |
User login |
GET | /me |
Get user profile information |
POST | /document/upload |
Upload documents |
GET | /document/view/:token |
View a document by token |
DELETE | /document/:token |
Delete a document |
The application generates tokens for secure document access. Tokens are used to view and manage documents without exposing direct URLs. Additionally, domain-based blocking is implemented to restrict access to specific domains, enhancing security and control over document distribution.
- Node.js & Express for backend management
- Rust for image optimization
- Docker for containerization and service orchestration
Contributions are welcome! To contribute:
- Fork the project.
- Create a branch for your feature (
git checkout -b feature/my-feature
). - Commit your changes (
git commit -am 'Add my feature'
). - Push the branch (
git push origin feature/my-feature
). - Create a Pull Request.