Skip to content

Getting Started

The easies way of creating a mycoriza react project is through the create-react-app cli. Use following commands to create a react application with mycoriza toolchain setup.

Prerequisites

Currently, mycoriza supports OpenAPI v3. OpenAPI v2 support is planned to be developed.

How to create a project.

Run following command to initiate a Mycoriza react project. This will create a react single page web application with necessary dependencies and toolchains.

npx create-react-app <project-name> --template mycoriza

Post-creation steps.

The mycoriza template contains the basic setup to boot up a mycoriza project. To add initial swagger source, run following command

1. Add sources.

cd <project-name>
npx mycoriza add

This will generate mycoriza.config.json, which contains the configuration of general flags and sources. While adding the sources to mycoriza, the necessary configurations related to the source are collected interactively. Please refer CLI Usage for further information.

The API client hooks and types can be generated by running following command.

2. Update API to generate the sources.

npm run updateApi

Once you complete these steps, you can find the following generated code.

Information about generated code.

Store

The store related configuration can be found in <project-root>/src/store This code is generated only once and can be modified according to the project needs.

API The domain types and the hooks can be found in <project-root>/src/api The changes you do in this codebase will be wiped out in each updateApi execution.

Mycoriza configurations

The configurations you add in the initial data updateApi call, are configurated in the package.json file.

Documentation

The API might be complicated and may requires additional time to understand. Therefore, a comprehensive documentation is generated during the updateApi phase, This API can be found in <project-root>/docs/api.