This project was built in completion of a backend developer challenge.
Create an API that serves as a cloud backup system.
- Users can create accounts with
- Username
- Password
- Users can upload files up to 200mb
- Users can download uploaded files
- Users can create folders to hold files
- Create admin users for managing content
- Admins can mark media files as unsafe
- Unsafe files get automatically deleted
- Users can stream audio and video
The documentation of this application can be found @:
# Clone the repository
$ git clone https://github.com/TosinJs/Cloud-Backup-System.git
# Install dependencies
$ cd 'Cloud Backup System'
$ go get ./..
# configuration
# Create .env file in the root folder
$ touch .env
# populate the .env file with your files
$ DB_CONNECTION_STRING = "your postgresql connection string"
$ DB_CLIENT = "pg"
$ JWT_SECRET = "your JWT secret"
$ PORT = "3000"
$ DSN = "mysql connection string"
$ JWTSECRET = "jwt secret for auth token generation"
$ AWS_ID = "AWS ID"
$ AWS_SECRET = "AWS SECRET"
$ AWS_REGION = "AWS REGION"
$ AWS_TOKEN = "This can be left blank"
# Database Migrations (The migration files are in the internal/setup/database/ folder)
## Using the Makefile
$ make migrate-up
$ make migrate-down
## Using the migrate cli tool directly
$ migrate -database ${your mysql DSN} -path internal/setup/database/migrations up
$ migrate -database ${your mysql DSN} -path internal/setup/database/migrations down
# start
## Using the Makefile
$ make run
## Using go commands
$ go run main.go
The business logic is split into two main services:
The Users service contains all the logic for registeration and authentication of users
A JWT is retured to the user when they signup or login. The JWT is used to access the Files service
Admin Credentials can be created to access the certain routes
On signup each user has a folder assigned to their account
All the endpoints in the files service are protected endpoints
Users can Create, Download, and Delete files and folders from their folders
Admin users can flag files as offensive. After three flags the file is automatically deleted