A high-performance URL shortener service built with Rust, featuring encryption, MongoDB storage, and a clean REST API.
- ⚡ High-performance Rust implementation
- 🔒 URL encryption using AES-256-GCM
- 📦 MongoDB storage with indexed lookups
- 🔄 Automatic URL deduplication
- ⏰ Optional URL expiration
- 📊 Click tracking
- 🌐 RESTful API
- Rust (latest stable)
- MongoDB (4.x or later)
- OpenSSL development libraries
git clone https://github.com/sanjaysah101/blazinglyfast-url-shortener
cd url-shortenerMONGODB_URI=mongodb://localhost:27017/
ENCRYPTION_KEY=your_base64_encoded_32_byte_keyNote: To generate a 32-byte key, you can use the following command:
openssl rand -base64 32cargo runThe server will start at http://127.0.0.1:8080
POST /api/urls
Content-Type: application/json
{
"url": "https://example.com/very/long/url",
"expires_in_days": 30 // optional
}GET /api/urlsGET /r/{short_code}- AES-256-GCM encryption for stored URLs
- Nonce-based encryption for enhanced security
- Base64-encoded encryption key support
- URL validation before storage
- Asynchronous request handling with Actix Web
- Indexed MongoDB queries for fast lookups
- Connection pooling for database operations
- Efficient in-memory encryption/decryption
Build the project:
cargo buildRun tests:
cargo testRun with logging:
RUST_LOG=debug cargo runMIT License - See LICENSE for details.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
