Gravity
  • Welcome to Gravity
  • Getting Started
  • Stack
  • Updates
  • Rules For AI
  • Troubleshooting
  • Gravity Server
    • Introduction
    • Installation
      • Install Node.js
      • Database Setup
      • Stripe Setup
      • Mailgun Setup
      • Install Gravity
    • Application Structure
    • REST API
      • API Scopes
      • Webhooks
    • Authentication
      • Email Verification
      • Social Sign On
      • Two-Factor Authentication
    • Authorization
      • Feature Access and Plan Restrictions
      • Permissions (Roles)
    • Config
    • Environment Variables
    • Database Queries
    • Handling Errors
    • Logging
    • Localization
    • Push Notifications
    • Email Notifications
    • User Feedback
    • User Onboarding
    • File Uploads
    • Billing
      • Seat Billing
      • Usage Billing
    • Free Accounts
    • CLI Toolbelt
    • Testing
    • AI Tools
    • Background Jobs
    • Deployment
  • Gravity Web
    • Introduction
    • Tailwind & SCSS
    • Routing
    • Events
    • Authentication
    • Localization
    • Hooks
      • useAPI
      • usePlans
      • usePermissions
    • Components
      • Alert
      • Animate
      • Avatar
      • Badge
      • Breadcrumb
      • Button
      • Calendar
      • Card
      • Chart
      • Checklist
      • Credit Card
      • Detail
      • Dialog
      • Dropdown
      • Feedback
      • Form
      • Grid
      • Header
      • Helper
      • Icon
      • Image
      • Layout
      • Link
      • List
      • Loader
      • Logo
      • Nav
      • Onboarding
      • Pagination
      • Popover
      • Progress
      • Row
      • Search
      • Separator
      • Sheet
      • Social
      • Stat
      • Table
      • Tabs
      • Toast (Notification)
      • Tooltip
      • User
      • View
    • Views
    • Handling Errors
    • Deployment
  • Gravity Native
    • Introduction
    • Prerequisites
    • Installation
    • App Context
    • Authentication
    • Localisation
    • External Linking
    • Handling Errors
    • Navigation
    • Config
    • Events
    • Views
    • Components
      • Badge
      • Blankslate
      • Button
      • Card
      • Chart
      • Form
      • Global
      • Grid
      • Icon
      • List
      • Logo
      • Message
      • Modal
      • Nav
      • Notification
      • Progress Bar
      • Search
      • Separator
      • Social
      • Stat
      • View
    • Push Notifications
    • Payments
    • Building Your App
  • Mission Control
    • Introduction
    • Installation
    • User Management
    • Feedback
    • Events
    • Logs
  • Website Template
    • Introduction
    • Environment Variables
    • Styling
    • Components
      • Article
      • Feature List
      • Footer
      • Hero
      • Layout
      • Pricing
      • Meta Data
      • Nav
      • Testimonial
    • Build and Deploy
Powered by GitBook
On this page
  • 1. Add Database, Social & Mailgun Settings
  • 2. Install Expo
  • 3. Download the Expo Mobile Client
  • 4. Install Gravity Native
  • 5. Install ngrok (optional)
  • Running Your App
  • Running in a Simulator

Was this helpful?

  1. Gravity Native

Installation

PreviousPrerequisitesNextApp Context

Last updated 1 year ago

Was this helpful?

1. Add Database, Social & Mailgun Settings

Navigate to the folder where you downloaded Gravity and open the .env & /config/default.json files located in the /server folder and then populate your database and Mailgun credentials.

If you're on the Power plan, you can use the setup wizard included with the React web client.

To use social sign-ons you must add your Facebook and Twitter API keys to the .env file and also the callback URLs to /config. .

You must complete this step before proceeding.

2. Install Expo

The Expo CLI will enable you to perform various Expo tasks, like running and building your app.

npm install expo

3. Download the Expo Mobile Client

On your iOS or Android mobile device, visit the respective app store, download the Expo mobile client then .

4. Install Gravity Native

The installation process is the same as described in the , except you must specify your desired database driver if not using MySQL.

// standard (mysql2)
npm run setup

// mongo
npm run setup db:mongo

// postgres
npm run setup db:pg

This will install all of the dependencies required. Once the installation process has finished, you can start your app:

cd app
npx expo start

If you open the Expo mobile app or iOS or Android simulator, you can see your app.

Inside /app/config.json is a baseURL setting that points to the Gravity server for making API calls. During setup, this will be automatically set to your local network address, but you should update this to point to your development server.

5. Install ngrok (optional)

Once installed, please update the callback_url inside the /config folder files and also the baseURL value inside app/config.json

Running Your App

Finally, to run your app any time, enter the following command.

npx expo start

This will start both Gravity Server and the Expo client.

Running in a Simulator

Once your Expo server is running, you can open your app in the Android simulator by pressing a or i to open the iOS simulator.

If you want to use social sign-ons in your application, you must to handle the redirects.

See the section on Social Sign-Ons for more information
register a free account
server installation instructions
install ngrok