feat: remove appwrite and add nextjs backend

This commit is contained in:
Elias Schneider
2022-10-09 22:30:32 +02:00
parent 7728351158
commit 4bab33ad8a
153 changed files with 13400 additions and 2811 deletions

View File

@@ -1,8 +1,6 @@
# <div align="center"><img src="https://user-images.githubusercontent.com/58886915/166198400-c2134044-1198-4647-a8b6-da9c4a204c68.svg" width="40"/> </br>Pingvin Share</div>
> ⚠️ This project is no longer maintained and only compatible with Apprite version 0.14 and below.
Pingvin Share is a self-hosted file sharing platform made for the [Appwrite Hackathon](https://dev.to/devteam/announcing-the-appwrite-hackathon-on-dev-1oc0).
Pingvin Share is self-hosted file sharing platform and an alternative for WeTransfer.
## 🎪 Showcase
@@ -13,59 +11,48 @@ Demo: https://pingvin-share.dev.eliasschneider.com
## ✨ Features
- Create a simple share with a link
- Secure your share with a visitor limit and a password
- Share your files with specific emails and send an invitation email
- No file size limit, only your disk will be your limit
- Optionally secure your share with a visitor limit and a password
- Dark mode
## ⌨️ Setup
At the moment, the setup is a bit time-consuming. I will improve the setup in the future.
1. Download the `docker-compose.yml` and `.env.example` file.
2. Rename the `.env.example` file to `.env` and change the environment variables so that they fit to your environment. If you need help with the environment variables take a look [here](#environment-variables)
3. Run `docker-compose up -d`
### 1. Appwrite
The website is now listening available on `http://localhost:8080`, have fun with Pingvin Share 🐧!
Pingvin Share uses Appwrite as backend. You have to install and setup Appwrite first
### Environment variables
1. [Install Appwrite](https://appwrite.io/docs/installation)
2. Create an Account on your Appwrite instance
3. Change the `_APP_STORAGE_LIMIT` variable in the `.env` file of Appwrite to your prefered max size limit per share
### 2. Frontend
First of all you have to start the Docker container.
1. Clone the `docker-compose.yml` file and the `.env.example` file from this repository
2. Rename the `.env.example` file to `.env`
3. Start the container with `docker-compose up -d`
The container is now running. Now you have to setup the Appwrite structure, but no worries there is a simple setup script.
To run the script run `docker-compose exec pingvin-share node scripts/setup.js`.
You're almost done, now you have to change your environment variables that they fit to your setup.
1. Go to your Appwrite console, visit "API Keys" and copy the "Functions API Key" secret to your clipboard.
2. Paste the key to the `APPWRITE_FUNCTION_API_KEY` variable in the `.env` file
3. Change `PUBLIC_APPWRITE_HOST` in the `.env` file to the host where your Appwrite instance runs
4. Change the rest of the environment variables in the `.env` that they fit to your preferences
5. To save the environment variables run `docker-compose up -d`
6. Well done! Get a coffee and enjoy Pingvin Share 🎉
## ⚙️ Additional configurations
### SMTP
1. Enable `PUBLIC_MAIL_SHARE_ENABLE` in the `.env` file.
2. Visit your Appwrite console, click on functions and select the `Create Share` function.
3. At the settings tab change the empty variables to your SMTP setup.
## 💁‍♂️ Known issues / Limitations
Pingvin Share is currently in beta and there are issues and limitations that should be fixed in the future.
- `DownloadAll` generates the zip file on the client side. This takes alot of time. Because of that I temporarily limited this function to maximal 150 MB.
- If a user knows the share id, he can list and download the files directly from the Appwrite API even if the share is secured by a password or a visitor limit.
| Variable | Description | Possible values |
| -------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------- |
| `APP_URL` | On which URL Pingvin Share is available. E.g http://localhost or https://pingvin-share.com. | URL |
| `BACKEND_URL` | Where the backend is listening on your local machine. If you use the default installation, use `http://backend:8080`. | URL |
| `SHOW_HOME_PAGE` | Wether the Pingvin Share home page should be shown. | true/false |
| `ALLOW_REGISTRATION` | Wether a new user can create a new account. | true/false |
| `MAX_FILE_SIZE` | Maximum allowed size per file in bytes. | Number |
| `JWT_SECRET` | Random string to sign the JWT's. | Random string |
## 🖤 Contribute
You're very welcome to contribute to Pingvin Share!
Contact me, create an issue or directly create a pull request.
### Development setup
#### Database & Backend
1. Open the `backend`
2. Duplicate the `.env.example` file, rename the duplicate to `.env` and change the environment variables if needed
3. Install the dependencies with `npm install`
4. Start the database by running `docker-compose up -d`
5. Push the database schema to the database by running `npx prisma db push`
6. Start the backend with `npm run dev`
#### Frontend
1. Open the `frontend` folder
2. Duplicate the `.env.example` file, rename the duplicate to `.env` and change the environment variables if needed
3. Install the dependencies with `npm install`
4. Start the frontend with `npm run dev`
You're all set!