oddbit / tanam

Plug-n-play CMS for websites on Firebase
https://www.npmjs.com/package/tanam
Apache License 2.0
180 stars 39 forks source link
angular cms dustjs firebase firebase-authentication firebase-cloud-functions firebase-firestore firebase-hosting firebase-storage npm-module typescript

Tanam 🌱 Plug-n-play CMS for websites on Firebase

License NPM version Total NPM downloads

Our aim is to provide a self hosted publishing platform for Firebase.

TanamCMS is the easiest way to build a website for dynamic content such as a blogging platform where you easily can publish and manage your content, even schedule posts to be published.

Tanam also has a built in AI ghostwriter that can help you generate articles in your own writing style. You provide the draft or voice transcript and the ghostwriter will make it into a well written article for you.

Set up

You will need to configure the Next app in the dot-env file apps/cms/.env. You can find an template file named apps/cms/.env.local.example to rename and populate with values.

Build and run locally

Install all dependencies and serve locally.

npm install
npm serve

Deploy to Firebase

Follow the documentation for Firebase App Hosting on how to set up your application for automatic deployment.

Configure Firebase cloud

In order to deploy to Firebase App Hosting you will need to set up some secrets on GCP Secrets Manager.

Follow the steps below to configure it from command line.

Read the environment variables from the CMS configuration

source apps/cms/.env

Copy and paste all these to set up. Be patient, it will take a little while to complete all variable configuration.

echo $NEXT_PUBLIC_FIREBASE_API_KEY | firebase apphosting:secrets:set --force --data-file - firebaseApiKey
echo $NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN | firebase apphosting:secrets:set --force --data-file - firebaseAuthDomain
echo $NEXT_PUBLIC_FIREBASE_DATABASE_URL | firebase apphosting:secrets:set --force --data-file - firebaseDatabaseUrl
echo $NEXT_PUBLIC_FIREBASE_PROJECT_ID | firebase apphosting:secrets:set --force --data-file - firebaseProjectId
echo $NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET | firebase apphosting:secrets:set --force --data-file - firebaseStorageBucket
echo $NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID | firebase apphosting:secrets:set --force --data-file - firebaseMessagingSenderId
echo $NEXT_PUBLIC_FIREBASE_APP_ID | firebase apphosting:secrets:set --force --data-file - firebaseAppId

You will need to grant access to your app-hosting backend if this is the first time you are setting the variables and if you didn't enable access to all variables in the apphosting:secrets:set step.

export APP_HOSTING_BACKEND=<your app-hosting-backend>
firebase apphosting:secrets:grantaccess --backend $APP_HOSTING_BACKEND firebaseApiKey
firebase apphosting:secrets:grantaccess --backend $APP_HOSTING_BACKEND firebaseAuthDomain
firebase apphosting:secrets:grantaccess --backend $APP_HOSTING_BACKEND firebaseDatabaseUrl
firebase apphosting:secrets:grantaccess --backend $APP_HOSTING_BACKEND firebaseProjectId
firebase apphosting:secrets:grantaccess --backend $APP_HOSTING_BACKEND firebaseStorageBucket
firebase apphosting:secrets:grantaccess --backend $APP_HOSTING_BACKEND firebaseMessagingSenderId
firebase apphosting:secrets:grantaccess --backend $APP_HOSTING_BACKEND firebaseAppId

License

Copyright oddbit

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.