-
-
Notifications
You must be signed in to change notification settings - Fork 122
Code Organization
Alex Ball edited this page Oct 23, 2022
·
3 revisions
Here are all the important files and folders in the code base, split up by contributor role. You generally shouldn't have to worry about folders outside your role.
-
.storybook/
: Configuration for storybook -
components/
: The main source code directory for the frontend. It contains all the UI components, as well as hooks and state management for accessing the database and backend API. Feature and support directories should usecamelCase
naming, while component directories should useTitleCase
.-
db/
: Types and hooks for accessing the Firestore database that drives the whole application. The types are partially duplicated in the cloud functions package (firebase
).
-
-
pages/
: Configures the routes for the site. Each file corresponds to a route in the site, following Next.js's conventions. Pages should be defined using thecreatePage
helper function to ensure proper layout. -
public/
: Stores static assets for the site. A filepublic/path/to/asset.png
is accessible at the URL/path/to/asset.png
. -
stories
: Contains Storybook stories for our components. Folders are organized by feature/area of the site. -
styles
: Contains global styles for the site. Generally styles should be placed in CSS modules next to the component that uses them, or usingstyled-components
.
-
functions/
: The main source code directory for the Firebase functions that make up our backend. Folders are organized by feature/resource type. Types are partially duplicated in thecomponents/db
module.-
malegislature.ts
: Request methods for accessing the MA Legislature API. -
scraper.ts
: The base scraper that is used to sync data from the MA Legislature API to Firestore -
auth/
: Manages user roles and authorization. -
profile/
: Manages user profiles -
bills/
,cities/
,committees/
,events/
, andmembers/
: Scrapers for specific resources -
testimony/
: Handles testimony submission, edits, and deletions. -
search/
: Syncs data between Firestore and the Typesense search server. -
testimony/search.ts
,bill/search.ts
: Resource-specific schemas and syncing logic for Typesense.
-
-
infra/
: Configures Kubernetes resources, currently just the Typesense servers.
-
.github/
: Configuration for Github Actions workflows -
.vscode/
: Configuration for shared VSCode settings -
scripts/
: One-off scripts and admin tools for managing the application. In particular,yarn typesense-admin
andyarn firebase-admin
are cli tools for typesense- and firebase-related things. -
tests/
: Integration and system tests for the application, primarily integration tests. Integration tests run in a browser-like environment against a local Typesense server and emulated Firebase services. Start the emulated services withyarn compose up
and run the tests withyarn test:integration
-
analysis/
: Notebooks and scripts related to legislative process visualizations and history parsing.