-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0a7ace2
Showing
75 changed files
with
8,872 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.git* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
VITE_API_URL="http://localhost:5000" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
coverage | ||
.nyc_output | ||
node_modules/ | ||
server/node_modules/ | ||
.npm | ||
.eslintcache | ||
.env | ||
.cache | ||
dist | ||
dist-pkg | ||
server/dist | ||
.DS_Store | ||
yarn.lock | ||
public | ||
*.tsbuildinfo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
module.exports = { | ||
root: true, | ||
env: { browser: true, node: true, es2020: true }, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:react/recommended', | ||
'plugin:react-hooks/recommended', | ||
], | ||
ignorePatterns: ['dist', '.eslintrc.cjs'], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
ecmaFeatures: { jsx: true }, | ||
}, | ||
plugins: ['react-refresh', '@typescript-eslint'], | ||
settings: { | ||
react: { | ||
version: "detect", | ||
} | ||
}, | ||
rules: { | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'react/react-in-jsx-scope': 'off', | ||
'react-refresh/only-export-components': 'off', | ||
|
||
'dot-notation': 'off', | ||
'guard-for-in': 'off', | ||
'new-cap': 'off', | ||
'no-empty': 'off', | ||
'no-extra-boolean-cast': 'off', | ||
'no-new': 'off', | ||
'no-plusplus': 'off', | ||
'no-useless-escape': 'off', | ||
'strict': 'off', | ||
|
||
'array-bracket-spacing': 'warn', | ||
'arrow-parens': 'warn', | ||
'arrow-spacing': ['warn', { | ||
'before': true, | ||
'after': true | ||
}], | ||
'block-spacing': ['warn', 'always'], | ||
'brace-style': ['warn', '1tbs'], | ||
'comma-dangle': ['warn', 'only-multiline'], | ||
'comma-spacing': 'warn', | ||
'curly': 'warn', | ||
'eqeqeq': 'warn', | ||
'func-call-spacing': ['warn', 'never'], | ||
'implicit-arrow-linebreak': 'warn', | ||
'indent': ['warn', 2], | ||
'keyword-spacing': 'warn', | ||
'lines-between-class-members': ['warn', 'always', { 'exceptAfterSingleLine': true }], | ||
'multiline-ternary': ['warn', 'never'], | ||
'newline-per-chained-call': ['warn', { 'ignoreChainWithDepth': 4 }], | ||
'no-caller': 'warn', | ||
'no-cond-assign': ['warn', 'except-parens'], | ||
'no-console': 'off', | ||
'no-debugger': 'warn', | ||
'no-eq-null': 'warn', | ||
'no-eval': 'warn', | ||
'no-trailing-spaces': 'warn', | ||
'no-undef': 'warn', | ||
'no-unused-vars': 'off', | ||
'no-whitespace-before-property': 'warn', | ||
'object-curly-spacing': ['warn', 'always'], | ||
'object-property-newline': 'warn', | ||
'object-shorthand': 'warn', | ||
'padded-blocks': ['warn', 'never'], | ||
'prefer-arrow-callback': 'warn', | ||
'prefer-template': 'warn', | ||
'rest-spread-spacing': 'warn', | ||
'semi': ['warn', 'always'], | ||
'space-before-function-paren': ['warn', 'never'], | ||
'space-infix-ops': 'warn', | ||
'spaced-comment': 'warn', | ||
'switch-colon-spacing': 'warn', | ||
'template-curly-spacing': ['warn', 'always'], | ||
'yield-star-spacing': ['warn', 'both'], | ||
|
||
'key-spacing': ['warn', { | ||
'align': { | ||
'beforeColon': false, | ||
'afterColon': true, | ||
'on': 'value', | ||
'mode': 'minimum' | ||
}, | ||
'multiLine': { | ||
'beforeColon': false, | ||
'afterColon': true | ||
}, | ||
}], | ||
|
||
'object-curly-newline': ['warn', { | ||
'ObjectExpression': { | ||
'multiline': true, | ||
'minProperties': 3 | ||
}, | ||
'ObjectPattern': { | ||
'multiline': true, | ||
'minProperties': 4 | ||
}, | ||
'ImportDeclaration': { | ||
'multiline': true, | ||
'minProperties': 5 | ||
}, | ||
'ExportDeclaration': { | ||
'multiline': true, | ||
'minProperties': 3 | ||
} | ||
}], | ||
|
||
'padding-line-between-statements': [ | ||
'warn', | ||
{ | ||
'blankLine': 'always', | ||
'prev': '*', | ||
'next': 'return', | ||
}, | ||
{ | ||
'blankLine': 'always', | ||
'prev': 'function', | ||
'next': 'function', | ||
}, | ||
// This configuration would require blank lines after every sequence of variable declarations | ||
{ | ||
'blankLine': 'always', | ||
'prev': ['const', 'let', 'var'], | ||
'next': '*' | ||
}, | ||
{ | ||
'blankLine': 'any', | ||
'prev': ['const', 'let', 'var'], | ||
'next': ['const', 'let', 'var'] | ||
} | ||
], | ||
|
||
'quotes': [ | ||
'warn', | ||
'single', | ||
{ | ||
'avoidEscape': true, | ||
'allowTemplateLiterals': true | ||
}, | ||
], | ||
|
||
'space-unary-ops': [ | ||
'warn', | ||
{ | ||
'words': true, | ||
'nonwords': false, | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Release Horus Container | ||
|
||
on: | ||
release: | ||
types: [released] | ||
|
||
env: | ||
ACTIONS_RUNNER_DEBUG: false | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
JWT_SECRET: ${{ secrets.JWT_SECRET }} | ||
|
||
jobs: | ||
build-release-container: | ||
if: github.ref_type == 'tag' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: write | ||
contents: read | ||
deployments: write | ||
packages: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Buildah Action | ||
uses: redhat-actions/buildah-build@v2 | ||
id: build-image | ||
with: | ||
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: latest ${{ github.ref_name }} ${{ github.sha }} | ||
build-args: | | ||
JWT_SECRET=${{ env.JWT_SECRET }} | ||
containerfiles: | | ||
./Dockerfile | ||
oci: true | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: redhat-actions/podman-login@v1 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Push To ghcr.io | ||
id: push-to-ghcr | ||
uses: redhat-actions/push-to-registry@v2 | ||
with: | ||
image: ${{ steps.build-image.outputs.image }} | ||
tags: ${{ steps.build-image.outputs.tags }} | ||
registry: ${{ env.REGISTRY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
server/node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
FROM node:22 AS frontend-build | ||
WORKDIR /app/frontend | ||
COPY ./package.json ./yarn.lock ./ | ||
COPY ./tsconfig.json ./tsconfig.app.json ./tsconfig.node.json ./ | ||
COPY ./vite.config.ts ./ | ||
COPY ./src ./src | ||
COPY ./public ./public | ||
COPY index.html .env ./ | ||
RUN yarn | ||
RUN yarn build | ||
|
||
FROM node:22 AS backend-build | ||
WORKDIR /app/backend | ||
COPY ./server/package.json ./server/yarn.lock ./ | ||
COPY ./server/tsconfig.json ./ | ||
COPY ./server/src ./src | ||
COPY ./server/.env ./ | ||
RUN yarn | ||
RUN yarn build | ||
|
||
FROM node:22 | ||
WORKDIR /app | ||
COPY --from=frontend-build /app/frontend/dist ./frontend | ||
COPY --from=backend-build /app/backend/dist ./backend | ||
COPY --from=backend-build /app/backend/node_modules ./backend/node_modules | ||
|
||
RUN npm install -g serve | ||
|
||
EXPOSE 3000 5000 | ||
|
||
CMD ["sh", "-c", "serve -s frontend -l 3000 & node backend/index.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# Horus Holdings Application | ||
|
||
## Overview | ||
|
||
The Horus Holdings application is a cash flow management tool that allows users to input incomes and expenses and visualize their cash flow over time. The application includes user authentication to ensure that each user's data is secure and private. | ||
|
||
The application consists of a frontend and a backend: | ||
- **Frontend**: Located in the `./src` directory. | ||
- **Backend**: Located in the `./server` directory. | ||
|
||
## Database Requirement | ||
|
||
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. | ||
|
||
### Setting Up MySQL Database | ||
|
||
1. **Install MySQL**: Follow the instructions for your operating system to install MySQL. | ||
2. **Create a Database**: Create a new database for the application. For example: | ||
```sql | ||
CREATE DATABASE devdb; | ||
``` | ||
3. **Create a User**: Create a new user and grant privileges to the database. For example: | ||
```sql | ||
CREATE USER 'root'@'localhost' IDENTIFIED BY 'admin'; | ||
GRANT ALL PRIVILEGES ON devdb.* TO 'root'@'localhost'; | ||
FLUSH PRIVILEGES; | ||
``` | ||
|
||
### Running MySQL Database Locally Using Docker | ||
|
||
For development purposes, you can run the MySQL database locally using a Docker container. Use the following command to start the MySQL container: | ||
|
||
```sh | ||
docker run -d --name mysql-dev -e MYSQL_ROOT_PASSWORD=admin -e MYSQL_DATABASE=devdb -p 3306:3306 -d mysql:latest | ||
``` | ||
|
||
This command will start a MySQL container with the specified environment variables. | ||
|
||
## Building and Running the Application in a Container | ||
|
||
The `Containerfile` is set up to build both the frontend and backend applications in separate stages and then combine them into a final image. | ||
|
||
### Steps to Build and Run the Container | ||
|
||
1. **Build the Docker Image**: | ||
```sh | ||
docker build -t horusholdings:latest . | ||
``` | ||
|
||
2. **Run the Docker Container**: | ||
```sh | ||
docker run -p 3000:3000 -p 5000:5000 horusholdings:latest | ||
``` | ||
|
||
This will start the frontend on port 3000 and the backend on port 5000. | ||
|
||
## Running the Application Locally | ||
|
||
To run the application locally, you need to have Node.js and Yarn installed. | ||
|
||
### Steps to Run Locally | ||
|
||
1. **Install Dependencies**: | ||
```sh | ||
yarn install-all | ||
``` | ||
|
||
2. **Set Up Environment Variables**: | ||
Create a `.env` file in the `./server` directory with the following content: | ||
```env | ||
DATABASE_URL=mysql://root:[email protected]:3306/devdb | ||
JWT_SECRET=your_secret_key | ||
CORS_ORIGIN=http://localhost:3000 | ||
NODE_ENV=development | ||
``` | ||
|
||
3. **Run the Application**: | ||
```sh | ||
yarn dev | ||
``` | ||
|
||
This will start both the frontend and backend applications concurrently. | ||
|
||
## Environment Variables | ||
|
||
The following environment variables are required to run the application: | ||
|
||
- `DATABASE_URL`: The URL for the database connection. | ||
- `JWT_SECRET`: The secret key used for JWT authentication. | ||
- `CORS_ORIGIN`: The origin allowed for CORS. | ||
- `NODE_ENV`: The environment mode (e.g., development, production). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Horus Holdings</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/main.tsx"></script> | ||
</body> | ||
</html> |
Oops, something went wrong.