A peer-to-peer file sharing application with integrated chat functionality, allowing users to connect, communicate, and share files directly with each other.
Built with Go and Docker for seamless deployment and cross-platform compatibility.
- ๐ค User Authentication: Connect with a username and maintain persistent sessions
- ๐ฌ Real-time Chat: Send and receive messages with all connected users
- ๐ File Sharing: Transfer files directly between users
- ๐ Folder Sharing: Share entire folders with other users
- ๐ File Discovery: Look up and browse other users' shared directories
- ๐ Automatic Reconnection: Seamlessly reconnect with your existing session
- ๐ฅ Status Tracking: Monitor which users are currently online
- ๐จ Colorful UI: Enhanced CLI interface with colors and emojis
- ๐ Progress Bars: Visual feedback for file and folder transfers
- ๐ Data Integrity: MD5 checksum verification for files and folders
- Docker and Docker Compose (recommended) ๐ณ
- OR Go (1.22.3 or later) ๐ง
- Clone the repository โฌ๏ธ
git clone https://github.com/YOUR_USERNAME/FileFlow.git
cd FileFlow- Build and run with Docker Compose ๐ ๏ธ
# Start the server and example clients
docker-compose up -d
# View logs
docker-compose logs -f
# Stop all services
docker-compose down- Run individual containers ๐ฆ
# Build the Docker image
docker build -t fileflow .
# Run server
docker run -d -p 8080:8080 --name fileflow-server fileflow ./server --port 8080
# Run client (interactive mode)
docker run -it --name fileflow-client1 --link fileflow-server fileflow ./client --server fileflow-server:8080- Clone the repository โฌ๏ธ
git clone https://github.com/YOUR_USERNAME/FileFlow.git
cd FileFlow- Install dependencies ๐ฆ
go mod download- Build the application ๐ ๏ธ
# Build server
go build -o bin/server ./server/cmd/server.go
# Build client
go build -o bin/client ./client/cmd/client.go# Using Docker Compose
docker-compose up fileflow-server
# Using Docker directly
docker run -d -p 8080:8080 --name fileflow-server fileflow ./server --port 8080
# Custom port
docker run -d -p 3000:3000 --name fileflow-server fileflow ./server --port 3000# Using Docker Compose (interactive mode)
docker-compose run --rm fileflow-client1
# Using Docker directly
docker run -it --link fileflow-server --name fileflow-client \
-v $(pwd)/shared:/root/shared \
fileflow ./client --server fileflow-server:8080
# Connect to remote server
docker run -it --name fileflow-client \
-v $(pwd)/shared:/root/shared \
fileflow ./client --server 192.168.0.203:8080# Start server on default port 8080
go run ./server/cmd/server.go --port 8080
# Or use the built binary
./bin/server --port 8080
# Start server on custom port
./bin/server --port 3000# Connect to local server
go run ./client/cmd/client.go --server localhost:8080
# Or use the built binary
./bin/client --server localhost:8080
# Connect to remote server
./bin/client --server 192.168.0.203:8080The application will automatically validate:
- Server availability before client connection attempts
- Port availability before starting a server
- Existence of shared folder paths
The application follows a hybrid P2P architecture:
- ๐ A central server handles user registration, discovery, and connection brokering
โ๏ธ File and folder transfers occur directly between peers- ๐ Server maintains connection status through regular heartbeat checks
| Command | Description |
|---|---|
/help |
Show all available commands |
/status |
Show online users |
exit |
Disconnect and exit the application |
| Command | Description |
|---|---|
/lookup <userId> |
Browse user's shared files |
/sendfile <userId> <filePath> |
Send a file to another user |
/sendfolder <userId> <folderPath> |
Send a folder to another user |
/download <userId> <filename> |
Download a file from another user |
-
๐ Color-coded messages:
- Commands appear in blue
- Success messages appear in green
- Error messages appear in red
- User status notifications in yellow
-
๐ Progress bars for file transfers:
[===================================>------] 75% (1.2 MB/1.7 MB) -
๐ Improved file listings:
=== FOLDERS === ๐ [FOLDER] documents (Size: 0 bytes) ๐ [FOLDER] images (Size: 0 bytes) === FILES === ๐ [FILE] document.pdf (Size: 1024 bytes) ๐ [FILE] image.jpg (Size: 2048 bytes)
The application implements basic reconnection security by tracking IP addresses and user sessions.
- ๐ Folder Path Validation: The application verifies that shared folder paths exist before establishing a connection. If an invalid path is provided, the user will be prompted to enter a valid folder path.
- ๐ Server Availability Check: Client automatically verifies server availability before attempting connection, preventing connection errors.
- ๐ซ Port Conflict Prevention: Server detects if a port is already in use and alerts the user to choose another port.
- ๐ Checksum Verification: All file and folder transfers include MD5 checksum calculation to verify data integrity:
- When sending, a unique MD5 hash is calculated for the file/folder contents
- During transfer, the hash is securely transmitted alongside the data
- Upon receiving, a new hash is calculated from the received data
- The application compares both hashes to confirm the transfer was successful and uncorrupted
- Users receive visual confirmation of integrity checks with clear success/failure messages
This checksum process ensures that files and folders arrive exactly as they were sent, protecting against data corruption during transfer.
FileFlow uses a multi-stage Docker build for optimized image size:
- Build Stage: Compiles Go binaries with all dependencies
- Runtime Stage: Minimal Alpine Linux image with only the compiled binaries
- Network: Bridge network for container communication
- Volumes: Persistent storage for shared files
- โ Consistent environment across all platforms
- โ Easy deployment and scaling
- โ Isolated file storage per client
- โ No need to install Go locally
- โ Quick setup with docker-compose
FileFlow/
โโโ client/
โ โโโ cmd/
โ โ โโโ client.go # Client entry point
โ โโโ internal/
โ โโโ connection.go # Connection handling
โ โโโ file.go # File operations
โ โโโ folder.go # Folder operations
โ โโโ transfer.go # Transfer management
โโโ server/
โ โโโ cmd/
โ โ โโโ server.go # Server entry point
โ โโโ interfaces/
โ โ โโโ interfaces.go # Data structures
โ โโโ internal/
โ โโโ connection.go # Connection handling
โ โโโ file.go # File operations
โ โโโ folder.go # Folder operations
โโโ helper/
โ โโโ helper.go # Utility functions
โโโ utils/
โ โโโ ui.go # UI components
โโโ Dockerfile # Docker build configuration
โโโ docker-compose.yml # Multi-container setup
โโโ .dockerignore # Docker ignore rules
โโโ go.mod # Go dependencies
โโโ README.md # Documentation
Made with โค๏ธ by the FileFlow Team