Skip to content

Commit a786d15

Browse files
committed
Update Firebase configuration and documentation
- Added new GitHub Actions workflows for deploying to Firebase on merge and pull request events. - Updated README.md to reflect the transition from GitHub Pages to Firebase Hosting, including installation instructions for Firebase CLI and configuration steps. - Fixed missing newlines in .firebaserc and firebase.json files. Signed-off-by: Pete Cheslock <[email protected]>
1 parent d2682e8 commit a786d15

File tree

5 files changed

+118
-62
lines changed

5 files changed

+118
-62
lines changed

.firebaserc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
"projects": {
33
"default": "handstack-e29f5"
44
}
5-
}
5+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# This file was auto-generated by the Firebase CLI
2+
# https://github.com/firebase/firebase-tools
3+
4+
name: Deploy to Firebase Hosting on merge
5+
on:
6+
push:
7+
branches:
8+
- main
9+
jobs:
10+
build_and_deploy:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Setup Node.js
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: '20'
18+
cache: 'npm'
19+
- name: Install dependencies
20+
run: npm install
21+
- name: Build project
22+
run: npm run build
23+
env:
24+
VITE_FIREBASE_API_KEY: ${{ secrets.VITE_FIREBASE_API_KEY }}
25+
VITE_FIREBASE_AUTH_DOMAIN: ${{ secrets.VITE_FIREBASE_AUTH_DOMAIN }}
26+
VITE_FIREBASE_DATABASE_URL: ${{ secrets.VITE_FIREBASE_DATABASE_URL }}
27+
VITE_FIREBASE_PROJECT_ID: ${{ secrets.VITE_FIREBASE_PROJECT_ID }}
28+
VITE_FIREBASE_STORAGE_BUCKET: ${{ secrets.VITE_FIREBASE_STORAGE_BUCKET }}
29+
VITE_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.VITE_FIREBASE_MESSAGING_SENDER_ID }}
30+
VITE_FIREBASE_APP_ID: ${{ secrets.VITE_FIREBASE_APP_ID }}
31+
- uses: FirebaseExtended/action-hosting-deploy@v0
32+
with:
33+
repoToken: ${{ secrets.GITHUB_TOKEN }}
34+
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_HANDSTACK_E29F5 }}
35+
channelId: live
36+
projectId: handstack-e29f5
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# This file was auto-generated by the Firebase CLI
2+
# https://github.com/firebase/firebase-tools
3+
4+
name: Deploy to Firebase Hosting on PR
5+
on: pull_request
6+
permissions:
7+
checks: write
8+
contents: read
9+
pull-requests: write
10+
jobs:
11+
build_and_preview:
12+
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20'
20+
cache: 'npm'
21+
- name: Install dependencies
22+
run: npm install
23+
- name: Build project
24+
run: npm run build
25+
env:
26+
VITE_FIREBASE_API_KEY: ${{ secrets.VITE_FIREBASE_API_KEY }}
27+
VITE_FIREBASE_AUTH_DOMAIN: ${{ secrets.VITE_FIREBASE_AUTH_DOMAIN }}
28+
VITE_FIREBASE_DATABASE_URL: ${{ secrets.VITE_FIREBASE_DATABASE_URL }}
29+
VITE_FIREBASE_PROJECT_ID: ${{ secrets.VITE_FIREBASE_PROJECT_ID }}
30+
VITE_FIREBASE_STORAGE_BUCKET: ${{ secrets.VITE_FIREBASE_STORAGE_BUCKET }}
31+
VITE_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.VITE_FIREBASE_MESSAGING_SENDER_ID }}
32+
VITE_FIREBASE_APP_ID: ${{ secrets.VITE_FIREBASE_APP_ID }}
33+
- uses: FirebaseExtended/action-hosting-deploy@v0
34+
with:
35+
repoToken: ${{ secrets.GITHUB_TOKEN }}
36+
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_HANDSTACK_E29F5 }}
37+
projectId: handstack-e29f5

README.md

