|
| 1 | +# Setup |
| 2 | + |
| 3 | +This document provides step-by-step instructions for setting up the Friendly Eats application for local development. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +* [Node.js](https://nodejs.org/en/download) (version 16.0 or higher) |
| 8 | +* [Java](https://jdk.java.net/) (JDK version 11 or higher) |
| 9 | +* [Angular CLI](https://angular.io/cli) |
| 10 | +* [Firebase CLI](https://firebase.google.com/docs/cli) |
| 11 | + |
| 12 | +## Installation |
| 13 | + |
| 14 | +1. **Clone the repository:** |
| 15 | + |
| 16 | + ```bash |
| 17 | + git clone https://github.com/firebase/quickstart-js.git |
| 18 | + cd quickstart-js/firestore |
| 19 | + ``` |
| 20 | + |
| 21 | +2. **Install dependencies:** |
| 22 | + |
| 23 | + ```bash |
| 24 | + npm install |
| 25 | + (cd functions && npm install) |
| 26 | + (cd scripts && npm install) |
| 27 | + ``` |
| 28 | + |
| 29 | +## Configuration |
| 30 | + |
| 31 | +1. **Configure Firebase:** |
| 32 | + |
| 33 | + The application can be run against the Firebase Local Emulator Suite or a production Firebase project. |
| 34 | + |
| 35 | + * **Emulator Suite:** No configuration is needed. The necessary settings are in `src/environments/environment.default.ts`. |
| 36 | + |
| 37 | + * **Production Project:** |
| 38 | + |
| 39 | + 1. Create a Firebase project in the [Firebase Console](https://console.firebase.google.com). |
| 40 | + 2. Copy the `firebaseConfig` object from your project settings. |
| 41 | + 3. Paste the `firebaseConfig` object into `src/environments/environment.prod.ts`. |
| 42 | + |
| 43 | +## Running the Application |
| 44 | + |
| 45 | +1. **Run the application:** |
| 46 | + |
| 47 | + * **With emulators:** |
| 48 | + |
| 49 | + ```bash |
| 50 | + npm start |
| 51 | + ``` |
| 52 | + This command will start the Firebase Emulator Suite and the Angular development server. The emulators are automatically populated with data from the `app-data-seed` directory on startup. |
| 53 | + |
| 54 | + * **Against a production project:** |
| 55 | + |
| 56 | + ```bash |
| 57 | + npm run production |
| 58 | + ``` |
| 59 | + |
| 60 | +2. **View the application:** |
| 61 | + |
| 62 | + Open your browser and navigate to `http://localhost:4200`. |
| 63 | + |
| 64 | +3. **Populating the database (optional):** |
| 65 | + |
| 66 | + If you need to add more mock data to your database, you can use the following commands: |
| 67 | + |
| 68 | + * **For emulators:** |
| 69 | + ```bash |
| 70 | + npm run populate-emulators |
| 71 | + ``` |
| 72 | + |
| 73 | + * **For a production project:** |
| 74 | + ```bash |
| 75 | + npm run populate-production |
| 76 | + ``` |
0 commit comments