Horus Holdings is a cash flow management tool designed to help users track their incomes and expenses, providing a clear visualization of their cash flow over time.
Named after the Egyptian god Horus, who symbolizes protection, stability, and prosperity, this application aims to bring financial clarity and control to its users. By offering robust user authentication, Horus Holdings ensures that each user's financial data remains secure and private, echoing the protective nature of its namesake.
Tip
See it in action: https://horus.yokanga.xyz
To quickly get started with Horus Holdings using Docker, you can use the provided quickstart.sh
script. This script will set up and run both the MySQL database and the Horus Holdings application in Docker containers.
./scripts/quickstart.sh
This script will:
- Pull the latest MySQL and Horus Holdings Docker images.
- Run the MySQL container with the specified environment variables.
- Wait for MySQL to initialize.
- Run the Horus Holdings container with the necessary environment variables.
- Output the URLs where the frontend and backend are accessible.
The application consists of a frontend and a backend:
- Frontend: Located in the
./src
directory. - Backend: Located in the
./server
directory.
The application requires a MySQL database to store user data. You need to set up a MySQL database and provide the connection details in the environment variables.
- Install MySQL: Follow the instructions for your operating system to install MySQL.
- Create a Database: Create a new database for the application. For example:
CREATE DATABASE horusdevdb;
- Create a User: Create a new user and grant privileges to the database. For example:
CREATE USER 'root'@'localhost' IDENTIFIED BY 'admin'; GRANT ALL PRIVILEGES ON horusdevdb.* TO 'root'@'localhost'; FLUSH PRIVILEGES;
For development purposes, you can run the MySQL database locally using a Docker container. Use the following command to start the MySQL container:
docker run -d --name mysql-dev \
-e MYSQL_ROOT_PASSWORD=admin \
-e MYSQL_DATABASE=horusdevdb \
--network host \
mysql:latest
This command will start a MySQL container with the specified environment variables.
The Dockerfile
is set up to build both the frontend and backend applications in separate stages and then combine them into a final image.
-
Build the Docker Image:
docker build -t horus-holdings:latest .
-
Run the Docker Container:
docker run -d --name horus \ --network host \ -e DATABASE_NAME=horusdevdb \ -e DATABASE_USER=root \ -e DATABASE_PASSWORD=admin \ -e DATABASE_HOST=localhost \ -e DATABASE_PORT=3306 \ -e CORS_ORIGIN=http://localhost \ -e JWT_SECRET=super-secret \ -e CLIENT_API_SCHEME=http \ -e CLIENT_PROXY_SCHEME=ws \ -e CLIENT_PROXY_HOST=localhost \ -e CLIENT_PROXY_PORT=5000 \ -e CLIENT_PROXY_PATH=/ws \ horus-holdings:latest
This will start the frontend on port 80 and the backend on port 5000.
The following table lists the configurable and required parameters for the application.
Parameter | Required | Description | Default |
---|---|---|---|
DATABASE_NAME |
* | The name of the database to connect to. | 'horusdevdb' |
DATABASE_USER |
* | The username for the database connection. | 'root' |
DATABASE_PASSWORD |
* | The password for the database connection. | 'admin' |
DATABASE_HOST |
* | The host for the database connection. | '127.0.0.1' |
DATABASE_PORT |
* | The port for the database connection. | '3306' |
CORS_ORIGIN |
* | The origin allowed for CORS. | 'http://localhost:5173' |
SESSION_SECRET |
The secret key used for session management. | A random 64-byte hex string | |
JWT_SECRET |
* | The secret key used for JWT authentication. | 'super_secret_key' |
ENCRYPTION_KEY |
* | The secret key used for encryption. | 'my_encryption_key' |
CLIENT_API_SCHEME |
The scheme used for API requests (e.g. https or http). | 'https' | |
CLIENT_PROXY_SCHEME |
The scheme used for WebSocket connections. (e.g. wss or ws) | 'wss' | |
CLIENT_PROXY_HOST |
The host used for WebSocket connections. (e.g. mydomain.com ) | 'localhost' | |
CLIENT_PROXY_PORT |
The port used for WebSocket connections. | '' | |
CLIENT_PROXY_PATH |
The path used for WebSocket connections. | '/ws' |
To run the application locally, you need to have Node.js and PNPM installed.
-
Install Dependencies:
pnpm install:all
-
Set Up Environment Variables: Create a
.env
file in the./server
directory with the following content:NODE_ENV="development" NODE_PORT=5000 CORS_ORIGIN=http://localhost:5173 SESSION_SECRET=my_development_secret JWT_SECRET=my_development_secret ENCRYPTION_KEY=my_development_secret DATABASE_NAME=horusdevdb DATABASE_USER=root DATABASE_PASSWORD=admin DATABASE_HOST=127.0.0.1 DATABASE_PORT=3306 DATABASE_LOGGING="false"
-
Run the Application:
pnpm dev
This will start both the frontend and backend applications concurrently.