This is an e-commerce storefront application which is designed to be used with the Vendure ecommerce framework as a back end.
It is a progressive web application (PWA) which also uses Angular Universal for server-side rendering.
The app is built with the Angular CLI, with the data layer being handled by Apollo Client.
- Clone this repo
- Run
npm install
oryarn
in the root dir - Run
npm start
oryarn start
to build in development mode. - Make sure you have a local Vendure instance running a
http://localhost:3000
. - Open
http://localhost:4201
to see the storefront app running.
To deploy this storefront in a production environment, take the following steps:
- Open the environment.prod.ts file and change the values to match your deployed Vendure server. You also probably want to set the
baseHref
value to'/'
rather than'/storefront/'
. - Open the angular.json file and set the baseHref values to point to root:
"production": { - "baseHref": "/storefront/", - "deployUrl": "/storefront/", + "baseHref": "/", + "deployUrl": "/",
- You then need to build for production using the
build:ssr
npm script. This can be done either locally or on your production server, depending on your preferred workflow. - The built artifacts will be found in the
dist/
directory. The command to run the storefront as a server-rendered app isnode dist/server/main.js
. This will start a node server running on port 4000. You should configure your webserver to pass requests arriving on port 80 tolocalhost:4000
.
This project is used in the Vendure Demo. There is a GitHub Actions workflow which is triggered whenever a new tag is added. The tag should be of the format "vX.Y.Z"
. The workflow will run the build:ssr
script and upload the compiled output to an Amazon S3 bucket, from which the vendure-demo project will pull the artifacts.
MIT