Margarita Monorepo

Margarita Monorepo

  • First time here?
  • Developers
  • Got a question?
  • GitHub

›Developing

Home

  • What is this all about?
  • Web and Mobile demos
  • Features
  • What is Tequila API?
  • Questions/Bugs/Feature Requests

Developing

  • Getting Started
  • Contributing
  • Folder Structure
  • Technical Overview
  • Guide: Get your Tequila API key
  • Guide: Firebase implementation

Apps

  • List of Apps
  • GraphQL Server
  • Mobile
  • Web

Packages

  • List of Packages
  • Universal Components

    • Introduction
    • Getting Started
    • Contributing
  • Margarita Components

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

  1. Copy and rename following sample files:

    • .env-sample → .env
    • apps/graphql/.env-sample → apps/graphql/.env
  2. Set environment variables in files:

    .env:

    • GRAPHQL_URL
      • URL of GraphQL server
      • E. g.: 'http://127.0.0.1:4000/graphql'
    • FIREBASE_API_KEY
    • FIREBASE_AUTH_DOMAIN
    • FIREBASE_DATABASE_URL
    • FIREBASE_PROJECT_ID
    • FIREBASE_STORAGE_BUCKET
    • FIREBASE_MESSAGING_SENDER_ID
      • Variables for sample Firebase implementation
      • Optional - can be left empty
      • More info: Guide: Firebase implementation
    • GOOGLE_OAUTH_IOS
    • GOOGLE_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 web to launch the development web version;
  • yarn export; yarn build; yarn start to launch the production web version;
  • yarn mobile to 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:analyze to get an analysis of the bundle size to get the following
  • yarn dev to run concurrently yarn server and yarn web;
  • yarn lint to ensure your code is properly formatted;
  • yarn flow to ensure your code is respecting the types given to your vaiables;
  • yarn test to run the test suites;
  • yarn test-ci to ensure your code should pass the Continuous Integration (CI) tests;
  • yarn relay to get the latest schema of the graphql server and compile your queries and fragments to generate Flow types, among other things;
  • yarn landing-page to run the landing page of the app;
  • yarn docs to run the documentation website, available at http://localhost:1337/margarita/;
  • yarn voyager to run the Voyager (represents the GraphQL types as an interactive graph), available at http://localhost:3002;
  • storybook:web:margarita-components to run the web version of the Storybook for @kiwicom/margarita-components, available at http://localhost:9009;
  • storybook:mobile:margarita-components to 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-components to run the web version of the Storybook for @kiwicom/universal-components, available at http://localhost:9009;
  • storybook:mobile:universal-components to 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.
Last updated on 11/29/2019 by Robin Cussol
← Questions/Bugs/Feature RequestsContributing →
  • Initial Configuration: setting environment variables
  • Available scripts
Copyright © 2019 Kiwi.com