firebase-cms

我要开发同款
匿名用户2021年12月09日
34阅读
开发技术JavaScript
所属分类Web应用开发、Web框架
授权协议MIT License

作品详情

FirebaseCMS

FirebasCMSisane-commerceandbloggingplatformwithastorefrontandCMSbuiltwithAngular4(AngularCLI),Firebase(AngularFire2),AngularMaterialandStripe.Create,moderateandmanagepages,blogposts,products,orders,customers,carts,navigation,themes,adminsandmorewiththiswebapplication.

DemoCheckoutthefrontendapplication:https://fir-cms-76f54.firebaseapp.comCheckouttheadmininterface:https://fir-cms-76f54.firebaseapp.com/loginAdminlogindetails:admin@admin.com/admin123Thisuserhasan'editor'roleAllofthedatawillberesetonceaweekInstallation

InstallAngularCLI

npminstall-g@angular/cli

InstallNPMpackages

Run`npminstall`or`yarninstall`cdfunctions/Run`npminstall`Firebasesetup

CreateaFirebaseaccount,createanewproject,andcopytheconfigcodeforyourproject.

EnableGoogle,Email/PasswordandAnonymousinthe'Sign-InMethod'taboftheAuthenticationsectioninyourFirebaseprojectConsole.

Withintheprojectfolder,run:

cdsrcmkdirenvironmentscdenvironmentstouchenvironment.tstouchenvironment.prod.ts

Open'environment.ts'andaddyourFirebaseconfigasfollows:

exportconstenvironment={production:false,firebase:{apiKey:"xxxx",authDomain:"xxxxx",databaseURL:"xxxxx",projectId:"xxxxx",storageBucket:"xxxx",messagingSenderId:"xxxx"}};

Open'environment.prod.ts'andaddyourFirebaseconfigasfollows:

exportconstenvironment={production:true,firebase:{apiKey:"xxxx",authDomain:"xxxxx",databaseURL:"xxxxx",projectId:"xxxxx",storageBucket:"xxxx",messagingSenderId:"xxxx"}};Stripesetup

CreateaStripeaccount.

AddyourStripeAPISecretKeytofirebaseconfig:

firebasefunctions:config:setstripe.token=<YOURSTRIPESECRETKEY>

Open'environment.ts'andaddyourStripePublishableAPIKeyasfollows:

exportconstenvironment={production:false,firebase:{apiKey:"xxxx",authDomain:"xxxxx",databaseURL:"xxxxx",projectId:"xxxxx",storageBucket:"xxxx",messagingSenderId:"xxxx"},stripe:"<YOURSTRIPEPUBLISHABLEKEY>"};

Open'environment.prod.ts'andaddyourStripePublishableAPIKeyasfollows:

exportconstenvironment={production:true,firebase:{apiKey:"xxxx",authDomain:"xxxxx",databaseURL:"xxxxx",projectId:"xxxxx",storageBucket:"xxxx",messagingSenderId:"xxxx"},stripe:"<YOURSTRIPEPUBLISHABLEKEY>"};CreateSuperAdminAccount

You'llneedtomanuallyaddyourfirstadminaccount.Togenerateahashcodeforit...

Runnpmrunhashcodeandenteryouremail.CopyhashcodeCreatenewentryinyourfirebaseDBunder,/admins/<YOURHASHCODE>/asfollows:admins:{<YOURHASHCODE>:{{email:'<YOUREMAIL>',role:'super-admin'}}}Createuserinfirebaseusermanagementwithsameemail.EmailConfirmationsetupToallowtheapptosendconfirmationemailsthroughaGmailaccount:enableaccesstoLessSecureAppsandDisplayUnlockCaptcha.Foraccountswith2-stepverificationenabled,GenerateanAppPassword.Setthegmail.emailandgmail.passwordGoogleCloudenvironmentvariablestomatchtheemailandpasswordoftheGmailaccountusedtosendemails(ortheapppasswordifyouraccounthas2-stepverificationenabled).Forthisuse:firebasefunctions:config:setgmail.email="<EMAILADDRESS>"gmail.password="<PASSWORD>"Developmentserver

Runngserveforadevserver.Theappwillautomaticallyreloadifyouchangeanyofthesourcefiles.

Navigatetohttps://localhost:4200/toaccessthefrontend.

Navigatetohttps://localhost:4200/logintoaccesstheloginpage(loginisviaGoogle).

Navigatetohttps://localhost:4200/admintoaccesstheCMS(usermustbeloggedinandmustbepartof'/admins'intheFirebasedatabasetoaccesstheCMS).

Codescaffolding

Runnggeneratecomponentcomponent-nametogenerateanewcomponent.Youcanalsousenggeneratedirective|pipe|service|class|module.

Build

Runngbuildtobuildtheproject.Thebuildartifactswillbestoredinthedist/directory.Usethe-prodflagforaproductionbuild.

Deploy

Runnpmrundeploytodeployyourproject.ThiscommandwillfirstbuildtheappforproductionandthendeployittoFirebasehosting.

AdminRoles

Thereare3AdminRoles:

super-adminadmineditorPermissionsuper-adminadmineditorcreatenewentities✓✓✓editentities✓✓✓submitentitiesforapproval✓✓✓saveentities✓✓×deleteentities✓✓×publish/unpublishentities✓✓×edititemsawaitingapproval✓✓×approve/disapprovechanges✓✓×view/add/edit/deleteorders✓✓×view/add/edit/deletecustomers✓✓×view/add/edit/deletemenus✓✓×view/add/edit/deletethemesettings✓✓×view/add/edit/deleteadmins✓××
声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论