This project is under active development, and changes are made often. Currently, Kat Gov is operating in a closed beta with dedicated customers. This repository contains the backend for the Kat Gov system. The frontend can be found here.
While the project is in closed beta, everything Nacho the Kat does is open source and built in public, so all development is committed here publicly and immediately. We welcome all contributors and would love to help you set up governance for your project. More information about Kat Gov can be found at KatGov.xyz.
Before setting up the application, ensure you have the following installed on your Ubuntu VPS:
- Bun (JavaScript runtime)
- PostgreSQL
sudo apt update && sudo apt upgrade -y
Install Bun by running the following command:
curl -fsSL https://bun.sh/install | bash
After installation, ensure Bun is in your PATH. You may need to restart your terminal or source your profile:
source ~/.bashrc
Verify the installation:
bun -v
sudo apt install -y postgresql postgresql-contrib
Switch to the PostgreSQL user and create a new database and user:
sudo -i -u postgres
psql
In the PostgreSQL shell, run:
CREATE DATABASE katgov;
CREATE USER katgovuser WITH ENCRYPTED PASSWORD 'yourpassword';
GRANT ALL PRIVILEGES ON DATABASE katgov TO katgovuser;
\q
exit
Clone the Kat Gov repository to your VPS:
git clone https://github.com/yourusername/kat-gov.git
cd kat-gov
Create a .env
file in the root of your project and add the following environment variables:
DB_USER=katgovuser
DB_PASS=yourpassword
DB_NAME=katgov
DB_HOST=localhost
DB_PORT=5432
PORT=8080
KASPA_API_BASE_URL=https://api.kaspa.org
Install the necessary packages using Bun:
bun install
Compile the TypeScript code to JavaScript:
bun run tsc
You can run the application using PM2 to ensure it stays up:
bun install -g pm2
pm2 start dist/index.js --name kat-gov
pm2 save
pm2 startup
Visit http://your-vps-ip:8080
to verify that the application is running.
- CORS Configuration: The application is configured to allow CORS from any origin.
- Testing: Run tests using
bun test
.
For more detailed information about the application architecture and endpoints, refer to the backendPlans.md
file.