Skip to content

TosinJs/Cloud-Backup-System

Repository files navigation

Cloud-Backup-System

Description

This project was built in completion of a backend developer challenge.

Requirements

Create an API that serves as a cloud backup system.

General

  • Users can create accounts with
    • Username
    • Password
    • Email
  • 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

Documentation

The documentation of this application can be found @:

  • Postman @ https://github.com/TosinJs/Cloud-Backup-System/blob/master/Cloud%20Backup%20System.postman_collection.json
  • Run the Application Locally

    # 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
    

    Application Flow

    The business logic is split into two main services:

  • Users
  • Files
  • Users

    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

    login flow

    Files

    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

    About

    No description, website, or topics provided.

    Resources

    Stars

    Watchers

    Forks

    Releases

    No releases published

    Packages

    No packages published