S3Gallery is a secure and scalable media storage solution that allows users to sign up, log in, and upload their photos and videos. This media is then stored safely in an AWS S3 bucket, accessible only to the registered user through pre-signed URLs that ensure secure and temporary access.
- User Authentication: Secure sign-up and login system using JWT.
- Media Upload: Upload photos and videos to your personal gallery.
- AWS S3 Storage: Safely store media files in an AWS S3 bucket.
- Secure Access: Media files are accessed through pre-signed URLs, ensuring that only authorized users can access their own media.
- Responsive Design: Frontend pages are responsive and accessible on various devices.
- Backend: Node.js, Express, API Rest, JWT
- Frontend: HTML, CSS, JavaScript
- Database: AWS S3 for media storage, SQL database for user and archive metadata
- Others: AWS SDK, Multer, bcrypt
To get a local copy up and running, follow these steps:
- Clone the repository:
git clone https://github.com/felipebpassos/S3Gallery.git
- Navigate to the project directory:
cd S3Gallery
- Install backend dependencies:
cd backend npm install
- Set up environment variables:
Create a .env file in the backend directory and add your AWS S3 credentials and JWT secret.
Example .env file:
AWS_ACCESS_KEY_ID=your-access-key-id AWS_SECRET_ACCESS_KEY=your-secret-access-key AWS_REGION=your-region S3_BUCKET_NAME=your-bucket-name JWT_SECRET=your-jwt-secret
- Run the backend server:
node app.js
The backend will run on http://localhost:3000.
- Serve the frontend: Open the HTML files (login.html, signup.html, home.html) in your browser to test the frontend.
-
Sign Up:
- Open the
signup.html
file in your browser. - Fill in your details and sign up to create a new account.
- Open the
-
Log In:
- Open the
login.html
file in your browser. - Use your credentials to log in.
- Open the
-
Upload Media:
- After logging in, you’ll be redirected to the
home.html
page. - Click on the upload button to select photos or videos from your device.
- Uploaded media will be securely stored in your AWS S3 bucket.
- After logging in, you’ll be redirected to the
-
View Media:
- Your uploaded media will be displayed on the homepage.
- Media files are accessed via secure pre-signed URLs.
-
POST /signup: Register a new user.
- Request:
{ "username": "yourusername", "password": "yourpassword" }
- Response:
{ "message": "User registered successfully" }
- Request:
-
POST /login: Authenticate an existing user.
- Request:
{ "username": "yourusername", "password": "yourpassword" }
- Response:
{ "token": "your-jwt-token" }
- Request:
-
POST /upload: Upload a media file.
- Headers:
Authorization: Bearer your-jwt-token
- Request: FormData with the file.
- Response:
{ "message": "File uploaded successfully", "fileUrl": "url-to-access-file" }
- Headers:
-
GET /media: Retrieve all uploaded media URLs for the logged-in user.
- Headers:
Authorization: Bearer your-jwt-token
- Response:
{ "media": ["url1", "url2", ...] }
- Headers:
This project is licensed under the MIT License. See the LICENSE file for details.
If you have any questions or suggestions, feel free to reach out:
- Email: yourname@example.com
- LinkedIn: Your LinkedIn
- GitHub: Your GitHub