|
| 1 | +# Installation & Firebase setup |
| 2 | + |
| 3 | +This document explains how to get the project running locally and how to configure Firebase. |
| 4 | + |
| 5 | +Prerequisites |
| 6 | +- Node.js (version 18 or higher) |
| 7 | +- npm, yarn, or pnpm package manager |
| 8 | +- Firebase project with Firestore, Authentication, and Storage enabled |
| 9 | + |
| 10 | +Clone the repository |
| 11 | + |
| 12 | +```bash |
| 13 | +git clone https://github.com/xkmato/cinemaplot.git |
| 14 | +cd cinemaplot |
| 15 | +``` |
| 16 | + |
| 17 | +Install dependencies |
| 18 | + |
| 19 | +```bash |
| 20 | +npm install |
| 21 | +# or |
| 22 | +# yarn install |
| 23 | +# or |
| 24 | +# pnpm install |
| 25 | +``` |
| 26 | + |
| 27 | +Environment variables |
| 28 | + |
| 29 | +Copy the example environment file and update with your Firebase credentials: |
| 30 | + |
| 31 | +```bash |
| 32 | +cp .env.example .env.local |
| 33 | +``` |
| 34 | + |
| 35 | +Update `.env.local` with your Firebase configuration (values from your Firebase console): |
| 36 | + |
| 37 | +``` |
| 38 | +NEXT_PUBLIC_FIREBASE_API_KEY=your_firebase_api_key |
| 39 | +NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com |
| 40 | +NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id |
| 41 | +NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your_project.firebasestorage.app |
| 42 | +NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your_sender_id |
| 43 | +NEXT_PUBLIC_FIREBASE_APP_ID=your_app_id |
| 44 | +NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID=your_measurement_id |
| 45 | +``` |
| 46 | + |
| 47 | +Firebase configuration checklist |
| 48 | + |
| 49 | +- Create a new Firebase project at https://console.firebase.google.com |
| 50 | +- Enable Authentication with Google and Email Link providers |
| 51 | +- Enable Firestore Database |
| 52 | +- Enable Storage |
| 53 | +- (Optional) Enable Analytics |
| 54 | + |
| 55 | +Firestore rules (example) |
| 56 | + |
| 57 | +```javascript |
| 58 | +rules_version = '2'; |
| 59 | +service cloud.firestore { |
| 60 | + match /databases/{database}/documents { |
| 61 | + match /events/{eventId} { |
| 62 | + allow read: if true; |
| 63 | + allow write: if request.auth != null; |
| 64 | + } |
| 65 | + match /users/{userId} { |
| 66 | + allow read, write: if request.auth != null && request.auth.uid == userId; |
| 67 | + } |
| 68 | + } |
| 69 | +} |
| 70 | +``` |
| 71 | + |
| 72 | +Storage rules (example) |
| 73 | + |
| 74 | +```javascript |
| 75 | +rules_version = '2'; |
| 76 | +service firebase.storage { |
| 77 | + match /b/{bucket}/o { |
| 78 | + match /event-images/{allPaths=**} { |
| 79 | + allow read: if true; |
| 80 | + allow write: if request.auth != null; |
| 81 | + } |
| 82 | + } |
| 83 | +} |
| 84 | +``` |
| 85 | + |
| 86 | +Local emulators (optional) |
| 87 | + |
| 88 | +If you'd like to work against Firebase emulators rather than production: |
| 89 | + |
| 90 | +1. Install Firebase CLI: |
| 91 | + |
| 92 | +```bash |
| 93 | +npm install -g firebase-tools |
| 94 | +``` |
| 95 | + |
| 96 | +2. Login: |
| 97 | + |
| 98 | +```bash |
| 99 | +firebase login |
| 100 | +``` |
| 101 | + |
| 102 | +3. Start emulators: |
| 103 | + |
| 104 | +```bash |
| 105 | +firebase emulators:start |
| 106 | +``` |
| 107 | + |
| 108 | +This will run local emulators for Firestore, Authentication, Storage, and Functions (if configured). |
0 commit comments