Lines changed: 43 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Handstack is a mobile-friendly web application that brings the convenience of di
1111
- **Simple room system** - 4-character room codes (new rooms use unambiguous characters, but can join any alphanumeric code)
1212
- **Admin controls** - Meeting hosts can manage the queue
1313
- **Session persistence** - Automatically restores your session after page refresh
14-
- **Zero-cost hosting** - Runs on GitHub Pages for free
14+
- **Zero-cost hosting** - Runs on Firebase for free
1515
- **No registration required** - Just enter your name and start
1616

1717
## 📁 Project Structure
@@ -31,8 +31,8 @@ handstack/
3131
│ ├── firebase/ # Firebase config
3232
│ │ └── config.js # Firebase setup
3333
│ └── App.jsx # Main app component
34-
├── .github/workflows/ # GitHub Actions
35-
│ └── deploy.yml # Auto-deployment
34+
├── database.rules.json # Database security rules
35+
── firebase.json # Firebase configuration
3636
└── README.md # Full documentation
3737
```
3838

@@ -51,7 +51,13 @@ cd handstack
5151
npm install
5252
```
5353

54-
### 3. Firebase Configuration
54+
### 3. Install Firebase CLI
55+
56+
```bash
57+
npm install -g firebase-tools
58+
```
59+
60+
### 4. Firebase Configuration
5561

