This is the backend for my simple file sharing service that I made for my final project, in order to graduate from my university.
- Backend code written in
Rust
. - Connects to
PostgreSQL
- Modeling using
Prisma
- File stored on
AWS S3
- Local S3
Minio
- See all users
- Create new user
- Update user
- Delete user
- See all public folders
- See all personal folders
- See all "shared to me" folders
- Create new folders
- Update folders
- Delete folders
- Manage folder's collaborators
- Download folder
- Manage folders' tags
- See all public files
- See all personal files
- See all "shared to me" files
- Create new files
- Update files
- Delete files
- Manage file versions
- Manage file's collaborators
- Download file
- Access to file temporary
- File extensions unrestricted
- Manage files' tags
- Create new tags
- Delete tags
- Manage tags of files or folders
- Add collaborator to files
- Add collaborator to folders
- Delete collaborators from files
- Delete collaborators from folders
This server now runs https by DEFAULT
If you want to run this app locally, you can create some self-signed certificates
The tool mkcert
in this example will be used, you can however create certificates and private keys in any certain way that you want
This server's certificates will be stored in /cert
cd cert
mkcert -cert-file localhost.cert -key-file localhost.key localhost
openssl pkcs12 -export -in localhost.cert -inkey localhost.key -out localhost.p12 -name localhost
# Type in your desired lock password
cd minio
mkcert -cert-file public.crt -key-file private.key minio
Finally, copy your CA certificate in the folder
Your /cert
folder should look like this:
cert
├── localhost.cert
├── localhost.key
├── localhost.p12
├── minio
│ ├── private.key
│ └── public.crt
└── rootCA.pem
-
Adjust some variables in the
docker-compose.prod.yml
based on your likings -
Wait for the
backend
container in the stacksimple-file-sharing
to finish building. Remember to look at the logs -
After the stack finished building and running successfully. These are the endpoints for checking the storage and database
-
Database:
Accesshttps://localhost:5556
to see the database tables and rows (opening Prisma Studio)
Accesshttps://localhost:5050
to enterpgAdmin4
webpage, can be used for advanced database monitoring -
By default, the
docker-compose
stack exposes Minio console to manage the files underneath.
Accesshttps://localhost:9090
to see the MinIO console, login to see the buckets and data
- Refresh the webpage
The reason for this error is that the first time you enter Prisma Studio it causes a segmentation fault, that's why I've wrote a script that restarts Prisma Studio if it ever does so. Have a look in the docker-compose.prod.yml
file, specifically until npx prisma studio; do :; done;
- I purposely set the build parameters to optimize binary speed and size, sacrificing compile time. I will put up a pre-built image on Docker Hub soon.