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.
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_URL=mysql://root:admin@localhost:3306/horusdevdb \ -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_URL |
* | The URL for the database connection. | 'mysql://root:[email protected]:3306/horusdevdb' |
CORS_ORIGIN |
* | The origin allowed for CORS. | 'http://localhost' |
JWT_SECRET |
* | The secret key used for JWT authentication. | 'super_secret_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:DATABASE_URL=mysql://root:[email protected]:3306/horusdevdb JWT_SECRET=your_secret_key CORS_ORIGIN=http://localhost:3000 NODE_ENV=development
-
Run the Application:
pnpm dev
This will start both the frontend and backend applications concurrently.