{"id":15064743,"url":"https://github.com/pyrallux/cycle-count-app","last_synced_at":"2026-02-06T00:33:05.155Z","repository":{"id":251546503,"uuid":"837726638","full_name":"Pyrallux/Cycle-Count-App","owner":"Pyrallux","description":"React Frontend \u0026 Django Backend Full-Stack Nginx Web Application used to detect and fix inventory errors within ERP systems","archived":false,"fork":false,"pushed_at":"2025-01-17T20:05:28.000Z","size":5611,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T10:14:37.445Z","etag":null,"topics":["axios","bootstrap","django","django-cors-headers","django-rest-framework","docker","docker-compose","docker-secrets","docker-volume-backup","gunicorn","js-cookie","nginx","react","react-hook-form","react-pdf-renderer","react-query","react-router-dom","typescript","vite","yup"],"latest_commit_sha":null,"homepage":"https://cyclecount.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Pyrallux.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-03T20:51:57.000Z","updated_at":"2024-12-11T22:31:08.000Z","dependencies_parsed_at":"2024-08-15T03:27:37.171Z","dependency_job_id":"62e07e77-ff39-42a7-aead-de75f92042fc","html_url":"https://github.com/Pyrallux/Cycle-Count-App","commit_stats":null,"previous_names":["pyrallux/ccbb-prod","pyrallux/cycle-count-app"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pyrallux%2FCycle-Count-App","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pyrallux%2FCycle-Count-App/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pyrallux%2FCycle-Count-App/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pyrallux%2FCycle-Count-App/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Pyrallux","download_url":"https://codeload.github.com/Pyrallux/Cycle-Count-App/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243790999,"owners_count":20348385,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["axios","bootstrap","django","django-cors-headers","django-rest-framework","docker","docker-compose","docker-secrets","docker-volume-backup","gunicorn","js-cookie","nginx","react","react-hook-form","react-pdf-renderer","react-query","react-router-dom","typescript","vite","yup"],"created_at":"2024-09-25T00:25:52.526Z","updated_at":"2026-02-06T00:33:05.106Z","avatar_url":"https://github.com/Pyrallux.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cycle Count App\n\n## Structure\n\nThe app is a full-stack web application designed to be used within a `Docker` container. The entire application stack is made up of 4 parts: Frontend, Backend, WebServer, and Backup.\n\n### Frontend\n\n- The frontend is a `React` application built using the open-source javascript module bundler `Vite`.\n- The majority of the frontend codebase is written in `typescript` and its dependencies can be found inside `./Frontend/package.json`.\n- Frontend documentation on patterns used throughout can be found in `./Frontend/docs`. Additional documentation is present throughout various react `.tsx` files making up the bulk of the frontend.\n- The Frontend relies on data from the backend to function properly. The url used to make calls to the database must be correctly configured in `./Frontend/src/api/apiConfig.ts`. Currently it is configured to query `https://cyclecount.app/db`.\n- To run the application in development mode locally, run `npm run dev` inside `./Frontend`. A development version of the application be found at `localhost:5173`.\n- In production, the frontend source files are not used, and code is compiled by running `npm run build` inside `./Frontend`. The compiled static application in `html` format can be found in`./Frontend/dist` when complete. This `dist` folder is placed within `./WebServer` in production to be served with `nginx`.\n\n### Backend\n\n- The backend is built upon the `Django` web framework using `djangorestframework` to handle requests; it is served using `Gunicorn` web server.\n- The majority of the backend codebase is written in `python` and its dependencies can be found inside `./Backend/requirements.txt`.\n- The backend writes all data to a `.sqlite3` database found in `./Backend/data`.\n- Key files to the backend's functionality include:\n  - `settings.py` managing high-level application settings as well as security header settings. Currently the application is configured to host the backend at \u003chttps://cyclecount.app/db\u003e and only accept same-site requests from \u003chttps://cyclecount.app\u003e over `https`.\n  - `models.py` determining the various models used in the database, their fields, as well as any relationships between models.\n    - NOTE: All changes made to models must be migrated to the database by running `django manage.py makemigrations` followed by `django manage.py migrate`, and each model and field must be properly reflected within `serializers.py`.\n  - `urls.py` which determines the url patterns used by the django REST API framework.\n  - `views.py` which links each url pattern with an underlying API call to a CRUD action in the database.\n  - `admin.py` which manages which models should be present on the django administration site.\n- In addition, a private key securing the backend must be provided in the root directory with the name `django-private-key.txt`.\n- In development, the django server can be run locally by running `django manage.py runserver`. Running the server this way in production is bad practice.\n- In production, the backend is served with `gunicorn`, and its the admin site's static `.css` files are served with `nginx`.\n\n### Webserver\n\n- The entire application is served to the web using `nginx`.\n- Currently, nginx is configured to serve the site to \u003chttps://cyclecount.app\u003e using `https`.\n  - Both the `ssl` private key and public certification must be placed in the root directory named `ssl-private-key.txt` and `ssl-public-key.crt`.\n- The nginx config can be found in `./WebServer/nginx.conf`.\n- In production, as discussed earlier, the built frontend application should be placed in `./WebServer/dist`.\n\n### Backup\n\n- This aspect of the application is purely used to backup the `.sqlite3` database bi-weekly. It uses a third-party `Docker` image to backup the database volume within the container.\n- Backups are saved to `./Backup/archive` and configuration files for various settings such as the time, frequency, and format of backups can be found in `./Backup/backup.env`. Backups are currently configured to be pruned after 60 days.\n- Information on how to use these backups to restore the database can be found in `./Backup/db-restore.md`.\n\n## Docker Container Info\n\n- The application has been developed to be used inside of a docker container. `Docker-Compose` allows the app to nicely break the application down into 3 interdependant services: WebServer, Backend, and Backup.\n- Each service generates its own image or virtual linux environment that is complete with its own requirements. This top-level configuration can be found in `./compose.yaml`. Additionally, each service has its own `dockerfile` outlining the commands needed to properly install requirements and start the service within the virtual container.\n- `Volumes` are used within the application to link data within the virtual containers with the local filesystem. Plus, Docker `secrets` allow private keys to be used by containers without them needing to be present within the potentially vulnerable virtual image.\n\n## Running the Application\n\n1. Clone this repository.\n2. Build the frontend with `npm run build` and place the generated `dist` folder inside the `./WebServer` folder.\n3. Place the proper secret `django-private-key.txt`, `ssl-private-key.txt`, and `ssl-public-key.txt` files in the root of the directory.\n4. Run `docker compose up -d` in the home directory to build the docker container (Prior docker installation is required).\n5. Access the app through a browser at \u003chttps://cyclecount.app\u003e (Authentication is required for access).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyrallux%2Fcycle-count-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyrallux%2Fcycle-count-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyrallux%2Fcycle-count-app/lists"}