Skip to content

CodingSamrat/s3b-server

Repository files navigation

s3b-server

s3b-server is a robust and flexible server implementation for self-hosted S3 bucket. It provides a streamlined interface for seamless integration, allowing for efficient storage, retrieval, and manipulation of data within self-hosted S3-compatible storage systems. Designed with scalability and performance in mind, s3b-server simplifies the process of handling S3 operations, making it an ideal choice for developers and organizations looking to leverage self-hosted S3 storage solutions.

Installation

# Clone the repository
git clone https://github.com/CodingSamrat/s3b-server.git

# Change directory to s3b-server
cd s3b-server

# Run install script
# linux -
bash install.sh

# windows -
install.bat

Configurations

Before running the server, you need to modify some of configurations. open s3b.config.js file and replace all values of Replace zone.

export const TRUSTED_HOST = ['https://example.com'];            // Replace it...


export const HOST_URL = 'https://cdn.example.com'               // Replace it...


export const BUCKETS = [                                        
    {   // Never use `bucket` keyword in any key bellow
        bucketId: 'example-project-name',
        apiKey: 'generated-api-key',
        apiSecret: 'generated-api-secret',
    },
]

Generate Secret Keys

Run the command bellow in order to generate secure apiKey & apiSecret. Use this generated api key & secret in s3b.config.js - BUCKETS. You can create multiple buckets by creating more BUCKET Object in BUCKET Array.

echo -e "\napiKey    : '$(uuidgen | tr -d '-' | head -c 32)',\napiSecret : '$(openssl rand -hex 32)'\n"

Run server

Now run the server using pm2. pm2 will be installed during s3b-server installation.

pm2 start index.js -n s3b

By default server will be running on http://localhost:8800 prot. You can use reverse proxy to serve the server like Nginx or Apache.

Client Side Integration

Install the s3b package for client side usage.

npm install s3b

For client side integration go through s3b package README.

Contributing

Thank you for investing your time in contributing to our project! Whether it's a bug report, new feature, correction, or additional documentation, we greatly value feedback and contributions from our community. Any contribution you make will be reflected on github.com/CodingSamrat/s3b-server.

Contributions to s3b-server are welcome! Here's how to get started:

  • Open an issue or find for related issues to start a discussion around a feature idea or a bug.
  • Fork the repository on GitHub.
  • Create a new branch of the master branch and start making your changes.
  • Make a meaning-full commit.
  • Write a test, which shows that the bug is fixed or the feature works as expected.
  • Send a pull request and wait until it gets merged and published.