Skip to content

Commit

Permalink
docs: add STRUCTURE.md explanation & guidelines
Browse files Browse the repository at this point in the history
  • Loading branch information
Harjot1Singh committed Jan 10, 2022
1 parent b2d5faa commit 4b80624
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This document is for developers or programmers contributing to the source code o
- [Prerequisites](#prerequisites)
- [Build](#build)
- [Run](#run)
- [Project Structure](#project-structure)
- [Fastlane](#fastlane)
- [Workflow](#workflow)
- [Coding Guidelines](#coding-guidelines)
Expand Down Expand Up @@ -92,6 +93,10 @@ test # Typechecks + Unit + integration tests

**NOTE**: If having issues starting the emulator, try cleaning your build files and running `npm i`.

## Project Structure

For information on how this project is structured, please see the [./docs/STRUCTURE.md](structure) documentation.

## Fastlane

`fastlane` is automation tool for deployments for iOS and Android. We use this to sign code and bump versions for releases. To setup `fastlane` locally you need to have [`ruby`](https://www.ruby-lang.org/en/documentation/installation/)installed.
Expand Down
100 changes: 100 additions & 0 deletions STRUCTURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Project Structure

Welcome to our app's codebase! Shabad OS Mobile is a [React Native](https://reactnative.dev/) app for both iOS and Android.

This is a living document to capture and share the stucture of the app to make it easier to understand where existing code lives and where new code should go.

## Project Root

The following is a reduced, annotated listing of the project's root directory (generated with `tree -L 1 -F --dirsfirst -a`) to provide a high-level overview of purpose.

```
.
├── android/ Native Android project
├── assets/ All custom fonts & global images
├── config/ Environmnent specific configuration variables
├── docs/ Supporting documentation & corresponding assets
├── fastlane/ App-specific build & release code driven by Fastlane
├── ios/ Native iOS project
├── metadata/ Cross-platform app store metadata (e.g. app icon)
├── release-notes/ Version release notes
├── src/ Source code for app
├── test/ Shared test utilities
└── index.js App entrypoint for React Native code
```

As a contributor, you'll likely spend the majority of your time inside the [src](#source-code) folder.

## Configuration

Dotenv configuration files are stored inside the `config` folder, with a file per environment. More information can be found inside the [Configuration README document](./config/README.md).

## Source Code

The `src` directory contains all source code and is split into the following high-level folders:

```
src
├── components/
├── helpers/
├── screens/
├── services/
├── themes/
├── types/
├── App.spec.tsx
└── App.tsx
```

### Components

Components are the fundamental visual building blocks of the app and can be composed to form more complex components.

Styles and internationalisation strings should be colocated or inlined with the corresponding components.

Tests should be colocated as `[Component].spec.tsx` file.

### Screens

Screens are the views ultimately presented to a user, comprised of templates and other components. If components used by the screen are not shareable across the app, they should be colocated with the screen.

Integration tests for screen should be colocated and written as `index.int.spec.tsx` in the screen's folder.

### Helpers

Helpers are generic, reusable, cross-cutting utilities. These should be small, lean, and composable.

### Services

Services are cross-cutting providers of specific functionality to the app. This can contain business logic, data accessors, and other providers that the app will use. Services can compose other services.

### Styles

Styles should typically be inlined with the concerned component, however in cases where shared or cross-cutting styling is required, the `themes` folder exists.

### Types

Types should typically be inlined or colocated with their concerns, however some types may be required globally (e.g. data definitions or utility types). These types should sit in the `types` folder.

## Tests

Tests should always be colocated with their concerns, and follow the [Arrange-Act-Assert](https://jefflau.dev/arrange-act-assert-how-to-test-react-components/) model. Test utilities may sit in the `test` folder.

#### Document TBC

### Unit Tests

### Integration Tests

### E2E Tests

End-to-end tests are tbd!

## Native Code

## Assets

## Building & Fastlane

## Pipelines

## Release Notes

0 comments on commit 4b80624

Please sign in to comment.