Skip to content

Project Structure

Cecilia Wong edited this page May 2, 2024 · 17 revisions

Folder structure as created by Create React App: https://create-react-app.dev/docs/folder-structure

The Webapp

The React app

Component Diagram - Main

Base path: src/

File/Directory Description
App.js The main React component.
App.css CSS style sheet for App.js.
i18n.js The internationalization configuration module.
Also includes function definitions used in translation configurations.
components/ Location of the supporting React components.
The CSS style sheet of a component is to be included in the same directory as the corresponding JS file.
api/ Location of API service module(s) and their base module, AbstractAPIService.
types/ Location of type definitions (data types, exceptions, etc.).
utils/ Location of utility modules.

Components

Common

Base path: src/components/common/

File/Directory Description
ErrorMessageBox.js The error message box.
ErrorMessageBox.css CSS stylesheet for the error message box.
LoadingText.js The text displayed when pending data load, eg. from API calls.
LoadingText.css CSS stylesheet for the loading text.

Navigation bar

Component Diagram - Navigation bar

Base path: src/components/nav/

File/Directory Description
NavBar.js Main component for the top navigation bar.
NavBar.css CSS stylesheet for the navigation bar.
LanguageSelector.js The language selector at the navigation bar.
LanguageSelector.css CSS stylesheet for the language selector.

Sumo Tournament Schedule Lookup

Component Diagram - Sumo Tournament Schedule Lookup

Base path: src/components/

File/Directory Description
SumoScheduleLookup.js The main component.
SumoScheduleLookup.css CSS stylesheet for the main component.
sumo/ Contains the sub-components of this module.

About page

Base path: src/components/

File/Directory Description
About.js The main component.
About.css CSS stylesheet for the main component.

API service(s)

Base path: src/api/

File/Directory Description
AbstractAPIService.js Base module for API webservice modules.
SumoScheduleService.js Service module for the Sumo Tournament Schedule API.

Data types

Component Diagram - Data types

Base path: src/types/

File/Directory Description
APICallResult.js Wrapper for the data on the result of an API call.
Tournament.js Represents the details of a sumo tournament.
APICallResult.responseData is an array of this data type for the Sumo Tournament Schedule API.

Utility modules

Base path: src/utils/

File/Directory Description
EnvironmentUtils.js Utility functions for the usage of environment variables.
DateUtils.js Utility functions for date/time manipulation.

Test cases

Base path: src/

File/Directory Description
App.test.js Integration tests of App.js, ie. the whole app.
App.test.json at the same directory contains test data for its test cases.
**/__tests__/*.test.js Unit test suite of the component with the same name.
The __tests__ folder is at the same directory as the corresponding component.
testUtis.js Utility functions for test cases.
testData-expecteds.json Expected text values, etc. that are likely shared among test cases across different suites.
setupTests.js Included upon project creation and meant for including library imports, etc. common for all test suites.
See here for details.

Webapp entry point and template

File/Directory Description
public/index.html
src/index.js
src/index.css
Page template and Javascript entry point.
public/ Includes the aforementioned public.html and images, etc. to be included in it.

Application configurations

File/Directory Description
src/conf/ Static application configurations that are the same in all environments.
src/locales/{lang-code}/translation.json Translation configurations for each supported language.
.env
.env.development
.env.production
(etc...)
Environment variable configurations.
Includes configurations that differ across environments.

Miscellaneous files for the webapp

File/Directory Description
package.json
package-lock.json
Dependency library configurations.

Others

File/Directory Description
README.md The contents of this repository's README section.
.github/workflows/ The path for workflow configuration files.
assets/ Miscellaneous files and documents.