-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: modify docs to comply with new standard
- Loading branch information
1 parent
59292bd
commit 48a406d
Showing
14 changed files
with
191 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
VITE_APP_API_URL=http://localhost:3000 | ||
VITE_APP_ANOTHER_API_URL=http://localhost:3000 | ||
VITE_APP_GRAPHQL_PROXY_ENDPOINT=https://graphqlzero.almansi.me | ||
VITE_APP_REST_PROXY_ENDPOINT=https://jsonplaceholder.typicode.com | ||
VITE_APP_SENTRY_DSN=project_dsn | ||
VITE_APP_SENTRY_ENABLED=false | ||
SENTRY_ENVIRONMENT=dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
VITE_APP_API_URL=http://localhost:3000 | ||
VITE_APP_ANOTHER_API_URL=http://localhost:3000 | ||
VITE_APP_GRAPHQL_PROXY_ENDPOINT=https://graphqlzero.almansi.me | ||
VITE_APP_REST_PROXY_ENDPOINT=https://jsonplaceholder.typicode.com | ||
VITE_APP_SENTRY_DSN=project_dsn | ||
VITE_APP_SENTRY_ENABLED=false | ||
SENTRY_ENVIRONMENT=dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,90 +1,31 @@ | ||
|
||
## Base Mr. Milu: React.js | ||
|
||
### Index and features | ||
|
||
- [Vite](https://github.com/vitejs/vite) | ||
- Clean architecture | ||
- Dependency Injection ([Inversify](https://github.com/inversify/InversifyJS)) | ||
- Typescript | ||
- [Class transformers](https://github.com/typestack/class-transformer) | ||
- [Zustand](https://github.com/pmndrs/zustand) | ||
- [Apollo Client (GraphQL)](https://github.com/apollographql/apollo-client) | ||
- [Commitlint](docs/comitlint.md) (with [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) config) | ||
- [Vanilla extract](https://vanilla-extract.style/) | ||
- ESLint (with TypeScript config) | ||
- Prettier | ||
- [Error boundary](docs/error_boundary.md) | ||
- [react-i18next](docs/i18next.md) ([i18next react official documentation](https://react.i18next.com/)) | ||
- [Development proxy server](docs/dev_proxy.md) | ||
- [React Router 6](https://reactrouter.com/en/main) | ||
- Sentry | ||
|
||
### Prerequisites | ||
|
||
This project uses the following packages | ||
|
||
- [nvm](https://github.com/nvm-sh/nvm) (Node version manager) | ||
- [Just](https://just.systems/man/en/chapter_4.html) (For justfile usage) | ||
|
||
Run the following command to install the node version declared in the `.nvmrc` | ||
file for this project: | ||
|
||
```shell | ||
nvm install | ||
``` | ||
|
||
Finally, enable [corepack](https://github.com/nodejs/corepack) so the correct | ||
version of pnpm is used. | ||
|
||
```shell | ||
just corepack-enable | ||
``` | ||
|
||
### First steps | ||
|
||
**Install dependencies** | ||
|
||
```shell | ||
just install-deps | ||
``` | ||
|
||
**Run project** | ||
|
||
In one terminal shell | ||
|
||
```shell | ||
just dev | ||
``` | ||
|
||
And in another shell | ||
|
||
```shell | ||
just ioc-generate-watch | ||
``` | ||
|
||
**See a list of available commands** | ||
|
||
```shell | ||
just | ||
``` | ||
|
||
**Proxy commands through nvm** | ||
|
||
```shell | ||
just nvm-exec "pnpm add @front_web_mrmilu/hooks" | ||
``` | ||
|
||
### Environment variables | ||
|
||
Create a `.env.development.local` file with your environment variables with the following defaults for dev server | ||
|
||
``` | ||
VITE_APP_API_URL=http://localhost:3000 | ||
VITE_APP_ANOTHER_API_URL=http://localhost:3000 | ||
VITE_APP_GRAPHQL_PROXY_ENDPOINT=https://graphqlzero.almansi.me | ||
VITE_APP_REST_PROXY_ENDPOINT=https://jsonplaceholder.typicode.com | ||
VITE_APP_SENTRY_DSN=project_dsn | ||
VITE_APP_SENTRY_ENABLED=false | ||
SENTRY_ENVIRONMENT=dev | ||
``` | ||
# React Base | ||
|
||
Milú React base project | ||
|
||
## Docs | ||
- [Clean Architecture] (to include link to front.docs) | ||
- [Commit Lint] (to include link to front.docs) | ||
- [Craco](./docs/craco.md) | ||
- [Dependencies](./docs/dependencies.md) | ||
- [Development environment setup](./docs/dev-environment-setup.md) | ||
- [Development proxy](./docs/dev-proxy.md) | ||
- [Environment variables](./docs/environment-variables.md) | ||
- [ErrorBoundary](./docs/error-boundary.md) | ||
- [Internationalization](./docs/i18next.md) | ||
- [Justfile Commands](./docs/justfile-commands.md) | ||
- [Run development server](./docs/run-development-server.md) | ||
- [Run production build](./docs/run-production-build.md) | ||
|
||
## Versions | ||
|
||
This project uses the following versions and has been tested in this context | ||
(please check if that works with yours): | ||
|
||
| Service | Version | Usage | | ||
|------------|----------|--------------------| | ||
| `node` | `20.x` | `*` | | ||
| `pnpm` | `9.4.0` | `package.json` | | ||
| `just` | `1.x` | `justfile` | | ||
|
||
### Authors | ||
By Milú |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Dependencies | ||
|
||
## Relevant used dependencies | ||
|
||
- [Vite](https://github.com/vitejs/vite) | ||
- Clean architecture | ||
- Dependency Injection ([Inversify](https://github.com/inversify/InversifyJS)) | ||
- Typescript | ||
- [Class transformers](https://github.com/typestack/class-transformer) | ||
- [Zustand](https://github.com/pmndrs/zustand) | ||
- [Apollo Client (GraphQL)](https://github.com/apollographql/apollo-client) | ||
- [Commitlint](docs/comitlint.md) (with [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) config) | ||
- [Vanilla extract](https://vanilla-extract.style/) | ||
- ESLint (with TypeScript config) | ||
- Prettier | ||
- [Error boundary](docs/error_boundary.md) | ||
- [react-i18next](docs/i18next.md) ([i18next react official documentation](https://react.i18next.com/)) | ||
- [Development proxy server](docs/dev_proxy.md) | ||
- [React Router 6](https://reactrouter.com/en/main) | ||
- Sentry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Dev environment setup | ||
|
||
## Requirements | ||
These are the requirements to run a development environment: | ||
|
||
- [nvm](https://github.com/nvm-sh/nvm) (Node version manager) | ||
- [just](https://github.com/casey/just) | ||
|
||
## Steps | ||
|
||
1. Run the following command to install the node version declared in the `.nvmrc` file for this project: | ||
|
||
```shell | ||
nvm install | ||
``` | ||
|
||
2. Enable [corepack](https://github.com/nodejs/corepack) so the correct | ||
version of [pnpm](https://pnpm.io/motivation) is used. | ||
|
||
```shell | ||
just corepack-enable | ||
``` | ||
|
||
3. Install the project dependencies. | ||
|
||
```shell | ||
just install-deps | ||
``` | ||
|
||
4. Generate the GQL schemas. | ||
|
||
```shell | ||
just graphql-codegen | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Environment variables | ||
|
||
> ℹ️ .env variables are loaded automatically by Vite. Refer to this documentation for more information. [Loading Environment Variables](https://vitejs.dev/guide/env-and-mode#env-files). | ||
> Good to know: `.env`, `.env.development`, and `.env.production` files should be included in your repository as they define defaults. .env*.local should be added to .gitignore, as those files are intended to be ignored. .env.local is where secrets can be stored. | ||
## Values | ||
|
||
| Key | Responsible | Type | Secret | Policy | Default value | Description | Docs | | ||
| --------------------------------- | ----------- | --------- | ------ | ------------------------- | ----------------------- | ---------------------------------- | ---------------------------------------------------------------------- | | ||
| `VITE_APP_API_URL` | DevOps | `string` | No | `DEFAULT` | `http://localhost:3000` | GQL API URL URL | | ||
| `VITE_APP_ANOTHER_API_URL` | DevOps | `string` | No | `DEFAULT` | `http://localhost:3000` | REST API URL URL | - | | ||
| `VITE_APP_GRAPHQL_PROXY_ENDPOINT` | DevOps | `string` | No | `REQUIRED-IN-RELEASE-ENV` | - | GQL Proxy Endpoint URL | - | | ||
| `VITE_APP_REST_PROXY_ENDPOINT` | DevOps | `string` | No | `REQUIRED-IN-RELEASE-ENV` | - | REST Proxy Endpoint DSN | | | ||
| `VITE_APP_SENTRY_DSN` | DevOps | `string` | No | `REQUIRED-IN-RELEASE-ENV` | - | Sentry DSN | [Sentry DSN](https://docs.sentry.io/concepts/key-terms/dsn-explainer/) | | ||
| `VITE_APP_SENTRY_ENABLED` | DevOps | `boolean` | No | `FEATURE-FLAG` | - | Enables/Disables Sentry monitoring | - | | ||
|
||
## Policies | ||
- `DEFAULT`: This environment variable has a default value that works on most common usages | ||
- `REQUIRED`: This environment variable must be set, otherwise the application will not start throwing an exception | ||
- `REQUIRED-IN-RELEASE-ENV`: This environment variable must be set in release environments, the application will start but won't comply requirements: security, functionality, integration, performance, etc | ||
- `FEATURE-FLAG`: This environment variable changes a feature behavior | ||
- `DEPRECATED`: Deprecated variables, see deprecated variables section | ||
|
||
## Types | ||
- `boolean`: string variable containing a boolean value | ||
- `string`: string variable | ||
- `fs_path`: string variable containing a path in the file system | ||
- `email`: string variable containing an email | ||
- `string-list-by-comma`: list string values extracted by: split (using `,` as the separator) and trim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# React Base Justfile Commands 🦀 🚀 | ||
|
||
Run `just` to display the list of available commands. | ||
|
||
## What is just? | ||
|
||
`just` is a handy way to save and run project-specific commands. Commands, called recipes, are stored in a file called `justfile` with syntax inspired by `make`. | ||
|
||
## Commands List | ||
|
||
- `just corepack-enable`: Enables Corepack in Node.js. | ||
- `just install-deps`: Installs the dependencies listed in the project's package.json. | ||
- `just dev`: Starts the vite development server. | ||
- `just debug`: Starts the vite debug server. | ||
- `just build`: Builds the vite application. | ||
- `just preview`: Builds the vite application in preview mode. | ||
- `just clean`: Cleans the vite cache | ||
- `just start`: Starts the server for the built Next.js application. | ||
- `just prettier-fix:`: Runs formatting. | ||
- `just ioc-generate`: Generates Inversify bindings. | ||
- `just ioc-generate-watch`: Generates Inversify bindings and watches for changes. | ||
- `just commit`: Commits changes using commitlint. | ||
- `just graphql-codegen`: Downloads schema and generates corresponding ts types. | ||
- `just e2e-run`: Runs E2E tests. | ||
- `just e2e-open`: Runs E2E tests UI. | ||
- `just commit`: Commit files using commitlint. | ||
- `just nvm exec {{command}}`: Proxies a command through nvm. Replace `{{command}}` with the desired command to execute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Run development server | ||
|
||
```shell | ||
just ioc-generate-watch # in one terminal | ||
just dev # in another | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Run production build | ||
|
||
First generate the dependency injection files: | ||
```shell | ||
just ioc-generate | ||
``` | ||
|
||
Then generate the graphql types: | ||
```shell | ||
just graphql-codegen | ||
``` | ||
|
||
Next run a production build: | ||
|
||
```shell | ||
just build | ||
``` | ||
|
||
Finally execute the `vite preview` server: | ||
|
||
```shell | ||
just preview | ||
``` | ||
|
||
This command uses under the hood the `vite preview` command. For more information refer to [Deploying a Static Site](https://vitejs.dev/guide/static-deploy.html#deploying-a-static-site) documentation where `vite preview` is explained. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters