Skip to content

vividsystem/spaces

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spaces

a file sharing solution for you and your friends.

Idea and Motivation

I was on a trip with friends recently. Not all of them had the same OS on their phone and we didn't want to send the files via messenger. So I had the idea to build this. It is supposed to be file sharing managed into groups. I intend on adding auth in the future. I didn't have time to implement everything as this is MY FIRST PROJECT IN RUST.

Features

  • file sharing for groups
  • speeeeeed (cuz Rust)
  • very nice logging in the backend
  • metadata storage
  • automatic file-deduplication (no file is stored more than once at the same time)

Requirements

  • UNIX OS? probably even windows
  • Bun (or another TS/JS runtime) and Rust installed

Setup

paste the following into backend/.env

DATABASE_URL=
UPLOAD_PATH=WHERE_TO_SAFE_FILES
ALLOWED_ORIGINS=http://localhost:3001,http://localhost:3000 # replace with your actual origins

Deploy

cd backend
cargo build --release
cd ../web
bun i
bun run build

The above gives you a binary you can call

Docker

Backend

You need to setup backend/.env (see backend/README.md) and do UPLOAD_PATH=/data/uploads

cd backend
docker build --tag spaces-backend .
docker run --env-file .env -p 6570:6570 spaces-backend
# or use in docker-compose

Example Systemd services

I recommend making an extra user with its own home file directory where you can then safe the uploaded files

Backend

spaces-backend.service

[Unit]
Description=Spaces Backend
After=network.target

[Service]
Type=simple
User=your-user
WorkingDirectory=/home/your-user/spaces/backend
ExecStart=/home/your-user/spaces/backend/target/release/backend
Restart=on-failure
RestartSec=5
Environment="RUST_LOG=info"

[Install]
WantedBy=multi-user.target:

spaces-backend.service

Web

[Unit]
Description=Spaces Web
After=network.target
Require=spaces-backend.service

[Service]
Type=simple
User=your-user
WorkingDirectory=/home/your-user/spaces/web
ExecStart=/home/your-user/.bun/bin/bun run .output/server/index.mjs
Restart=on-failure
RestartSec=5
Environment="NODE_ENV=production"
Environment="PORT=3000"

[Install]
WantedBy=multi-user.target

Configuration

Frontend Configuration Backend Configuration

About

a file storage solution with an easily accessible api

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors