Skip to content

Commit bf0f6e0

Browse files
committed
Adding a hosting skill as well and some guidance on how to choose between the 2 products
1 parent f4ae529 commit bf0f6e0

File tree

4 files changed

+199
-0
lines changed

4 files changed

+199
-0
lines changed

skills/app-hosting-basics/SKILL.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,19 @@ description: Deploy and manage web apps with Firebase App Hosting. Use when depl
88
## Description
99
This skill enables the agent to deploy and manage modern, full-stack web applications (Next.js, Angular, etc.) using Firebase App Hosting.
1010

11+
12+
## Hosting vs App Hosting
13+
14+
**Choose Firebase Hosting if:**
15+
- You are deploying a static site (HTML/CSS/JS).
16+
- You are deploying a simple SPA (React, Vue, etc. without SSR).
17+
- You want full control over the build and deploy process via CLI.
18+
19+
**Choose Firebase App Hosting if:**
20+
- You are using a supported full-stack framework like Next.js or Angular.
21+
- You need Server-Side Rendering (SSR) or ISR.
22+
- You want an automated "git push to deploy" workflow with zero configuration.
23+
1124
## Instructions
1225
1. **Use CLI commands**: Directly execute `firebase apphosting` commands to create backends, trigger rollouts, and manage resources
1326
2. **Configure App Hosting**: Create or edit `apphosting.yaml` to configure Cloud Run settings (CPU, memory) and environment variables as requested by the user.

skills/hosting-basics/SKILL.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
name: hosting-basics
3+
description: Skill for working with Firebase Hosting. Use this when you want to deploy static web apps, Single Page Apps (SPAs), or simple microservices.
4+
---
5+
6+
# hosting-basics
7+
8+
This skill provides instructions and references for working with Firebase Hosting, a fast and secure hosting service for your web app, static and dynamic content, and microservices.
9+
10+
## Overview
11+
12+
Firebase Hosting provides production-grade web content hosting for developers. With a single command, you can deploy web apps and serve both static and dynamic content to a global CDN (content delivery network).
13+
14+
**Key Features:**
15+
- **Fast Content Delivery:** Files are cached on SSDs at CDN edges around the world.
16+
- **Secure by Default:** Zero-configuration SSL is built-in.
17+
- **Preview Channels:** View and test changes on temporary preview URLs before deploying live.
18+
- **GitHub Integration:** Automate previews and deploys with GitHub Actions.
19+
- **Dynamic Content:** Serve dynamic content and microservices using Cloud Functions or Cloud Run.
20+
21+
## Hosting vs App Hosting
22+
23+
**Choose Firebase Hosting if:**
24+
- You are deploying a static site (HTML/CSS/JS).
25+
- You are deploying a simple SPA (React, Vue, etc. without SSR).
26+
- You want full control over the build and deploy process via CLI.
27+
28+
**Choose Firebase App Hosting if:**
29+
- You are using a supported full-stack framework like Next.js or Angular.
30+
- You need Server-Side Rendering (SSR) or ISR.
31+
- You want an automated "git push to deploy" workflow with zero configuration.
32+
33+
## Instructions
34+
35+
### 1. Configuration (`firebase.json`)
36+
For details on configuring Hosting behavior, including public directories, redirects, rewrites, and headers, see [configuration.md](configuration.md).
37+
38+
### 2. Deploying
39+
For instructions on deploying your site, using preview channels, and managing releases, see [deploying.md](deploying.md).
40+
41+
### 3. Emulation
42+
To test your app locally:
43+
```bash
44+
firebase emulators:start --only hosting
45+
```
46+
This serves your app at `http://localhost:5000` by default.
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# Hosting Configuration (`firebase.json`)
2+
3+
The `hosting` section of `firebase.json` configures how your site is deployed and served.
4+
5+
## key Attributes
6+
7+
### `public` (Required)
8+
Specifies the directory to deploy to Firebase Hosting.
9+
```json
10+
"hosting": {
11+
"public": "public"
12+
}
13+
```
14+
15+
### `ignore` (Optional)
16+
Files to ignore on deploy. Uses glob patterns (like `.gitignore`).
17+
**Default ignores:** `firebase.json`, `**/.*`, `**/node_modules/**`
18+
19+
### `redirects` (Optional)
20+
URL redirects to prevent broken links or shorten URLs.
21+
```json
22+
"redirects": [
23+
{
24+
"source": "/foo",
25+
"destination": "/bar",
26+
"type": 301
27+
}
28+
]
29+
```
30+
31+
### `rewrites` (Optional)
32+
Serve the same content for multiple URLs, useful for SPAs or Dynamic Content.
33+
```json
34+
"rewrites": [
35+
{
36+
"source": "**",
37+
"destination": "/index.html"
38+
},
39+
{
40+
"source": "/api/**",
41+
"function": "apiFunction"
42+
},
43+
{
44+
"source": "/container/**",
45+
"run": {
46+
"serviceId": "helloworld",
47+
"region": "us-central1"
48+
}
49+
}
50+
]
51+
```
52+
53+
### `headers` (Optional)
54+
Custom response headers.
55+
```json
56+
"headers": [
57+
{
58+
"source": "**/*.@(eot|otf|ttf|ttc|woff|font.css)",
59+
"headers": [
60+
{
61+
"key": "Access-Control-Allow-Origin",
62+
"value": "*"
63+
}
64+
]
65+
}
66+
]
67+
```
68+
69+
### `cleanUrls` (Optional)
70+
If `true`, drops `.html` extension from URLs.
71+
```json
72+
"cleanUrls": true
73+
```
74+
75+
### `trailingSlash` (Optional)
76+
Controls trailing slashes in static content URLs.
77+
- `true`: Adds trailing slash.
78+
- `false`: Removes trailing slash.
79+
80+
## Full Example
81+
82+
```json
83+
{
84+
"hosting": {
85+
"public": "dist",
86+
"ignore": [
87+
"firebase.json",
88+
"**/.*",
89+
"**/node_modules/**"
90+
],
91+
"rewrites": [
92+
{
93+
"source": "**",
94+
"destination": "/index.html"
95+
}
96+
],
97+
"cleanUrls": true,
98+
"trailingSlash": false
99+
}
100+
}
101+
```

