This is a repository that contains necessary project files for the iFarmo's backend server.
Below is the diagram that shows the architecture of the API and technologies used. The API itself is a RESTful NodeJS application with multiple endpoints that connect the frontend (ReactNative mobile app), the MongoDB Atlas cloud database (for storing data), and the AWS S3 cloud storage (for images).
The API is deployed on Heroku, and its API calls are accessible via link: https://nodejs-ifarmo.herokuapp.com/api/.
The documentation for the API is available at link: https://documenter.getpostman.com/view/13899012/UyxbrqHi.
- Install npm (node package manager) https://nodejs.org/en/download/.
- Install VSCode with plugin "Prettier".
- Install Postman for API testing.
- [Optional] Install desired VSCode plugins to easen your coding.
- [Optional] Install GitHub Desktop.
- Create a MongoDB account.
- Create a project, a cluster, and a database for this app, or request to be added to an existing cloud database.
- In the specified cluster, click Connect, then choose Connect to your cloud application, copy the connection link, replace the necessary keywords, and add that link to the .env file (later in the next section).
- Open terminal in the project's folder.
- Install required packages using
npm ci
.Note
: You may usenpm install <your_module>
to install additional modules but do NOT usenpm install
to install required modules listed in package.json to avoid version conflicts, and instead usenpm ci
in those cases. For more information, check here: https://stackoverflow.com/questions/48524417/should-the-package-lock-json-file-be-added-to-gitignore.~~ - Create .env file in the project's folder and add your database connection link using username and password for the MongoDB database (reference to the section above), Token secret, and Port number like so:
DB_CONNECTION = ... TOKEN_SECRET = ... PORT = ... ```
- Run
npm start
to run the server.
The iFarmo front-end is React Native mobile on Expo. For more information, visit the GitHub repository link: https://github.com/Chris-Hayashi/iFarmo-Front-End