Skip to content

nikhilnarayanan623/go-aws-s3-clean-arch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go AWS S3 File Upload and Download - Clean Architecture Project

This project is a simple application built using Go programming language that demonstrates file upload and download functionalities using Amazon S3. The project follows a clean code architecture, promoting modularity and maintainability.

Project Overview

The go-aws-s3-clean-arch project showcases how to upload and download files to/from Amazon S3 using a clean architecture approach. It emphasizes separation of concerns and modularity, making it easier to expand and maintain the application.

Used Packages

The project utilizes the following packages:

  1. AWS SDK: A comprehensive SDK for integrating Go applications with Amazon Web Services, providing functionalities for interacting with Amazon S3 and other AWS services.
  2. GIN: A web framework written in Go that combines high performance with an API similar to Martini.
  3. GORM with PostgreSQL: A powerful ORM library for Go that simplifies database operations.
  4. Wire: A code generation tool for dependency injection, making it easier to connect components.
  5. Viper: A configuration solution for Go applications, supporting various formats and 12-Factor app principles.
  6. swag with gin-swagger and swaggo files: Converts Go annotations to Swagger Documentation 2.0 for API documentation.

Please refer to the respective package documentation for more information on their usage and integration. Setup Instructions

To use and test the go-aws-s3-clean-arch project, follow these steps: Prerequisites

Ensure the following software is installed on your system:

Go (https://golang.org/doc/install)
PostgreSQL (https://www.postgresql.org/download/)
AWS account and S3 bucket (https://aws.amazon.com/s3/)

1. Clone the Repository

Clone the go-aws-s3-clean-arch repository to your local system:

git clone https://github.com/your-username/go-aws-s3-clean-arch.git
cd go-aws-s3-clean-arch

2. Install Dependencies

Install the required dependencies using either the provided Makefile command or Go's built-in module management:

# Using Makefile
make deps
# OR using Go
go mod tidy

3. Configure Environment Variables

Create a .env file in the project's root directory and set the following variables:

# Database
DB_HOST="your-database-host"
DB_NAME="your-database-name"
DB_USER="your-database-user"
DB_PASSWORD="your-database-password"
DB_PORT="your-database-port"

# AWS S3
AWS_ACCESS_KEY_ID="your-aws-access-key-id"
AWS_SECRET_ACCESS_KEY="your-aws-secret-access-key"
AWS_REGION="your-aws-region"
AWS_BUCKET_NAME="your-s3-bucket-name"

# Server
PORT="server-port"

4. Generate Wire Injectors

Run the following command to generate the Wire injectors:

make wire

5. Run the Application

make run