GithubHelp home page GithubHelp logo

matthieucoisne / yelpexplorer-reactnative Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 3.69 MB

React Native application that demonstrates the differences between using a REST API versus a GraphQL API while following the best practices using TypeScript, Clean Architecture, Hooks, State Management, Tests...

License: Apache License 2.0

TypeScript 81.01% JavaScript 1.74% Java 9.63% Ruby 3.12% Objective-C 3.01% Objective-C++ 1.49%
graphql typescript react-native hooks test rest clean-architecture

yelpexplorer-reactnative's Introduction

YelpExplorer-ReactNative

build

Project Description

YelpExplorer is a multiplatform project that shows a list of businesses, their details and latest reviews using Yelp's API.

I originally created this project to learn about GraphQL but since Yelp is also serving its data with a REST API, I thought it would be a great opportunity to showcase the power of Clean Architecture when it comes to being able to swap one data layer for another without having to modify the domain and presentation layers.

I then thought it would be a great experience to port the Android project to Flutter and ReactNative to learn more about all the different technologies that exist to build multiplatform applications.


Note

While Clean Architecture is known and used by the Android and the Flutter community, it is not much the case for ReactNative... but at least the ReactNative variant of this project demonstrates that it is possible to adopt it. For a simpler architecture, please check this branch.


This project is available in:
Compose/Kotlin
Flutter/Dart
ReactNative/TypeScript

Screenshots

Business List Business Details
YelpExplorer-React Native - Business List YelpExplorer-React Native - Business Details

Project Characteristics

Tech Stack

Development Setup

How to run the project

  1. Setup your dev environement: https://reactnative.dev/docs/environment-setup

  2. Clone this project using Git or download the source code.

  3. Install the dependencies:

    > npm install
    > cd ios
    > pod install
    
  4. Start the Metro server:

    > npm start
    
  5. Run the app:

    > npm run ios
    

Yelp API Key

If you want to run this project on an device or an emulator, you need to obtain your own API key from Yelp and provide it to the app.

  1. Request your API key: https://www.yelp.com/developers/documentation/v3/authentication
  2. Create a config folder located in this project's root folder. Then, create a app_config.json file in that config folder and add your API key like this:
    {
      "api_key": "YOUR_API_KEY"
    }
    

REST vs GraphQL

This project allows you to either use the GraphQL API or the REST API to retrieve data.
To switch between one or the other, you can change the value of DATASOURCE in Constants.ts.

Author

Follow me

License

Copyright 2021-Present Matthieu Coisne

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

yelpexplorer-reactnative's People

Contributors

matthieucoisne avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

yelpexplorer-reactnative's Issues

Improve the clean architecture implementation

Do not use the useQuery hook from apollo anymore
Create classes for usecases, repositories and datasources, with interfaces so we could add a rest implementation of the data layer and swap between graphql and rest just by flipping a switch and not touching the domain/presentation layers

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.