Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/duyet/firebase-shorten-url
Shorten URL using Firebase Dynamic Link API
https://github.com/duyet/firebase-shorten-url
firebase firebase-dynamic-links gatsbyjs hacktoberfest shorten-urls shortener
Last synced: about 2 months ago
JSON representation
Shorten URL using Firebase Dynamic Link API
- Host: GitHub
- URL: https://github.com/duyet/firebase-shorten-url
- Owner: duyet
- License: mit
- Created: 2019-04-29T03:19:20.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-11-20T19:36:42.000Z (2 months ago)
- Last Synced: 2024-11-20T20:29:13.762Z (2 months ago)
- Topics: firebase, firebase-dynamic-links, gatsbyjs, hacktoberfest, shorten-urls, shortener
- Language: JavaScript
- Homepage: https://s.duyet.net
- Size: 73.5 MB
- Stars: 27
- Watchers: 2
- Forks: 14
- Open Issues: 25
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Firebase Shorten URL
This is a demonstrate how to use the Firebase Dynamic Link API to build the shorten URL app.Target:
- Simple
- Fast
- Fast 😎Live: https://s.duyet.net
![](.github/screenshot.png)
![](.github/screenshot2.png)
# Locally development
1. Set up Node.js and the Firebase CLI
```
yarn global add firebase-tools
```To initialize project: Run `firebase login` to log in via the browser and authenticate the firebase tool.
2. Setup packages
```
cd functions/ && yarn
cd hosting/ && yarn
```3. Go to https://console.firebase.google.com and create new project.
4. Setup env variables, copy and modify `env.default.sh` to `env.local.sh`
Get the `api_key` by **Project settings > General > Web API Key**
Get the `domain_uri_prefix` by **Dynamic Links**, then **Add URL prefix**```
firebase functions:config:set config.api_key=AIzaSyC8mZm**********
firebase functions:config:set config.domain_uri_prefix=duyet.page.link
```
Run: `bash ./env.local.sh`5. Update the frontend config: `hosting/gatsby-config.js`:
```js
module.exports = {
siteMetadata: {
title: 'duyet shorten url',
description: 'Shorten URL by Firebase Dynamic Link',
author: '@duyet',
},
...
```6. Running in local: https://firebase.google.com/docs/functions/local-emulator
- Export local configs: `firebase functions:config:get > functions/.runtimeconfig.json`
- Start firebase function: `firebase serve`
- Start hosting local in another terminal: `cd hosting && yarn develop`
- Open the UI in browser: http://localhost:8000# Deploy
Deploy serverless functions and hosting to Firebase
```
firebase deploy
```# Licence
MIT