Skip to content

Commit

Permalink
add project directory structure to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ndinata committed Oct 12, 2024
1 parent 0b081d0 commit 5fcf710
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,25 @@ $ pnpm create avid-app@latest <your_project_name>
```


## Project structure
```
.
├── assets/ # Static asset files (images, icons, etc.)
├── src/
│ ├── app/ # Navigators and screens
│ ├── services/ # Services (api, storage, etc.)
│ ├── theme/ # App theme provider
│ ├── ui/ # UI primitives (button, text, etc.)
│ └── env.ts # Read up on "Env management" in the readme
├── .env.development # Env file for local dev
├── index.js # Main entrypoint to the app
├── app.config.ts # Expo config file
├── build-env.ts # Read up on "Env management" in the readme
└── tailwind.config.js # Tailwind config used by `twrnc` (read up on "Styling")
```


## Configuration
These packages are included out of the box:
- ESLint, Prettier, TypeScript
Expand Down Expand Up @@ -78,6 +97,7 @@ you define don't need to be preprended with `EXPO_PUBLIC` (although you should
still **assume that they're accessible by your users!**).

#### Adding an env variable
<details>

1. Add the key-value pair to any/all of these env files:
- `.env.development`
Expand Down Expand Up @@ -118,11 +138,19 @@ async function getUsers(): Promise<User> {
}
```

</details>

#### Removing an env variable
<details>

Remove the env variable from both the env file (e.g. `.env.development`) **and**
the schema in `build-env.ts`.

</details>

#### Activating specific environments
<details>

To choose which environment to load variables from, set the `APP_ENV` env variable
to either one of: `development (default if unspecified) | preview | production`.
`pnpm` scripts have been added to help simplify this.
Expand All @@ -147,7 +175,11 @@ to either one of: `development (default if unspecified) | preview | production`.
}
```

</details>

#### How are `src/env.ts` and `app.config.ts` involved in the process?
<details>

If env variables are successfully parsed according to the defined schema, they
are consumed in [`app.config.ts`](./app.config.ts) as Expo extra fields. These
fields are then re-exported by [`src/env.ts`](./src/env.ts) to the rest of the
Expand All @@ -157,6 +189,8 @@ app (screens/components).
of consuming env variables. This file doesn't need to be modified at all (unless
you're changing the entire mechanism of defining and consuming env variables).

</details>


## License
Licensed under MIT.

0 comments on commit 5fcf710

Please sign in to comment.