Git Product home page Git Product logo

oddbit / tanam Goto Github PK

View Code? Open in Web Editor NEW
180.0 17.0 39.0 21.9 MB

Plug-n-play CMS for websites on Firebase

Home Page: https://www.npmjs.com/package/tanam

License: Apache License 2.0

JavaScript 0.42% TypeScript 93.53% SCSS 1.66% Nix 0.62% CSS 3.76%
firebase cms dustjs firebase-hosting firebase-firestore firebase-storage angular typescript firebase-authentication firebase-cloud-functions npm-module

tanam's Introduction

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 run 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
source .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 - tanamApiKey
echo $NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN | firebase apphosting:secrets:set --force --data-file - tanamAuthDomain
echo $NEXT_PUBLIC_FIREBASE_DATABASE_URL | firebase apphosting:secrets:set --force --data-file - tanamDatabaseUrl
echo $NEXT_PUBLIC_FIREBASE_PROJECT_ID | firebase apphosting:secrets:set --force --data-file - tanamProjectId
echo $NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET | firebase apphosting:secrets:set --force --data-file - tanamStorageBucket
echo $NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID | firebase apphosting:secrets:set --force --data-file - tanamMessagingSenderId
echo $NEXT_PUBLIC_FIREBASE_APP_ID | firebase apphosting:secrets:set --force --data-file - tanamAppId
echo $NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID | firebase apphosting:secrets:set --force --data-file - tanamMeasurementId
echo $GEMINI_API_KEY | firebase apphosting:secrets:set --force --data-file - tanamGenAiApiKey

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 tanamApiKey
firebase apphosting:secrets:grantaccess --backend $APP_HOSTING_BACKEND tanamAuthDomain
firebase apphosting:secrets:grantaccess --backend $APP_HOSTING_BACKEND tanamDatabaseUrl
firebase apphosting:secrets:grantaccess --backend $APP_HOSTING_BACKEND tanamProjectId
firebase apphosting:secrets:grantaccess --backend $APP_HOSTING_BACKEND tanamStorageBucket
firebase apphosting:secrets:grantaccess --backend $APP_HOSTING_BACKEND tanamMessagingSenderId
firebase apphosting:secrets:grantaccess --backend $APP_HOSTING_BACKEND tanamAppId
firebase apphosting:secrets:grantaccess --backend $APP_HOSTING_BACKEND tanamMeasurementId
firebase apphosting:secrets:grantaccess --backend $APP_HOSTING_BACKEND tanamGenAiApiKey

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.

tanam's People

Contributors

anandaprabawa avatar dennisalund avatar dependabot[bot] avatar detaoddbit avatar detautama avatar gitdubz avatar muzanella11 avatar praburangki avatar widasuryani avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tanam's Issues

Apllying overlay theme for all dialog theme

Instead of set it up "userService.overlayTheme();" for each component that using dialog, it must be can setup once at admin.component.ts that can be applied to all components

If this issue fixed, it will be fixed for #101 and #100 too

Create a "scheduled" document status type

We can currently set a future timestamp for a document to be published. But the challenge is when we want to filter what documents that has been published and which ones will be published. Since it requires a query check on publish date as well as its status.

The proposal is to introduce another document state named scheduled that is set whenever the publish date is set on a document and the date is set in the future.

So a document can be

  • unpublished - it must have a timestamp equal to now or in the past
  • published - it must have a timestamp equal to now or in the past
  • scheduled - force set to this value if the published timestamp is in the future

image

Improve the "loading experience" for media files

First of all, the progress bar when uploading an image is a bit hackish.

Secondly, when uploading an image there is a significant delay after the upload is complete until it is displayed. This is caused by the cloud function processing and image scaling, so we can't track progress.

Improve the upload progress display and find a good way to display or communicate that the user will have to wait for a couple of seconds until the image is displaying in the grid.
ezgif com-video-to-gif

Templates are not keeping line breaks

Observation

Templates are not keeping line breaks after being saved to Firestore

image

Expectation

Line breaks and formatting such as tabs, and spaces should be kept "as is" when saving and reading data from Firestore.
image

Analysis

Please see related post on StackOverflow that are narrowing down the problem to probably being an issue of reading the data from Firestore and putting it into CKEditor.

Create language selection

image

Create an input form where the user can select what languages that the site will be supporting (the public facing site).

  • Can add any number of languages
  • Can remove languages
  • Must choose one default language

This is preparing for localization of content later on the public facing site so that the content can be served as:

  • example.com/blog/my-blog-post
  • example.com/en/blog/my-blog-post
  • example.com/id/blog/blog-post-aku

This is the related component: https://github.com/oddbit/tanam/tree/angular/src/app/admin/settings/site-form

User's first sign in doesn't get proper Auth token roles

Problem

First login doesn't grant proper access to CMS.

Breakdown

Tanam is using custom claims in the auth object to enforce role based authorization. But the roles are being set in an "on create account" cloud function so the user will already have received the auth token, without claims, before the claims are being set. That effectively makes the user unable to get the access that he/she has been granted in parallel on server side.

Workaround

Currently, the workaround is to log out and login again immediately after creating an account.

Proposal

This should be solved by refreshing token in the CMS frontend app.

Implement date and time form fields

There are three input types related to time and date

They should all have a input form field each, where the date-time is a combined input of the date and time.

The "only time" field should stor its value as a 24h string HH:MM (00:00, 13:15, 23:59, etc) so that it can be easily parsed.

Consider the date and time picker on Google Calendar as a reference or find other good examples in exisiting products.

image
image

Fix site settings "site title" input