skills/hosting-basics/deploying.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Deploying to Firebase Hosting
2+
3+
## Standard Deployment
4+
To deploy your Hosting content and configuration to your live site:
5+
6+
```bash
7+
firebase deploy --only hosting
8+
```
9+
10+
This deploys to your default sites (`PROJECT_ID.web.app` and `PROJECT_ID.firebaseapp.com`).
11+
12+
## Preview Channels
13+
Preview channels allow you to test changes on a temporary URL before going live.
14+
15+
### Deploy to a Preview Channel
16+
```bash
17+
firebase hosting:channel:deploy CHANNEL_ID
18+
```
19+
Replace `CHANNEL_ID` with a name (e.g., `feature-beta`).
20+
This returns a preview URL like `PROJECT_ID--CHANNEL_ID-RANDOM_HASH.web.app`.
21+
22+
### Expiration
23+
Channels expire after 7 days by default. To set a different expiration:
24+
```bash
25+
firebase hosting:channel:deploy CHANNEL_ID --expires 1d
26+
```
27+
28+
## Cloning to Live
29+
You can promote a version from a preview channel to your live channel without rebuilding.
30+
31+
```bash
32+
firebase hosting:clone SOURCE_SITE_ID:SOURCE_CHANNEL_ID TARGET_SITE_ID:live
33+
```
34+
35+
**Example:**
36+
Clone the `feature-beta` channel on your default site to live:
37+
```bash
38+
firebase hosting:clone my-project:feature-beta my-project:live
39+
```

0 commit comments

Comments
 (0)