5662
1. Go to [Firebase Console](https://console.firebase.google.com/)
5763
2. Create a new project (or use an existing one)
@@ -67,28 +73,15 @@ npm install
6773
- Click **Create Database**
6874
- Choose **Start in test mode**
6975
- Select your preferred location
70-
5. **Set database rules** (in Realtime Database → Rules tab):
71-
```json
72-
{
73-
"rules": {
74-
"rooms": {
75-
"$roomCode": {
76-
".read": true,
77-
".write": true
78-
}
79-
}
80-
}
81-
}
82-
```
83-
6. **Get your Firebase config** from the web app you created:
76+
5. **Get your Firebase config** from the web app you created:
8477
- Go to Project Settings → General tab
8578
- Scroll to "Your apps" and click on your web app
8679
- Copy the config object values
87-
7. **Create a `.env` file** in the root directory (copy from `env.example`):
80+
6. **Create a `.env` file** in the root directory (copy from `env.example`):
8881
```bash
8982
cp env.example .env
9083
```
91-
8. **Fill in your Firebase configuration** in `.env`:
84+
7. **Fill in your Firebase configuration** in `.env`:
9285
```bash
9386
VITE_FIREBASE_API_KEY=AIzaSyC... # From firebaseConfig.apiKey
9487
VITE_FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
@@ -101,21 +94,21 @@ npm install
10194

10295
**⚠️ Important**: The `.env` file is automatically ignored by Git for security. Never commit your Firebase credentials to the repository.
10396

104-
### 4. Update GitHub Pages Configuration
97+
### 5. Initialize Firebase
10598

106-
1. Update `package.json` homepage field to match your GitHub username:
107-
```json
108-
"homepage": "https://yourgithubuser.github.io"
109-
```
99+
```bash
100+
firebase login
101+
firebase init
102+
```
110103

111-
2. In your GitHub repository settings:
112-
- Go to **Settings** **Pages**
113-
- Set **Source** to "Deploy from a branch"
114-
- Set **Branch** to "main" and **Folder** to "/ (root)"
115-
116-
**Note**: This configuration serves from your main GitHub Pages domain (`petecheslock.github.io`). If you want to serve from a subdirectory like `/handstack`, you can create a repository named `handstack` and it will be available at `petecheslock.github.io/handstack`.
104+
During initialization:
105+
- Select **Hosting** and **Realtime Database**
106+
- Choose **Use an existing project** and select your Firebase project
107+
- Set `dist` as your public directory
108+
- Configure as a single-page app (Yes)
109+
- Don't overwrite `dist/index.html` if it exists
117110

118-
### 5. Test Locally
111+
### 6. Test Locally
119112

120113
```bash
121114
npm run dev
@@ -129,37 +122,26 @@ Visit `http://localhost:5173` to test the application. You should see the Handst
129122
3. Open a new browser tab/window and join the room with the code
130123
4. Test raising/lowering hands and queue management
131124

132-
## 🚀 Deployment to GitHub Pages
133-
134-
### GitHub Secrets Configuration
135-
136-
Before deploying, you need to add your Firebase configuration as GitHub Secrets:
125+
## 🚀 Deployment to Firebase
137126

138-
1. Go to your GitHub repository Settings > Secrets and variables > Actions
139-
2. Add the following secrets with your Firebase config values:
140-
- `VITE_FIREBASE_API_KEY`
141-
- `VITE_FIREBASE_AUTH_DOMAIN`
142-
- `VITE_FIREBASE_DATABASE_URL`
143-
- `VITE_FIREBASE_PROJECT_ID`
144-
- `VITE_FIREBASE_STORAGE_BUCKET`
145-
- `VITE_FIREBASE_MESSAGING_SENDER_ID`
146-
- `VITE_FIREBASE_APP_ID`
127+
### Database Rules
147128

148-
### Option 1: Automatic Deployment (Recommended)
129+
The database security rules are stored in `database.rules.json` and will be automatically deployed with your project. The rules are configured to allow read/write access to room data.
149130

150-
1. Push your code to GitHub
151-
2. Go to your repository Settings > Pages
152-
3. Choose "GitHub Actions" as the source
153-
4. The workflow in `.github/workflows/deploy.yml` will automatically deploy on push to main
154-
5. Your app will be available at `https://petecheslock.github.io`
155-
156-
### Option 2: Manual Deployment
131+
### Deploy to Firebase
157132

158133
```bash
159-
npm run build
160134
npm run deploy
161135
```
162136

137+
This command will:
138+
1. Build the application
139+
2. Deploy to Firebase Hosting
140+
3. Update database rules
141+
4. Provide you with a live URL
142+
143+
Your app will be available at `https://your-project-id.web.app`
144+
163145
## 📱 How to Use
164146

165147
### For Meeting Hosts (Admins)
@@ -183,7 +165,7 @@ npm run deploy
183165
- **Frontend**: React 18 + Vite
184166
- **Styling**: Tailwind CSS
185167
- **Database**: Firebase Realtime Database
186-
- **Hosting**: GitHub Pages
168+
- **Hosting**: Firebase Hosting
187169
- **Routing**: React Router
188170

189171
## 📈 Scaling Considerations
@@ -216,22 +198,23 @@ MIT License - feel free to use this for your meetings!
216198
- Ensure database rules allow read/write access to `rooms`
217199

218200
2. **Deployment issues**:
219-
- Verify all GitHub Secrets are added to your repository
220-
- Check that your GitHub Pages settings use "GitHub Actions" as source
201+
- Verify Firebase CLI is installed: `firebase --version`
202+
- Check that you're logged in: `firebase login`
203+
- Ensure your project is initialized: `firebase init`
221204

222205
3. **Room not found**: Ensure the room code is correct (4 alphanumeric characters).
223206

224207
4. **Environment variable errors**:
225208
- Local development: Check your `.env` file
226-
- Deployment: Check your GitHub repository secrets
209+
- Deployment: Firebase will use your project configuration
227210

228211
**Need Help?** Create an issue on GitHub if you encounter problems or have suggestions for improvements.
229212

230213
---
231214

232215
## 🎉 Ready to Use!
233216

234-
Once you complete the Firebase setup, your Handstack will be ready to host on GitHub Pages at zero cost. The application will handle multiple concurrent rooms and real-time updates seamlessly.
217+
Once you complete the Firebase setup, your Handstack will be ready to host on Firebase at zero cost. The application will handle multiple concurrent rooms and real-time updates seamlessly.
235218

236219
**Perfect for**: Classrooms, conferences, team meetings, workshops, and any event where you need organized hand raising!
237220

firebase.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
}
1717
]
1818
}
19-
}
19+
}

0 commit comments

Comments
 (0)