image

  • The input form should use a drop-down selection instead of a free text input
  • The options in the drop down should be
    • site_title | page_title
    • site_title โ€ข page_title
    • page_title
  • The presentation text in the dropdown should show real values, instead of the site_title and page_title which are only values stored in DB. So for the options above it should present
    • My awesome blog | This is my first blog post
    • My awesome blog โ€ข This is my first blog post
    • This is my first blog post

So the data stored in Firebase should look like it does right now. It's just the presentation of the input form that should be changed.

Fix "Create new template" button

The create new template button not working.

Creating a new template should create a firestore document with an ID that is the same as the "selector" (name of the template). E.g. the ID of "blog template" is blog.

image

Add a confirmation dialog for deleting document

image

Currently documents are deleted right away if clicking the "delete" button in the document form.

The delete button should open a confirmation dialog with the text "Are you sure that you want to delete the : <title>"

  • Yes
  • No

Fix broken "Create new theme" button

The create new theme button should create an empty theme with a "Firestore auto-id".

It is okay to copy all templates from the "default" theme as a initial set of templates for the new theme.

image

Arbitrary user/theme queries will not work if index is missing

Theme developers will be able to create arbitrary Firestore queries using the {@documents} helper.

The query will require another composite index if it is not using the default sortBy attribute.

// .orderBy(orderByField, sortOrder) // https://github.com/oddbit/tanam/issues/119

A reasonable expectation from the user is that there is a notification of the need to create the index or even better a way to auto-create it with the user's approval.

Manual change of date/time in date form doesn't work

The date/time form doesn't handle manual change of the value very well.

The use case would be if the user just want to make a slight change to the date, such as rounding the time of the publish date or just changing the date without changing the time.

As seen in the gif, the time change doesn't stay with the provided value once the field lose focus

manual-date-change

"Edit template" always opens "default theme"

Reproduce

  1. Login to admin CMS
  2. Go to document type settings
  3. Select a document type, e.g Author: /_/admin/type/author/edit
  4. Click "Edit template"

The "edit template" form will open the default theme without prefilling the selector field.

Expectations

  1. The selector field should be prefilled with the id of the document type (i.e. blog, page, etc)
  2. The template edit form should use currently active theme as configured in site settings.

Remove side-scrollbar from media files page

Remove this side-scrollbar from the media files page. It is currently always being displayed. The correct behavior is that content should scale to fit and reduce in number of columns as the width becomes smaller, to the point where it shifts to a mobile view.

image

Display icon in select dropdown

image

This drop down select input should display both the icon and its name when in collapsed mode. Please see image below for how the expanded selection looks like.

image

Implement dependency graph

When referring to other documents in a template there need to be a dependency graph that can be traversed to identify which documents that might be affected and need to be re-rendered.

Custom form element for "author"

There is an input form type declared as "author" whose purpose is to allow a document to be linked to an author. The form element should consist of the fields

  • name - mandatory
  • profileURL - optional, validate URL value
  • email - optional, validate email value

Consider the custom form field example on how to create a multi-part field.

The values of the author form filed should be stored as a map in the document's data.

Slugify document type id

When we're creating new document types, we must slugify the document type id that is derived from its name. We don't want to allow spaces in IDs.

The slugification should only allow:

  • Lowercase letters
  • Numbers
  • The hyphen character -

Here is a display of the error, where we have a document type with a space in its id
image

Update theme rendering

Change the theme rendering so that a theme must include full HTML similar to Jekyll themes.

Make images fit inside the cards in media gallery

image

The styling of media gallery is broken and images doesn't scale down to fit the width of their card.

Expected behavior is that the image is proportionally scaled down to fit inside the card (center crop or something like that to zoom to best fit that fills the width of the card.

Getting error error TS2307: Cannot find module 'tanam'.

Hey! This project looks awesome, I'd love to play around with it.

It looks like there is an issue getting the minimal example to work though.

Repro steps:

$ git clone https://github.com/oddbit/tanam
$ cd tanam/examples/minimal/functions
$ npm install
$ tsc
src/index.ts:2:24 - error TS2307: Cannot find module 'tanam'.

2 import * as tanam from 'tanam';
                         ~~~~~~~

src/index.ts:16:15 - error TS2307: Cannot find module 'tanam'.

16 export * from 'tanam';
                 ~~~~~~~

Any suggestions on how to fix this? I tried downloading this repo, compile it and use npm link but that gives the same error.

Add a confirmation dialog for deleting media file

delete files

Currently media file are deleted right away if clicking the "delete" button in the document form.

The delete button should open a confirmation dialog with the text "Are you sure that you want to delete the : <title>"

  • Yes
  • No

Add feedback after saving content type

PROBLEM
There is no feedback from system after clicking save button on edit content type

SOLUTION
Adding snackbar and navigate back to content type list

save feedback

Broken image alignment

The modal image picker in document form has some image alignment issues (see picture below).

image

This error was first encountered after switching to use WebP file format instead of the original image in gallery and previews.

Add missing controls for document types

Add full configuration for document type form.

  • isTitle input for fields (only one field can be "title")
  • isStandalone toggle to determine whether a document will have a public URL

Adding "delete" a content type

Feature
User can delete a content type with a confirmation of deletion. When content type deleted, the documents that using same content type will be deleted too

Add Dialog/Modal for detail file

Problem

Tanam didn't have action to show detail of file to user

Breakdown

The dialog detail of file will be containt

  • File name
  • File type
  • Date Uploaded / Created

Proposal

This should be solved by creating dialog for file detail when user click on "details"
image

Rich text editor stringifying "null" value

Observation

It seems like the rich text editor is still stringifying null or undefined values.

image

Expectation

Editor content should be "empty string" if nothing provided or trying to set null or undefined

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.