A dynamic website where logged in users can create folders and upload files in them, download the uploaded files and create an expirable public link of a file or folder to share it with others.
The setup needs to be done only once.
You can use The Odin Project's brilliant article to install PostgreSQL or follow the instructions given in PostgreSQL's official website
Create a file named .env in the project root folder and copy the contents of dot-env-example to .env. Then replace the placeholders with actuals values for each environment variables by following the hints given.
Run the following commands in order in the project root folder after installing nodejs
# Installs the dependencies
npm install# Creates database schema
npx prisma db push- Go to supbase dashboard
- Go to your project
- Go to "Storage" in the Sidebar
- Create a bucket called "main"(Don't create a public bucket)
- Go to policies then click "New policy" next to "main" then click "For full customization".
- Give a meaningful name for the policy like "Allow CRUD for all users" then check all the checkboxes for "Allowed operation", leave the "Target roles" as is i.e. "Defaults to all (public) roles if none selected".
- Click 'Review' then 'Save policy'.
Now you can CRUD files in your 'main' storage bucket.
Please setup the project before running it.
For development
npm run debugLaunch a browser and go to localhost:3000 or localhost:<port number that you set in .env>, put username and password as demo.
Warning: Contains flashing lights