diff --git a/collector/README.md b/collector/README.md index b73c91c..0344ebd 100644 --- a/collector/README.md +++ b/collector/README.md @@ -73,26 +73,26 @@ The command-line flags do not require this prefix, as the collector index is kno ## Code Structure -- [`/src`](/src) - All source code files for the API server -- [`/migrations`](/migrations) - Database migrations for the PostgreSQL database +- [`/src`](/collector/src) - All source code files for the API server +- [`/migrations`](/collector/migrations) - Database migrations for the PostgreSQL database Main files in the `/src` directory: -- [`main.rs`](/src/main.rs) - Entry point for the collector application -- [`lib.rs`](/src/lib.rs) - Entry point for the shared library -- [`config.rs`](/src/config.rs) - Handle environment variables -- [`schema.rs`](/src/schema.rs) - Auto-generated file by Diesel ORM that exports the database tables for Rust +- [`main.rs`](/collector/src/main.rs) - Entry point for the collector application +- [`lib.rs`](/collector/src/lib.rs) - Entry point for the shared library +- [`config.rs`](/collector/src/config.rs) - Handle environment variables +- [`schema.rs`](/collector/src/schema.rs) - Auto-generated file by Diesel ORM that exports the database tables for Rust Main folders in the `/src` directory: -- [`/auth`](/src/auth) - Structures and functions for authentication and authorization using JSON Web Tokens -- [`/db`](/src/db) - Structures and functions needed for running the database -- [`/errors`](/src/errors) - Structures and functions for error handling across the application -- [`/handlers`](/src/handlers) - All REST API handlers -- [`/models`](/src/models) - Rust `struct` definitions for tables in the database -- [`/protocol`](/src/protocol) - Structures and functions specific to the electronic voting protocol -- [`/utils`](/src/utils) - Miscellaneous helper functions -- [`/views`](/src/views) - Shared structures that define the return types from the API handlers +- [`/auth`](/collector/src/auth) - Structures and functions for authentication and authorization using JSON Web Tokens +- [`/db`](/collector/src/db) - Structures and functions needed for running the database +- [`/errors`](/collector/src/errors) - Structures and functions for error handling across the application +- [`/handlers`](/collector/src/handlers) - All REST API handlers +- [`/models`](/collector/src/models) - Rust `struct` definitions for tables in the database +- [`/protocol`](/collector/src/protocol) - Structures and functions specific to the electronic voting protocol +- [`/utils`](/collector/src/utils) - Miscellaneous helper functions +- [`/views`](/collector/src/views) - Shared structures that define the return types from the API handlers **Note:** The collector daemon compiles both a shared library and a main executable. Using this structure enables other [binary utilities](https://doc.rust-lang.org/cargo/guide/project-layout.html) (`/src/bin` directory) to access the data types and API handlers. diff --git a/frontend/README.md b/frontend/README.md index 947d288..4e35d4d 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -75,7 +75,7 @@ You will then need to set the following environment values: The development proxy is configured in `package.json`. By default, it assumes it can access the API servers and collectors under `localhost:3010`. The API then uses `/api/v1` as a replacement for `localhost:3010/api/v1`. This can be changed by updating: -```json +```jsonc { // ... "proxy": "http://localhost:3010" @@ -129,8 +129,8 @@ On a production server, the `REACT_APP_API_BASE_URL` will need to be updated to **Code Layout:** -- [`/src`](/src) - Main directory for all code files -- [`/public`](/public) - Other public files included in the website, like images, robots.txt, and the manifest +- [`/src`](/frontend/src) - Main directory for all code files +- [`/public`](/frontend/public) - Other public files included in the website, like images, robots.txt, and the manifest The main entry point for the entire application is `src/index.tsx`, which stores the Redux global state and loads the router. This component also defines the [error boundary](https://reactjs.org/docs/error-boundaries.html) used for trapping JavaScript errors. @@ -138,21 +138,21 @@ All of the routes for the application are defined in `src/components/Routes.tsx` **Subdirectories in `src/`:** -- [`/api`](/src/api) - Types used to simplify API requests to the backend server -- [`/components`](/src/components) - React components used to render the pages -- [`/helpers`](/src/helpers) - Miscellaneous functions and structures -- [`/models`](/src/models) - Defines the public JSON return types from the API server -- [`/notifications`](/src/notifications) - Functions and hooks for communicating with the notification server -- [`/protocol`](/src/protocol) - Functions specific to the electronic voting protocol -- [`/redux`](/src/redux) - Defines the global state for the application -- [`/semantic-ui`](/src/semantic-ui) - Custom [Semantic UI Theme](https://semantic-ui.com/usage/theming.html) for the website +- [`/api`](/frontend/src/api) - Types used to simplify API requests to the backend server +- [`/components`](/frontend/src/components) - React components used to render the pages +- [`/helpers`](/frontend/src/helpers) - Miscellaneous functions and structures +- [`/models`](/frontend/src/models) - Defines the public JSON return types from the API server +- [`/notifications`](/frontend/src/notifications) - Functions and hooks for communicating with the notification server +- [`/protocol`](/frontend/src/protocol) - Functions specific to the electronic voting protocol +- [`/redux`](/frontend/src/redux) - Defines the global state for the application +- [`/semantic-ui`](/frontend/src/semantic-ui) - Custom [Semantic UI Theme](https://semantic-ui.com/usage/theming.html) for the website **Subdirectories of `components/`:** -- [`/errorDialogs`](/src/components/errorDialogs) - Shared component for showing application errors -- [`/input`](/src/components/input) - Various custom input components, like text boxes -- [`/routes`](/src/components/routes) - The actual pages in the application -- [`/shared`](/src/components/shared) - Other components shared by multiple pages in the application +- [`/errorDialogs`](/frontend/src/components/errorDialogs) - Shared component for showing application errors +- [`/input`](/frontend/src/components/input) - Various custom input components, like text boxes +- [`/routes`](/frontend/src/components/routes) - The actual pages in the application +- [`/shared`](/frontend/src/components/shared) - Other components shared by multiple pages in the application ### Linting and Formatting @@ -242,9 +242,9 @@ Each action is constructed using an `action creator`, which is a plain JavaScrip - `Action` - Defines action for the reducer to run - `Action Creator` - Builds the action objects -The global store itself is defined in [`/src/redux/store.ts`](/src/redux/store.ts), and the data type is defined in [`/src/redux/state/root.ts`](/src/redux/state/root.ts). +The global store itself is defined in [`/src/redux/store.ts`](/frontend/src/redux/store.ts), and the data type is defined in [`/src/redux/state/root.ts`](/frontend/src/redux/state/root.ts). To isolate parts of the application, each page has a nested property inside the root state. -All of these nested states are defined in [`/src/redux/store`](/src/redux/store). +All of these nested states are defined in [`/src/redux/state`](/frontend/src/redux/state). To simplify the use of Redux in the application, a universal action creator and reducer has been written to update any part of the state. Rather, the application defines several higher-order functions for interacting with the store: diff --git a/notifications/README.md b/notifications/README.md index b3290d2..9277135 100644 --- a/notifications/README.md +++ b/notifications/README.md @@ -52,16 +52,16 @@ The command-line parameters override any values set in the `.env` files. Main files in the `/src` directory: -- [`main.rs`](/src/main.rs) - Entry point for the notification server executable -- [`lib.rs`](/src/lib.rs) - Entry point for the shared library -- [`config.rs`](/src/config.rs) - Handle environment variables +- [`main.rs`](/notifications/src/main.rs) - Entry point for the notification server executable +- [`lib.rs`](/notifications/src/lib.rs) - Entry point for the shared library +- [`config.rs`](/notifications/src/config.rs) - Handle environment variables Main folders in the `/src` directory: -- [`/auth`](/src/auth) - Structures and functions for authentication and authorization using JSON Web Tokens -- [`/errors`](/src/errors) - Structures and functions for error handling across the application -- [`/handlers`](/src/handlers) - All REST API handlers -- [`/notifications`](/src/notifications) - Structures and functions for pushing WebSocket notifications to the frontend +- [`/auth`](/notifications/src/auth) - Structures and functions for authentication and authorization using JSON Web Tokens +- [`/errors`](/notifications/src/errors) - Structures and functions for error handling across the application +- [`/handlers`](/notifications/src/handlers) - All REST API handlers +- [`/notifications`](/notifications/src/notifications) - Structures and functions for pushing WebSocket notifications to the frontend **Note:** The notification server compiles both a shared library and a main executable. Using this structure enables other [binary utilities](https://doc.rust-lang.org/cargo/guide/project-layout.html) (`/src/bin` directory) to access the data types and API handlers. @@ -69,11 +69,11 @@ Although this project doesn't have any utilities currently, this may be useful i Other important files: -- [`/server_types.rs`](/src/notifications/server_types.rs) - Data structures for notifications pushed from the API server -- [`/client_types.rs`](/src/notifications/server_types.rs) - Data structures for notifications pushed to the frontend -- [`/subscription_actor.rs`](/src/notifications/subscription_actor.rs) - [Actix Actor](https://actix.rs/book/actix/) for managing the list of all active subscriptions -- [`/websocket_actor.rs`](/src/notifications/websocket_actor.rs) - [Actix Actor](https://actix.rs/book/actix/) for managing a single websocket connection -- [`/internal_types.rs`](/src/notifications/internal_types.rs) - Data structures used for internal actor communication between the subscription actor and the websocket actor +- [`/server_types.rs`](/notifications/src/notifications/server_types.rs) - Data structures for notifications pushed from the API server +- [`/client_types.rs`](/notifications/src/notifications/server_types.rs) - Data structures for notifications pushed to the frontend +- [`/subscription_actor.rs`](/notifications/src/notifications/subscription_actor.rs) - [Actix Actor](https://actix.rs/book/actix/) for managing the list of all active subscriptions +- [`/websocket_actor.rs`](/notifications/src/notifications/websocket_actor.rs) - [Actix Actor](https://actix.rs/book/actix/) for managing a single websocket connection +- [`/internal_types.rs`](/notifications/src/notifications/internal_types.rs) - Data structures used for internal actor communication between the subscription actor and the websocket actor All data types in `server_types.rs` must implement either the `GlobalEvent` or `ElectionEvent` trait. These traits provides a generic way for the websocket handler to convert server notifications into data sent to the frontend. diff --git a/server/README.md b/server/README.md index 1e30aaf..e4af256 100644 --- a/server/README.md +++ b/server/README.md @@ -167,27 +167,27 @@ The command-line parameters override any values set in the `.env` files. ## Code Structure -- [`/src`](/src) - All source code files for the API server -- [`/migrations`](/migrations) - Database migrations for the PostgreSQL database +- [`/src`](/server/src) - All source code files for the API server +- [`/migrations`](/server/migrations) - Database migrations for the PostgreSQL database Main files in the `/src` directory: -- [`main.rs`](/src/main.rs) - Entry point for the server application -- [`lib.rs`](/src/lib.rs) - Entry point for the shared library -- [`config.rs`](/src/config.rs) - Handle environment variables -- [`schema.rs`](/src/schema.rs) - Auto-generated file by Diesel ORM that exports the database tables for Rust +- [`main.rs`](/server/src/main.rs) - Entry point for the server application +- [`lib.rs`](/server/src/lib.rs) - Entry point for the shared library +- [`config.rs`](/server/src/config.rs) - Handle environment variables +- [`schema.rs`](/server/src/schema.rs) - Auto-generated file by Diesel ORM that exports the database tables for Rust Main folders in the `/src` directory: -- [`/auth`](/src/auth) - Structures and functions for authentication and authorization using JSON Web Tokens -- [`/db`](/src/db) - Structures and functions needed for running the database -- [`/errors`](/src/errors) - Structures and functions for error handling across the application -- [`/handlers`](/src/handlers) - All REST API handlers -- [`/models`](/src/models) - Rust `struct` definitions for tables in the database -- [`/notifications`](/src/notifications) - Structures and functions for pushing WebSocket notifications to the frontend -- [`/protocol`](/src/protocol) - Structures and functions specific to the electronic voting protocol -- [`/utils`](/src/utils) - Miscellaneous helper functions -- [`/views`](/src/views) - Shared structures that define the return types from the API handlers +- [`/auth`](/server/src/auth) - Structures and functions for authentication and authorization using JSON Web Tokens +- [`/db`](/server/src/db) - Structures and functions needed for running the database +- [`/errors`](/server/src/errors) - Structures and functions for error handling across the application +- [`/handlers`](/server/src/handlers) - All REST API handlers +- [`/models`](/server/src/models) - Rust `struct` definitions for tables in the database +- [`/notifications`](/server/src/notifications) - Structures and functions for pushing WebSocket notifications to the frontend +- [`/protocol`](/server/src/protocol) - Structures and functions specific to the electronic voting protocol +- [`/utils`](/server/src/utils) - Miscellaneous helper functions +- [`/views`](/server/src/views) - Shared structures that define the return types from the API handlers **Note:** The API server compiles both a shared library and a main executable. Using this structure enables other [binary utilities](https://doc.rust-lang.org/cargo/guide/project-layout.html) (`/src/bin` directory) to access the data types and API handlers.