This is a serverless chat app I designed for by blog/tutorial on how to go serverless (and if it is a good option)
Check the blog out here!
git clone https://github.com/arnu515/serverless-chat.git
Create a project on firebase. Name it anything you want.
Check the docs to learn how
A sample config looks like this:
{
apiKey: "your api key",
authDomain: "projectname.firebaseapp.com",
databaseURL: "https://projectname.firebaseio.com",
projectId: "project name",
storageBucket: "projectname.appspot.com",
messagingSenderId: "xxxxxxx",
appId: "xxxxxxxxxx",
};
Check the docs to learn how
src/
called firebase-config.ts
and put this in it:export default {
// your config
};
For example, if I use the example config provided up above,
export default {
apiKey: "your api key",
authDomain: "projectname.firebaseapp.com",
databaseURL: "https://projectname.firebaseio.com",
projectId: "project name",
storageBucket: "projectname.appspot.com",
messagingSenderId: "xxxxxxx",
appId: "xxxxxxxxxx",
};
Type
npm run dev
in your terminal. This will start your app on http://localhost:5000.
Customise the app to your liking
You can deploy your app anywhere, on any host, but to keep it simple, and to not require to change any Firebase Auth rules, let's host the app on Firebase. Open a terminal and type:
firebase init hosting
and follow the interactive guide until you have configured Firebase Hosting. Choose public
as your hosting directory. Make sure you don't override public/index.html
Then, type
npm run build
firebase deploy --only hosting
Your app should be live on projectname.web.app! You can view my version here