Proof of concept Cloud-centric database backup utility for PostgreSQL, MongoDB, and MySQL. Provides a web API that clients can use to interact and perform these actions.
This repository contains the server’s source code and is part of a NitHub project.
- User authentication/authorization.
- Database connection detail encryption (end-to-end).
- Supports backups to PostgreSQL, MongoDB, and MySQL.
- Supports downloading database backups via signed URLs.
- Supports database restoration from backup files.
- API endpoints documented using Swagger Open API spec.
- Backups are compressed and uploaded to cloud storage.
Full specs here (roadmap.sh)
- Allow users to create accounts, sign in and log out.
- Make sure database connection details are encrypted on the client and server.
- Allow backup and restore for different database systems via appropriate endpoints.
- Allow users to schedule routine backups via cron jobs.
- Enforce best security practices.
- NodeJs (Typescript & ExpressJs).
- PostgreSQL.
- MongoDB.
- Redis.
- Docker.
- Swagger (docs).
- BackBlaze (S3 Compatible Cloud BLOB Storage).
The documentation is generated and served using swagger. You can access it from your own instance using the /docs
endpoint.
Before running the server, make sure you generate the swagger.json
spec file using this command:
chmod +x ./scripts/swagger.sh
./scripts/swagger.sh
- Install npm packages using
yarn install
. - Configure environment variables using the
.env.example
template, see the configuration options here. - Generate public and private keys using
./scripts/genkeys.sh
- Encrypt test connection details using
./scripts/encryptor.sh
, from your .conf.json file, details here. - Perform prisma migrations using
./scripts/db.sh --migrate
- Start the development server using
./scripts/dev.sh
These scripts need execution permission which you can grant using chmod +x <path-to-script>
If you need to establish a database connection without the web client:
- Create a
.conf.json
file in the root directory. - You can then put in the connection details and run
./scripts/encryptor.sh
to get it’s encrypted form using the public key.
Note: The public and private key files must have already been generated from the ./scripts/genkeys.sh
script before executing this one.
Never commit your .conf.json
file to git.
Variable | Description |
---|---|
PORT | Server port number |
HOSTNAME | Default is “localhost”, replace with your deployed server hostname |
ENVIRONMENT | The environment the server is running on, either “dev” or “prod” |
ACCESS_TOKEN_KEY | Secret key for signing access tokens |
REFRESH_TOKEN_KEY | Secret key for generating refresh tokens |
DATABASE_URL | PostgreSQL connection url |
REDIS_URI | Redis database connection uri |
BACKBLAZE_APP_KEY_ID | Your backblaze key id |
BACKBLAZE_APP_KEY | Your backblaze key |
BACKBLAZE_BUCKET_ID | Your backblaze bucket id |
BACKBLAZE_BUCKET_NAME | Your backblaze bucket name |
Leave a Reply