Giter Site home page Giter Site logo

rohitweasley / storefront-angular-starter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vendure-ecommerce/storefront-angular-starter

0.0 0.0 0.0 2.87 MB

An example storefront PWA for Vendure built with Angular

Home Page: https://angular-storefront.vendure.io

Shell 0.05% JavaScript 0.33% TypeScript 76.80% HTML 19.20% Dockerfile 0.08% SCSS 3.54%

storefront-angular-starter's Introduction

Vendure Angular Storefront

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.

Development

  1. Clone this repo
  2. Run npm install or yarn in the root dir
  3. Run npm start or yarn start to build in development mode.
  4. Make sure you have a local Vendure instance running a http://localhost:3000.
  5. Open http://localhost:4201 to see the storefront app running.

Code generation

This project uses graphql-code-generator to generate TypeScript types based on the Vendure GraphQL API. To update the types, first change the schema property of codegen.yml to point to your local Vendure server, and then run the generate-types npm script.

Deployment

To deploy this storefront in a production environment, take the following steps:

  1. 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/'.
  2. Open the angular.json file and set the baseHref values to point to root:
      "production": {
    -    "baseHref": "/storefront/",
    -    "deployUrl": "/storefront/", 
    +    "baseHref": "/",
    +    "deployUrl": "/", 
  3. 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.
  4. The built artifacts will be found in the dist/ directory. The command to run the storefront as a server-rendered app is node 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 to localhost:4000.
  5. In the Vender server config, configure the EmailPlugin to point to the correct routes used by this storefront:
    EmailPlugin.init({
      // ...
      globalTemplateVars: {
        fromAddress: '"Example_Server" <[email protected]>',
        verifyEmailAddressUrl: 'https://your-domain.com/account/verify',
        passwordResetUrl: 'https://your-domain.com/account/reset-password',
        changeEmailAddressUrl: 'https://your-domain.com/account/change-email-address',
      }
    })

Deploying the demo

This project is used in the angular-storefront.vendure.io 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.

Once the GitHub action workflow has completed and the built artifacts have been successfully uploaded to the S3 bucket, the app can be deployed with git push dokku master.

License

MIT

storefront-angular-starter's People

Contributors

michaelbromley avatar dependabot[bot] avatar knoid avatar cliffcrerar avatar michaelmeuli avatar mizan3050 avatar

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.