Backend for Realm Bin Pastebin Clone.
- It's fast (yeah, no sh*t sherlock).
- Pastes can be locked behind password.
- Configurable paste id length and other variables.
- Store file (default max size is 1MB).
- Automatic cleanups for expired file-based paste keys.
- Swagger API docs in development environment.
- Graceful server plugin added.
- Clone this repo:
git clone https://github.com/irvanmalik48/realm-bin-be- Install dependencies:
You'll need to install valkey for the KV database. Do refer to their site on how to set it up.
This project uses bun. So please use bun. Any other attempts to use anything other than bun will require some rewriting because this project uses some bun's native functions.
bun install- Running dev server:
bun run dev-
Go clone the repo and install the dependencies like how you should when you want to run it in local.
-
Copy paste the
.env.examplefile and rename it to.env. Fill the necessary field as per the example. You can also consult thevalkeydocs for some more options on how to structure the link to it. -
In
config.tsfile, change the environment, domain (needed for CORS on prod), port where you wanna run it from, there's also other variables you can modify in general but keep notes on those 3 and probably also the folder path in that config. Using "production" for the environment is recommended if you want to have cleaner logs (it logs absolutely nothing doing so except for some essential stuffs). -
Since it uses
/opt/pastesby default for file-based pastes, do create the folder and give proper permissions:
sudo mkdir /opt/pastes
sudo chown your-user:your-user /opt/pastes
sudo chmod 700 /opt/pastes- Run the build command:
bun run build- Voila! You have the
serverexecutable now. I recommend you to set up a systemd service (or any kind of init service manager you have currently) and host it natively. Here's an example for systemd service:
[Unit]
Description=Realm Bin Backend Server
After=network.target
[Service]
Type=simple
User=your-user
WorkingDirectory=/path/to/realm-bin-be
ExecStart=/path/to/realm-bin-be/server
Restart=on-failure
RestartSec=5
StandardOutput=journal
StandardError=journal
TimeoutStopSec=2
[Install]
WantedBy=multi-user.target-
Proper documentationWe got Swagger now. - Text-based paste.
- File-based paste.
- Passworded paste for both types of paste.
- Size and length constraint for pastes.
- Encrypt paste if a password is set.
- More customization options.
RCCL