git clone git@github.com:1amageek/Demae.gitSet up firebase:
- install Firebase Tools:
npm i -g firebase-tools - create a project through the firebase web console
- grab the projects ID from the web consoles URL: https://console.firebase.google.com/project/
- update the
.firebasercdefault project ID to the newly created project - login to the Firebase CLI tool with
firebase login - overwrite
src/app/config/development.config.jsonandproduction.config.json - add Stripe settings to setup.sh. copy
setup.sample.sh
{
"apiKey": "",
"authDomain": "",
"databaseURL": "",
"projectId": "",
"storageBucket": "",
"messagingSenderId": "",
"appId": ""
}npm installnpm run devnpm run serve
npm run deploynpm run clean🙁It's old. sorry.. I need a readme update.
Root
/
/users/:id
This page displays user information.
/users/:id/paymentMethods
This page shows the payment method that the user has registered.
/users/:id/purchaseHistory
This page shows the user's purchase history.
/accounts/:id
This page displays a list of products offered by your account.
/accounts/:id/products/:product_id
This page displays product details.
/accounts/:id/products/:product_id/skus/:sku_id
This page shows SKU details.
/admin/:id
/admin/:id/orders
This page displays a list of orders.
/admin/:id/orders/:order_id
This page displays order details
/admin/:id/products
This page displays a list of products sold by your account.
/admin/:id/products/:product_id
This page shows details of the products sold by your account.
/admin/:id/products/:product_id/edit
This page edits the details of the products that your account sells.
/admin/:id/products/:product_id/skus/:sku_id
This page shows details of the sku that your account sells.
/admin/:id/products/:product_id/skus/:sku_id/edit
This page is for editing the details of the sku sold by your account.
/commerce/v1/providers/:uid
/commerce/v1/providers/:uid/products/:product_id
/commerce/v1/providers/:uid/products/:product_id/skus/:sku_id
/commerce/v1/providers/:uid/orders/:order_id
/social/v1/users/:uid
/social/v1/users/:uid/orders/:order_id
/social/v1/account/:uid
The goal is to host the Next.js app on Firebase Cloud Functions with Firebase Hosting rewrite rules so our app is served from our Firebase Hosting URL, with a complete Typescript stack for both the Next app and for the Firebase Functions. Each individual page bundle is served in a new call to the Cloud Function which performs the initial server render.
This is based off of the work of @jthegedus in the with-firebase-hosting example.
If you're having issues, feel free to tag @sampsonjoliver in the issue you create on the next.js repo
- The empty
placeholder.htmlfile is so Firebase Hosting does not error on an emptypublic/folder and still hosts at the Firebase project URL. firebase.jsonoutlines the catchall rewrite rule for our Cloud Function.- The Firebase predeploy hooks defined in
firebase.jsonwill handle linting and compiling of the next app and the functions sourceswhenfirebase deployis invoked. The only scripts you should need aredev,cleananddeploy. - Specifying
"engines": {"node": "8"}in thepackage.jsonis required for firebase functions to be deployed on Node 8 rather than Node 6 (Firebase Blog Announcement) . This is matched in by specifying target ases2017insrc/functions/tsconfig.jsonso that typescript output somewhat compacter and moderner code.