Getting Started
To get started, clone the repository, change directory and install the dependencies:
git clone https://github.com/kiwicom/margarita
cd margarita/
yarn
Initial Configuration: setting environment variables
Copy and rename following sample files:
- .env-sample → .env
- apps/graphql/.env-sample → apps/graphql/.env
Set environment variables in files:
.env:
GRAPHQL_URL- URL of GraphQL server
- E. g.:
'http://127.0.0.1:4000/graphql'
FIREBASE_API_KEYFIREBASE_AUTH_DOMAINFIREBASE_DATABASE_URLFIREBASE_PROJECT_IDFIREBASE_STORAGE_BUCKETFIREBASE_MESSAGING_SENDER_ID- Variables for sample Firebase implementation
- Optional - can be left empty
- More info: Guide: Firebase implementation
GOOGLE_OAUTH_IOSGOOGLE_OAUTH_ANDROID- Variables for user Google login in native version
- Optional - can be left empty
- More info: Guide: Firebase implementation
SITE_ID- Used for Netlify deploys (previously no support for Monorepo multi-deploys)
- for Margarita:
SITE_ID=@kiwicom/margarita-web - for Storybook:
SITE_ID=@kiwicom/universal-components
apps/graphql/.env:
API_KEY- Get your API key here: https://tequila.kiwi.com
BASE_URL- URL of REST server
- E. g.:
'https://kiwicom-test.apigee.net/'
NODE_ENV- Type of NodeJS environment.
- E. g.:
'development'
Available scripts
To launch the GraphQL server:
yarn server
To launch the client app, you have different options:
yarn webto launch the development web version;yarn export; yarn build; yarn startto launch the production web version;yarn mobileto start the mobile version.
Note: If yarn server is running and you get Network errors on Android, you might need to forward your localhost:4000 to the emulator; this is achieved by running adb reverse tcp:4000 tcp:4000.
The other available scripts are:
yarn web:analyzeto get an analysis of the bundle size to get the following
yarn devto run concurrentlyyarn serverandyarn web;yarn lintto ensure your code is properly formatted;yarn flowto ensure your code is respecting the types given to your vaiables;yarn testto run the test suites;yarn test-cito ensure your code should pass the Continuous Integration (CI) tests;yarn relayto get the latest schema of the graphql server and compile your queries and fragments to generate Flow types, among other things;yarn landing-pageto run the landing page of the app;yarn docsto run the documentation website, available at http://localhost:1337/margarita/;yarn voyagerto run the Voyager (represents the GraphQL types as an interactive graph), available at http://localhost:3002;storybook:web:margarita-componentsto run the web version of the Storybook for@kiwicom/margarita-components, available at http://localhost:9009;storybook:mobile:margarita-componentsto run the mobile version of the Storybook for@kiwicom/margarita-components, available at http://localhost:7007 for the web UI controlling the Storybook Expo application;storybook:web:universal-componentsto run the web version of the Storybook for@kiwicom/universal-components, available at http://localhost:9009;storybook:mobile:universal-componentsto run the mobile version of the Storybook for@kiwicom/universal-components, available at http://localhost:7007 for the web UI controlling the Storybook Expo application.
