A production-ready serverless file sharing solution built on AWS, featuring enterprise-grade security with Cognito authentication, RESTful API design, and automatic email notifications.
- 🔒 Secure Authentication: JWT-based authentication via AWS Cognito
- 📁 File Management: Upload, list, delete, and share files up to 10MB
- 📧 Email Notifications: Automatic email delivery with time-limited download links
- 🏗️ Serverless Architecture: Zero infrastructure management with automatic scaling
- 💰 Cost-Effective: Pay only for what you use with AWS Lambda
- 🔗 RESTful API: Clean, intuitive API design with comprehensive documentation
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
│ Client │────▶│ API Gateway │────▶│ Lambda │
└─────────────┘ └──────────────┘ └─────────────┘
│ │
▼ ▼
┌──────────────┐ ┌─────────────┐
│ Cognito │ │ DynamoDB │
└──────────────┘ └─────────────┘
│
▼
┌─────────────┐
│ S3 │
└─────────────┘
│
▼
┌─────────────┐
│ SES │
└─────────────┘
- AWS Account with appropriate permissions
- CognitoApi installed and configured
- Python 3.8+ for local development
- AWS CLI configured
-
Clone the repository
git clone https://github.com/TocConsulting/small-file-sharing.git cd small-file-sharing -
Deploy CognitoApi (if not already done)
# Follow the CognitoApi installation guide # https://github.com/TocConsulting/cognito-api#installation
-
Create AWS Resources
Use our automated setup script or follow the manual steps:
# Coming soon: Terraform/CloudFormation templatesManual Setup:
- S3 Bucket:
your-file-sharing-bucket-name - DynamoDB Table:
your-files-table(partition key:file_id) - Lambda Functions: Deploy all 4 functions from
/endpoints - API Gateway: Configure routes as specified below
- S3 Bucket:
All endpoints require:
x-api-keyheaderAuthorization: Bearer {IdToken}header
POST /v1/users/{user_id}/files
Content-Type: application/json
{
"file_data": "base64_encoded_data",
"remote_file_name": "document.pdf"
}GET /v1/users/{user_id}/filesDELETE /v1/users/{user_id}/files/{file_id}POST /v1/users/{user_id}/files/{file_id}/share
Content-Type: application/json
{
"share_with": ["email1@example.com", "email2@example.com"]
}small-file-sharing/
├── endpoints/
│ ├── upload-file/
│ ├── get-user-files/
│ ├── delete-user-file/
│ └── share-file/
├── postman/
└── README.md
Import the Postman collection from /postman directory and configure:
API_BASE_URL: Your API Gateway URLAPI_KEY: Your generated API keyIdToken: From CognitoApi authentication
- JWT validation on every request
- User isolation (users can only access their own files)
- Time-limited presigned URLs (1 hour expiry)
- API key requirement for additional security
- Input validation using JSON schemas
- Infrastructure as Code templates (Terraform/CloudFormation)
- Support for larger files
- File encryption at rest
- File sharing permissions management
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
Tarek CHEIKH
- GitHub: @TocConsulting
- LinkedIn: Tarek CHEIKH
- Website: tocconsulting.fr
⭐ If you find this project useful, please consider giving it a star on GitHub!