Pocket is a comprehensive, enterprise-grade secure credential and password management platform designed for both individual users. It provides local persistence with remote synchronization capabilities, ensuring your sensitive data is always encrypted, accessible, and synchronized across all your devices.
- π Overview
- β¨ Key Features
- ποΈ Architecture
- π§ System Components
- π Requirements
- π Quick Start
- οΏ½ Installation
- βοΈ Configuration
- π Usage
- π Security
- π’ Deployment
- π Monitoring & Maintenance
- π Troubleshooting
- π€ Contributing
- π License
- π Related Projects
- π Support
Pocket is a full-stack security platform that combines multiple technologies to deliver a robust, scalable, and highly secure credential management solution:
- Backend Services: Built with Java 21 and Spring Boot 4 for enterprise-grade reliability
- Web Interface: High-performance Rust-based web server using Actix Web
- Native Library: C++ core library for maximum performance and cross-platform compatibility
- Multiple Clients: Support for web browsers, iOS devices, and command-line interfaces
- Containerized Deployment: Full Docker and Podman support for easy deployment and scaling
The platform is designed with security as the primary concern, implementing end-to-end encryption, secure session management, advanced rate limiting, and protection against common web vulnerabilities.
- End-to-End Encryption: RSA + AES-CBC hybrid encryption for maximum security
- Cryptographically Secure Sessions: SHA256-based session ID generation with multiple entropy sources
- Advanced Rate Limiting: Protection against brute force, DoS, and credential stuffing attacks
- Spring Security Integration: Industry-standard authentication and authorization
- No Plaintext Storage: All credentials encrypted at rest and in transit
- Multi-Language Architecture: Java for business logic, Rust for web serving, C++ for core operations
- Connection Pooling: Optimized database connections for high throughput
- Efficient Resource Management: Thread-safe architecture with automatic cleanup
- Horizontal Scaling: Container-based deployment supports load balancing
- Caching Strategies: Smart caching for frequently accessed data
- Web Application: Modern responsive web interface
- iOS Application: Native iOS client for iPhone and iPad
- CLI Tools: Command-line utilities for automation and administration
- Container Support: Docker and Podman for deployment flexibility
- Multiple Databases: MySQL, MariaDB support
- Health Monitoring: Built-in health checks and status endpoints
- Comprehensive Logging: Detailed application and access logs
- Metrics & Analytics: Spring Boot Actuator integration
- Backup & Recovery: Automated backup capabilities
- User Management: Advanced user and device management tools
- Session Management: Configurable session timeouts and policies
- Multi-Device Sync: Keep credentials synchronized across all devices
- Conflict Resolution: Intelligent handling of concurrent updates
- Offline Support: Local caching with automatic sync when online
- Version Control: Track changes to credential data
Pocket follows a modern multi-tier architecture designed for security, performance, and maintainability:
ββββββββββββββββ
β Web App β
β (Browser) β
ββββββββ¬ββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββ ββββββββββββββββ
β Pocket Web Backend (Rust) β β iOS Client β
β β’ Rate Limiting β β (Native) β
β β’ Session Management β β β
β β’ Static File Serving β β β
β β’ CORS & Security Headers β β β
β β’ C++ Bridge Interface β β β
β Port: 8080 β β β
βββββββββββββββββββ¬βββββββββββββββ ββββββββββ¬ββββββ
β β
ββββββββββββββββ¬ββββββββββββββββββββ
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββ
β Pocket Lib (C++ Core Library) β
β β’ Cryptographic Operations (RSA/AES) β
β β’ Performance-Critical Code β
β β’ User/Field/Group Models β
β β’ Business Logic Bridge β
β β’ Cross-Platform Support β
ββββββββββββββββββββββ¬ββββββββββββββββββββββββ
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββ
β Pocket Backend (Java/Spring Boot) β
β β’ REST API Endpoints β
β β’ Authentication & Authorization β
β β’ Data Persistence β
β β’ Session Validation β
β β’ User/Field/Group Management β
β Port: 8081 β
ββββββββββββββββββββββ¬ββββββββββββββββββββββββ
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββ
β Database Layer (MariaDB) β
β β’ User Data β
β β’ Encrypted Credentials β
β β’ Session Store β
β β’ Audit Logs β
β Port: 3306 β
ββββββββββββββββββββββββββββββββββββββββββββββ
- Web App β Web Backend: Browser clients connect to Rust server (port 8080) for web interface
- iOS Client β Pocket Lib: iOS native app communicates directly with C++ library
- Web Backend β Pocket Lib: Rust server invokes C++ library via bridge interface
- Rate Limiting & Security: Web backend applies rate limits, session validation, and security headers
- C++ Library Processing: Pocket Lib handles:
- Cryptographic operations (RSA, AES-CBC encryption/decryption)
- Data validation and business logic
- User/Field/Group model management
- Cross-platform compatibility layer
- Backend Communication: Pocket Lib communicates with Java backend via REST APIs (port 8081)
- Business Logic: Spring Boot services handle:
- Authentication and authorization
- Data persistence and retrieval
- Session management and validation
- Database Operations: Encrypted data persisted to MariaDB (port 3306)
- Response Chain: Data flows back through Pocket Lib β Client (Web Backend or iOS)
Location: pocket-backend/
The core business logic layer built with Spring Boot 4 and Java 21.
Key Technologies:
- Spring Boot 4
- Spring Security
- Spring Data JPA
- MariaDB Connector
- Jackson (JSON)
- Java 21 LTS
Features:
- RESTful API endpoints
- User authentication and authorization
- Field and group management
- Session management
- Data encryption/decryption
- Health monitoring endpoints
- Actuator for metrics
Default Port: 8081
Location: pocket-web-backend/
High-performance web server and reverse proxy built with Rust and Actix Web.
Key Technologies:
- Rust 1.70+ (2024 edition)
- Actix Web 4
- Actix CORS
- Async/Await
- Tokio Runtime
Features:
- Advanced rate limiting (IP + session-based)
- Cryptographically secure session ID generation
- Static file serving
- CORS configuration
- Request/response logging
- Multi-threaded architecture
- Zero-copy static file serving
Default Port: 8080
Location: pocket-web-backend/bridge/pocket-lib/
Core C++ library providing performance-critical operations and cross-platform compatibility.
Key Technologies:
- Modern C++ (C++17/20)
- CMake build system
- nlohmann/json
- TinyXML2
Features:
- High-performance cryptographic operations
- Data structure management
- Cross-platform compatibility
- Thread-safe implementations
- Easy integration via CMake
Container: pocket-db
Persistent storage for all application data.
Configuration:
- Database: pocket5
- Character Set: utf8mb4
- Collation: utf8mb4_unicode_ci
- InnoDB Engine
- Connection Pool: 200 max connections
Default Port: 3306
- Java Development Kit (JDK): 21+ (LTS recommended)
- Maven: 3.8+ for dependency management
- IDE: IntelliJ IDEA, Eclipse, or VS Code with Java extensions
- Rust: 1.70 or later (2024 edition)
- Cargo: Latest version (included with Rust)
- CMake: 3.15+ for building C++ bridge
- Clang: For C++ binding generation
- Compiler: GCC 9+ or Clang 10+
- CMake: 3.15+
- Build Tools: make, pkg-config
- Libraries: OpenSSL, libcurl, sqlite3
- Container Runtime: Docker 24.0+ OR Podman 4.0+
- Docker Compose: 2.0+ (or podman-compose)
- Database: MariaDB 10.6+ or MySQL 8.0+
- CPU: 2+ cores (4+ recommended)
- RAM: 4GB minimum (8GB recommended)
- Storage: 20GB+ available disk space
- Network: Open ports 8080, 8081, 3306
- Linux: Ubuntu 20.04+, Debian 12+, RHEL 8+, Fedora 35+
- macOS: 11+ (Big Sur or later)
- Windows: 10+ with WSL2 for Docker/Podman
- Nginx: For reverse proxy and SSL termination
- Prometheus: For metrics collection
- Grafana: For metrics visualization
- ELK Stack: For centralized logging
The fastest way to get Pocket up and running is using the automated setup script:
git clone --recursive https://github.com/passy1977/pocket.git
cd pocketImportant: Use --recursive to include all submodules (pocket-backend, pocket-web-backend, pocket-lib, pocket-web-frontend).
# Make the setup script executable
chmod +x setup_environment.sh
# Run the interactive configuration wizard
./setup_environment.shThe setup script is interactive and will ask you configuration questions:
- π Container Runtime: Docker or Podman detection
- π Security Settings: Generate or provide encryption keys and passwords
- π Network Configuration: Host, ports, and CORS settings
- π Storage Options: Docker volumes configuration
The script will automatically:
- β Generate secure passwords and encryption keys (AES_CBC_IV, admin password)
- β
Create environment configuration (
.envfile) - β Set up Docker volumes and network
- β
Generate management scripts (
start_pocket.sh,stop_pocket.sh,clean_pocket.sh,clean_images.sh)
After setup completes, start all services:
./start_pocket.shThis will:
- ποΈ Build Docker images for all components
- ποΈ Start MariaDB database
- β Start Pocket Backend (Java/Spring Boot)
- π¦ Start Pocket Web Backend (Rust/Actix)
- π οΈ Install CLI management tools
- β Perform health checks
# Check running containers
docker ps
# or
podman ps
# Check backend health
curl http://localhost:8081/actuator/health
# Check web backend health
curl http://localhost:8080/health
# Access the web application
# Open your browser and navigate to:
http://localhost:8080Default credentials (change immediately after first login):
- Username: admin
- Password: (generated during setup, check .env file)
For manual installation or custom deployment scenarios:
cd pocket-backend
# Configure environment
export DB_USERNAME="pocket_user"
export DB_PASSWORD="your_secure_password"
export AES_CBC_IV="your_16_char_iv_" # Exactly 16 characters
export ADMIN_USER="admin"
export ADMIN_PASSWD="your_admin_password"
# Build with Maven
mvn clean package -DskipTests
# Run locally
java -jar target/pocket-backend-5.0.0.jarcd pocket-web-backend
# Update submodules
git submodule update --init --recursive
# Build the project
cargo build --release
# Run locally
POCKET_HOST=0.0.0.0 \
POCKET_PORT=8080 \
POCKET_MAX_THREADS=4 \
POCKET_SESSION_EXPIRATION=300 \
./target/release/pocket-web-backendcd pocket-web-backend/bridge/pocket-lib
# Create build directory
mkdir build && cd build
# Configure with CMake
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTS=OFF
# Build
make -j$(nproc)
# Install
sudo make install# Build backend
docker build -t pocket-backend:5.0.0 ./pocket-backend
# Build web backend
docker build -t pocket-web-backend:5.0.0 ./pocket-web-backend
# Or use Podman
podman build -t pocket-backend:5.0.0 ./pocket-backend
podman build -t pocket-web-backend:5.0.0 ./pocket-web-backend# Build all services
docker compose build
# Or with Podman
podman-compose buildThe .env file is automatically generated by setup_environment.sh. For manual configuration, create a .env file in the project root:
# ===========================================
# POCKET FULL STACK CONFIGURATION
# ===========================================
# Generated on: <timestamp>
# Container Runtime: docker | podman
# ===========================================
# DATABASE CONFIGURATION
# ===========================================
DB_ROOT_PASSWORD=your_secure_root_password_here
DB_USERNAME=pocket_user
DB_PASSWORD=your_secure_user_password_here
# ===========================================
# BACKEND CONFIGURATION
# ===========================================
# Security Configuration
AES_CBC_IV=your_16_char_iv_ # CRITICAL: Exactly 16 characters
ADMIN_USER=admin@example.com
ADMIN_PASSWD=your_secure_admin_password_here
# Server Configuration
SERVER_URL=http://localhost:8081
SERVER_PORT=8081
CORS_ADDITIONAL_ORIGINS=
CORS_ENABLE_STRICT=false
CORS_HEADER_TOKEN=X-Requested-With
# JVM Configuration
JVM_MAX_MEMORY=512m
JVM_MIN_MEMORY=256m
# ===========================================
# WEB APP CONFIGURATION
# ===========================================
POCKET_HOST=0.0.0.0
POCKET_PORT=8080
BACKEND_URL=http://pocket-backend:8081
POCKET_MAX_THREADS=4
POCKET_SESSION_EXPIRATION=300
CORS_ALLOWED_ORIGINS=http://localhost:8080
POCKET_ENABLE_LOGS=0 # 1 to enable logs in release builds
# ===========================================
# GENERAL CONFIGURATION
# ===========================================
LOG_LEVEL=INFO
# ===========================================
# INTERNAL CONFIGURATION (DO NOT MODIFY)
# ===========================================
COMPOSE_PROJECT_NAME=pocket
NETWORK_NAME=pocket-network
VOLUMES_PATH=./docker-volumesNote: The setup_environment.sh script will generate secure random values for all passwords and keys automatically.
Edit docker-volumes/pocket5-config.yaml:
database:
host: pocket-db
port: 3306
name: pocket5
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
pool:
maxSize: 20
minIdle: 5
connectionTimeout: 30000The web backend includes built-in rate limiting. To customize, edit the Rust source:
File: pocket-web-backend/src/services/rate_limiter.rs
// Critical endpoints
("/v5/pocket/login", RateLimit::new(5, 300)), // 5 per 5 minutes
("/v5/pocket/registration", RateLimit::new(3, 3600)), // 3 per hour
("/v5/pocket/change_passwd", RateLimit::new(3, 3600)), // 3 per hour
("/v5/pocket/heartbeat", RateLimit::new(6, 60)), // 6 per minuteConfigure allowed origins in the .env file:
# Development (allow all)
CORS_ALLOWED_ORIGINS=*
# Production (specific domains)
CORS_ALLOWED_ORIGINS=https://app.example.com,https://www.example.com- Open Browser: Navigate to
http://localhost:8080 - Login: Use your admin credentials
- Create Fields: Store credentials, passwords, notes
- Create Groups: Organize fields into logical groups
- Sync: Data automatically syncs across devices
The installation includes two command-line tools:
# List all users
pocket-user list
# Create a new user
pocket-user create --username john --email john@example.com
# Delete a user
pocket-user delete --username john
# Change user password
pocket-user passwd --username john# List all devices
pocket-device list
# Register a new device
pocket-device register --name "iPhone" --user john
# Revoke device access
pocket-device revoke --device-id abc123
# List devices for user
pocket-device list --user john# Login
curl -X POST http://localhost:8080/v5/pocket/login \
-H "Content-Type: application/json" \
-d '{
"username": "admin",
"password": "your_password"
}'# Create a new credential field
curl -X POST http://localhost:8080/v5/pocket/field \
-H "Content-Type: application/json" \
-H "Session-ID: your_session_id" \
-d '{
"name": "Gmail",
"username": "user@example.com",
"password": "encrypted_password",
"url": "https://gmail.com"
}'# Retrieve all user data
curl -X POST http://localhost:8080/v5/pocket/home \
-H "Content-Type: application/json" \
-H "Session-ID: your_session_id" \
-d '{
"sessionId": "your_session_id"
}'See the full API documentation in the individual component READMEs.
At Rest:
- All credentials encrypted with AES-256-CBC
- User passwords hashed with bcrypt
- Encryption keys never stored in plaintext
In Transit:
- HTTPS/TLS 1.3 for all communications
- Perfect Forward Secrecy (PFS)
- Strong cipher suites only
- Cryptographically secure session IDs (SHA256)
- Multiple entropy sources (timestamp, PID, system random)
- Configurable session timeouts
- Automatic session cleanup
Protection against various attacks:
| Endpoint | Limit | Window | Purpose |
|---|---|---|---|
| Login | 5 requests | 5 minutes | Prevent brute force |
| Registration | 3 requests | 1 hour | Prevent abuse |
| Password Change | 3 requests | 1 hour | Account protection |
| General API | 1000 requests | 1 hour | DoS prevention |
- Change Default Credentials: Immediately after installation
- Use Strong Passwords: Minimum 12 characters with complexity
- Enable HTTPS: Use SSL/TLS certificates in production
- Regular Updates: Keep all components up to date
- Firewall Rules: Restrict access to necessary ports only
- Backup Encryption: Encrypt database backups
- Audit Logs: Regularly review access logs
- Two-Factor Authentication: Coming in future release
# 1. Configure production environment
cp .env.example .env.production
nano .env.production
# 2. Build production images
docker compose -f compose.yaml build
# 3. Start services
docker compose -f compose.yaml up -d
# 4. Verify deployment
docker compose ps
docker compose logs -fCreate /etc/nginx/sites-available/pocket:
upstream pocket_backend {
server localhost:8080;
}
server {
listen 80;
server_name pocket.example.com;
# Redirect HTTP to HTTPS
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
server_name pocket.example.com;
# SSL Configuration
ssl_certificate /etc/ssl/certs/pocket.crt;
ssl_certificate_key /etc/ssl/private/pocket.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
# Security Headers
add_header Strict-Transport-Security "max-age=31536000" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
location / {
proxy_pass http://pocket_backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}Enable and restart:
sudo ln -s /etc/nginx/sites-available/pocket /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginxExample Kubernetes manifests are available in the k8s/ directory (coming soon).
# Backend health
curl http://localhost:8081/actuator/health
# Web backend health
curl http://localhost:8080/health
# Database health
docker exec pocket-db mysqladmin ping -h localhost# All services
docker compose logs -f
# Specific service
docker compose logs -f pocket-backend
docker compose logs -f pocket-web-backend
# Application logs
tail -f docker-volumes/pocket-logs/application.log
tail -f docker-volumes/pocket-web-logs/application.log# Database backup
docker exec pocket-db mysqldump \
-u root -p${DB_ROOT_PASSWORD} \
pocket5 > backup-$(date +%Y%m%d).sql
# Volume backup
docker run --rm \
-v pocket-db-data:/data \
-v $(pwd)/backups:/backup \
ubuntu tar czf /backup/db-$(date +%Y%m%d).tar.gz /data# Restore database
docker exec -i pocket-db mysql \
-u root -p${DB_ROOT_PASSWORD} \
pocket5 < backup-20260321.sql
# Restore volume
docker run --rm \
-v pocket-db-data:/data \
-v $(pwd)/backups:/backup \
ubuntu tar xzf /backup/db-20260321.tar.gz -C /Access Spring Boot Actuator metrics:
# General metrics
curl http://localhost:8081/actuator/metrics
# JVM memory
curl http://localhost:8081/actuator/metrics/jvm.memory.used
# HTTP requests
curl http://localhost:8081/actuator/metrics/http.server.requestsProblem: Container exits immediately after starting
Solution:
# Check logs
docker compose logs pocket-backend
# Verify environment variables
docker compose config
# Check database connectivity
docker compose exec pocket-backend ping pocket-dbProblem: Backend can't connect to database
Solution:
# Verify database is running
docker compose ps pocket-db
# Check database logs
docker compose logs pocket-db
# Test connection
docker compose exec pocket-backend \
mysql -h pocket-db -u pocket_user -pProblem: Cannot bind to port 8080 or 8081
Solution:
# Find process using port
sudo lsof -i :8080
sudo lsof -i :8081
# Change port in .env file
POCKET_PORT=8090
SERVER_PORT=8091
# Restart services
docker compose down
docker compose up -dProblem: Getting 429 Too Many Requests errors
Solution:
- Wait for the rate limit window to expire
- Check your IP address isn't triggering limits incorrectly
- Adjust rate limits in source code if needed for your use case
Problem: Frequent session expiration
Solution:
# Increase session timeout in .env
POCKET_SESSION_EXPIRATION=900 # 15 minutes
# Restart web backend
docker compose restart pocket-web-backendEnable debug logging:
# In .env file
LOG_LEVEL=DEBUG
# Restart services
docker compose restart# Stop all services
./stop_pocket.sh
# Clean images
./clean_images.sh
# Full cleanup (removes all data!)
./clean_pocket.sh
# Start fresh
./setup_environment.sh
./start_pocket.shContributions are welcome! Please follow these guidelines:
- Fork the Repository: Create your own fork on GitHub
- Create a Branch:
git checkout -b feature/your-feature-name - Make Changes: Follow coding standards and add tests
- Commit: Use clear, descriptive commit messages
- Push:
git push origin feature/your-feature-name - Pull Request: Submit a PR with a detailed description
- Java: Follow Google Java Style Guide
- Rust: Use
cargo fmtandcargo clippy - C++: Follow Modern C++ guidelines
- Documentation: Update README files for any changes
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
The Pocket ecosystem consists of multiple components and client applications:
- Pocket Backend - Java/Spring Boot backend service providing REST APIs, authentication, and business logic
- Pocket Web Backend - Rust/Actix web server with rate limiting and session management
- Pocket Lib - C++ core library for performance-critical operations and cryptography
- Pocket Web Frontend - Modern web interface for browser-based access
- Pocket iOS - Native iOS application for iPhone and iPad
- Pocket CLI - Command-line tools for user and device management
- nlohmann/json - Modern C++ JSON library
- TinyXML2 - Lightweight XML parser
- Google Test - C++ testing framework
For questions, issues, or feature requests:
- Issues: Open an issue on the appropriate repository
- Documentation: Check component-specific README files
- Security: Report security vulnerabilities privately
Made with β€οΈ for secure credential management