This guide provides step-by-step instructions for setting up and running the Expo React Native application and FastAPI server from the GitHub repository. It is designed for users who are interacting with this code for the first time.
Before starting, ensure you have the following installed:
- Node.js and npm (Node Package Manager)
- Python 3.x
- Expo CLI for React Native
- A text editor or IDE of your choice (e.g., Visual Studio Code)
- Open a terminal or command prompt.
- Navigate to the directory where you want to clone the repository.
- Run:
git clone https://github.com/vanamagautam24/document_scanner_cmsc673.git
- Navigate to the cloned repository's directory:
cd client - Run:
npm installto install all the necessary dependencies.
- Ensure that Expo CLI is installed globally on your machine. If not, install it by running:
npm install -g expo-cli - In the same directory as your Expo project, run:
expo start - Open the Expo app on your mobile device and scan the QR code provided in the terminal.
- Alternatively, you can use an iOS or Android simulator on your computer.
- If not already done, open a new terminal or command prompt.
- Navigate to the directory where you want to clone the repository.
- Run:
git clone https://github.com/vanamagautam24/document_scanner_cmsc673
- Navigate to the FastAPI repository's directory:
cd api. - Run:
pip install -r requirements.txtto install all the required Python packages.
- In the FastAPI directory, run:
uvicorn api.main:app --reload - The FastAPI server will start, and you can access the API at
http://127.0.0.1:8000 - For API documentation, navigate to
http://127.0.0.1:8000/docs
-
Check if you have Node.js installed by running the following command in your terminal: node -v If Node.js is not installed, download and install it from nodejs.org.
-
Once Node.js is installed, you can install ngrok globally using npm (Node Package Manager). npm install -g ngrok
-
Make sure you have a local web server running on port 8000.
-
In your terminal, navigate to the directory where your web server is running.
-
Run your web server. Refer to step 3.3 uvicorn api.main:app --reload
-
With your web server running, open a new terminal window or tab.
-
To expose your local web server to the internet using ngrok, use the following command: ngrok http 8000
-
Ngrok will generate a public URL (usually in the format
https://randomstring.ngrok.io) that you can use to access your local web server from anywhere. Copy and paste this obtained URL and replace the existing URL in the ngrokUrl variable in the following files located in the client/screens folder:
PreviewScreen.tsxSignInScreen.tsxCameraScreen.tsx
cd api python -m unittest tests.helpers_test python -m unittest tests.users_test
Following these steps should set up and run both the Expo React Native application and the FastAPI server on your local machine. For further assistance or troubleshooting, submit an issue on GitHub.