Skip to content

TocConsulting/small-file-sharing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 SmallFileSharing - Serverless File Sharing on AWS

License: MIT AWS Python

A production-ready serverless file sharing solution built on AWS, featuring enterprise-grade security with Cognito authentication, RESTful API design, and automatic email notifications.

🎯 Key Features

  • 🔒 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

🏛️ Architecture Overview

┌─────────────┐     ┌──────────────┐     ┌─────────────┐
│   Client    │────▶│ API Gateway  │────▶│   Lambda    │
└─────────────┘     └──────────────┘     └─────────────┘
                            │                     │
                            ▼                     ▼
                    ┌──────────────┐     ┌─────────────┐
                    │   Cognito    │     │  DynamoDB   │
                    └──────────────┘     └─────────────┘
                                                 │
                                                 ▼
                                         ┌─────────────┐
                                         │     S3      │
                                         └─────────────┘
                                                 │
                                                 ▼
                                         ┌─────────────┐
                                         │     SES     │
                                         └─────────────┘

🚀 Quick Start

Prerequisites

  • AWS Account with appropriate permissions
  • CognitoApi installed and configured
  • Python 3.8+ for local development
  • AWS CLI configured

Installation

  1. Clone the repository

    git clone https://github.com/TocConsulting/small-file-sharing.git
    cd small-file-sharing
  2. Deploy CognitoApi (if not already done)

    # Follow the CognitoApi installation guide
    # https://github.com/TocConsulting/cognito-api#installation
  3. Create AWS Resources

    Use our automated setup script or follow the manual steps:

    # Coming soon: Terraform/CloudFormation templates

    Manual 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

📚 API Documentation

Authentication

All endpoints require:

  • x-api-key header
  • Authorization: Bearer {IdToken} header

Endpoints

📤 Upload File

POST /v1/users/{user_id}/files
Content-Type: application/json

{
  "file_data": "base64_encoded_data",
  "remote_file_name": "document.pdf"
}

📋 List Files

GET /v1/users/{user_id}/files

🗑️ Delete File

DELETE /v1/users/{user_id}/files/{file_id}

📨 Share File

POST /v1/users/{user_id}/files/{file_id}/share
Content-Type: application/json

{
  "share_with": ["email1@example.com", "email2@example.com"]
}

🛠️ Development

Project Structure

small-file-sharing/
├── endpoints/
│   ├── upload-file/
│   ├── get-user-files/
│   ├── delete-user-file/
│   └── share-file/
├── postman/
└── README.md

Testing

Import the Postman collection from /postman directory and configure:

  • API_BASE_URL: Your API Gateway URL
  • API_KEY: Your generated API key
  • IdToken: From CognitoApi authentication

🔒 Security Features

  • 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

🚧 Roadmap

  • Infrastructure as Code templates (Terraform/CloudFormation)
  • Support for larger files
  • File encryption at rest
  • File sharing permissions management

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

👨‍💻 Author

Tarek CHEIKH


⭐ If you find this project useful, please consider giving it a star on GitHub!

About

A small file sharing API based app

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages