Skip to content

SloMR/pastepoint

Repository files navigation

PastePoint Logo

Docker Rust Angular Nginx

PastePoint

PastePoint is a secure, feature-rich file-sharing service designed for local networks. It enables users to share files and communicate efficiently through peer-to-peer WebSocket connections. Built with a Rust-based backend using Actix Web and an Angular frontend with SSR support, PastePoint prioritizes security, performance, and usability.

⚠️ Usage Disclaimer

🌟 Features

Core Features:

  • Local Network Communication:

    • Establish WebSocket-based local chat between computers on the same network.
    • List available sessions, create new sessions, or join existing ones.
  • File Sharing:

    • Peer-to-peer WebSocket connections for sending files and text.
    • File compression for efficient transfers.
    • Optimized chunk-based file transfer with progress tracking.
  • Security:

    • SSL/TLS encryption for secure communication.
    • Self-signed certificate generation included.
  • Cross-Platform Compatibility:

    • Runs seamlessly on Linux, macOS, and Windows with Dockerized support.

Developer Experience

  • 🐳 Full Docker integration
  • πŸ“¦ Isolated microservices architecture
  • πŸ”§ Configurable environments (dev/prod)
  • βœ… Comprehensive test suites

Performance & SEO

  • πŸš€ Server-Side Rendering (SSR) for improved initial load time
  • πŸ” Complete SEO optimization with metadata, sitemap, and robots.txt
  • πŸ“¦ Response compression for faster page loads
  • 🎯 Static asset optimization with proper caching headers

πŸ› οΈ Tech Stack

Server (Rust)

Actix OpenSSL

  • Framework: Actix Web with WebSocket support
  • Security: OpenSSL for TLS termination
  • Utilities: UUID generation, Serde serialization

Clients

Web (Angular)

Angular Tailwind Flowbite

  • Rendering: Server-Side Rendering with Angular Universal
  • State Management: RxJS observables
  • Styling: Tailwind CSS with dark mode
  • I18n: ngx-translate integration

Infrastructure

Nginx Docker Express

  • Container Orchestration: Docker Compose with multi-stage builds
  • Reverse Proxy: Nginx with enhanced security features
  • SSL/TLS: Automated certificate management
  • Health Monitoring: Built-in health check endpoints
  • SSR Server: Express.js with compression middleware

Directory Structure

pastepoint/
β”œβ”€β”€ πŸ“ client/                      # Angular frontend with SSR
β”œβ”€β”€ πŸ“ server/                      # Rust backend with WebSockets
β”œβ”€β”€ πŸ“ nginx/                       # Reverse proxy & SSL termination
β”œβ”€β”€ πŸ“ scripts/                     # Development & deployment scripts
β”œβ”€β”€ docker-compose.yml              # Multi-container orchestration
β”œβ”€β”€ .nvmrc                          # Node.js version specification
β”œβ”€β”€ rust-toolchain                  # Rust toolchain specification
β”œβ”€β”€ Makefile                        # Makefile for development
└── README.md                       # Project documentation

Server (Rust):

Clients:

Web (Angular):

Deployment:

  • docker-compose.yml: Manages containers for:
    • Backend service (Rust)
    • Frontend SSR service (Angular + Express)
    • Certificate checker service
    • Nginx reverse proxy
  • scripts/generate-certs.sh: Script to generate self-signed certificates
  • scripts/configure-network.sh: Script to configure the domain name for the local network (optional)
  • nginx/nginx.conf: Main Nginx configuration
  • nginx/security_settings.conf: Security and rate limiting settings
  • nginx/security_headers.conf: Security headers configuration
  • nginx/locations.conf: Location block configurations including SEO routes
  • nginx/ssl.conf: SSL/TLS settings

πŸ”§ Development Guide

πŸš€ Quick Start

Prerequisites:

  • Docker and Docker Compose
  • Node.js (v22.14.0 as specified in .nvmrc)
  • Rust (stable, specified in rust-toolchain)

Windows-Specific Requirements:

  • Windows 10/11 with WSL2 enabled
  • Docker Desktop for Windows
  • Git Bash or PowerShell 7+ for running scripts
  • OpenSSL installed via winget install OpenSSL

Steps:

  1. Clone the repository:

    git clone https://github.com/SloMR/pastepoint.git
    cd pastepoint
  2. Generate SSL certificates (required for HTTPS):

    ./scripts/generate-certs.sh
  3. Configure for Local Network (Optional): If you want to run PastePoint on your local network instead of just localhost:

    ./scripts/configure-network.sh

    This will prompt you to enter your local IP address and update all necessary configuration files.

  4. Build and Start Services:

    make dev # or make prod
  5. Access PastePoint:

Environment Variables:

  • CERT_PATH: Path to SSL certificates (default: /etc/ssl/pastepoint)
  • SERVER_NAME: Server name for SSL (default: pastepoint.com www.pastepoint.com)
  • RUST_BUILD_MODE: Rust build mode (default: release)
  • NPM_BUILD_CONFIG: npm build configuration (default: docker)
  • SERVER_ENV: Server environment (default: production)
  • PORT: SSR server port (default: 4000)
  • HOST: SSR server host (default: 0.0.0.0)

🀝 Contributing

🚨 Troubleshooting

Common Issues:

  1. SSL Certificate Errors Run: ./scripts/generate-certs.sh

πŸ”’ Security Considerations

  • Certificate Management:

    • Replace self-signed certificates with proper SSL certificates in production
    • Keep private keys secure and never commit them to version control
  • Data Privacy:

    • All file transfers are encrypted end-to-end
    • No data is stored permanently on servers
    • Session data is cleared on server restart or leaving the session

πŸ“œ License

This project is licensed under the GPL-3.0 License. See the LICENSE file for details.

πŸ“¬ Contact

For issues or feature requests: