Skip to content

Commit 7c6adbe

Browse files
committed
Add Firebase configuration and setup for hosting and functions
- Created .firebaserc and firebase.json for Firebase project configuration. - Added Firestore rules and indexes in firestore.rules and firestore.indexes.json. - Introduced GitHub Actions workflows for deploying to Firebase Hosting on merge and pull requests. - Set up TypeScript environment for Firebase functions with ESLint configuration. - Added initial HTML files for Firebase Hosting (index.html and 404.html). - Updated package.json to include firebase-tools as a dev dependency.
1 parent 9419933 commit 7c6adbe

17 files changed

Lines changed: 11633 additions & 3 deletions

.firebaserc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"projects": {
3+
"default": "doula-cooperative"
4+
}
5+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
- trunk
9+
jobs:
10+
build_and_deploy:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- run: npm ci && npm run build
15+
- uses: FirebaseExtended/action-hosting-deploy@v0
16+
with:
17+
repoToken: ${{ secrets.GITHUB_TOKEN }}
18+
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_DOULA_COOPERATIVE }}
19+
channelId: live
20+
projectId: doula-cooperative
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
- run: npm ci && npm run build
17+
- uses: FirebaseExtended/action-hosting-deploy@v0
18+
with:
19+
repoToken: ${{ secrets.GITHUB_TOKEN }}
20+
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_DOULA_COOPERATIVE }}
21+
projectId: doula-cooperative

bun.lock

Lines changed: 1377 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

firebase.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"firestore": {
3+
"database": "(default)",
4+
"location": "us-east1",
5+
"rules": "firestore.rules",
6+
"indexes": "firestore.indexes.json"
7+
},
8+
"functions": [
9+
{
10+
"source": "functions",
11+
"codebase": "default",
12+
"ignore": [
13+
"node_modules",
14+
".git",
15+
"firebase-debug.log",
16+
"firebase-debug.*.log",
17+
"*.local"
18+
],
19+
"predeploy": [
20+
"npm --prefix \"$RESOURCE_DIR\" run lint",
21+
"npm --prefix \"$RESOURCE_DIR\" run build"
22+
]
23+
}
24+
],
25+
"hosting": {
26+
"public": "public",
27+
"ignore": [
28+
"firebase.json",
29+
"**/.*",
30+
"**/node_modules/**"
31+
]
32+
}
33+
}

firestore.indexes.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
// Example:
3+
//
4+
// "indexes": [
5+
// {
6+
// "collectionGroup": "widgets",
7+
// "queryScope": "COLLECTION",
8+
// "fields": [
9+
// { "fieldPath": "foo", "arrayConfig": "CONTAINS" },
10+
// { "fieldPath": "bar", "mode": "DESCENDING" }
11+
// ]
12+
// },
13+
//
14+
// "fieldOverrides": [
15+
// {
16+
// "collectionGroup": "widgets",
17+
// "fieldPath": "baz",
18+
// "indexes": [
19+
// { "order": "ASCENDING", "queryScope": "COLLECTION" }
20+
// ]
21+
// },
22+
// ]
23+
// ]
24+
"indexes": [],
25+
"fieldOverrides": []
26+
}

firestore.rules

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
rules_version='2'
2+
3+
service cloud.firestore {
4+
match /databases/{database}/documents {
5+
match /{document=**} {
6+
// This rule allows anyone with your database reference to view, edit,
7+
// and delete all data in your database. It is useful for getting
8+
// started, but it is configured to expire after 30 days because it
9+
// leaves your app open to attackers. At that time, all client
10+
// requests to your database will be denied.
11+
//
12+
// Make sure to write security rules for your app before that time, or
13+
// else all client requests to your database will be denied until you
14+
// update your rules.
15+
allow read, write: if request.time < timestamp.date(2025, 7, 18);
16+
}
17+
}
18+
}

functions/.eslintrc.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
es6: true,
5+
node: true,
6+
},
7+
extends: [
8+
"eslint:recommended",
9+
"plugin:import/errors",
10+
"plugin:import/warnings",
11+
"plugin:import/typescript",
12+
"google",
13+
"plugin:@typescript-eslint/recommended",
14+
],
15+
parser: "@typescript-eslint/parser",
16+
parserOptions: {
17+
project: ["tsconfig.json", "tsconfig.dev.json"],
18+
sourceType: "module",
19+
},
20+
ignorePatterns: [
21+
"/lib/**/*", // Ignore built files.
22+
"/generated/**/*", // Ignore generated files.
23+
],
24+
plugins: [
25+
"@typescript-eslint",
26+
"import",
27+
],
28+
rules: {
29+
"quotes": ["error", "double"],
30+
"import/no-unresolved": 0,
31+
"indent": ["error", 2],
32+
},
33+
};

functions/.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Compiled JavaScript files
2+
lib/**/*.js
3+
lib/**/*.js.map
4+
5+
# TypeScript v1 declaration files
6+
typings/
7+
8+
# Node.js dependency directory
9+
node_modules/
10+
*.local

0 commit comments

Comments
 (0)