Angular Universal PWA Starter
Angular Universal PWA Starter built with Angular Cli on Nestjs with TypeORM + Postgres. Auth with jsonwebtoken library.
{appId: 'angular-universal-pwa-starter'}
username
, password
, and database
fields.private.key
and public.key
generate your own. Don't store your production keys on github..env
in the root of the project (ie next to readme.md). Do not save it to source control. Give it the following variables:
ESSION_ID_SECURE_COOKIE=false
OSTGRES_PORT=5432
OSTGRES_USERNAME=postgres
OSTGRES_PASSWORD=testingpass
OSTGRES_DATABASE=testingDB
AILGUN_API_KEY=yourAPIKey
AILGUN_EMAIL_DOMAIN=mail.yourwebsite.com
ITENAME_BASE=yourwebsite.com
ITE_URL=http://localhost:4200
.env
file in your deploy folder, it will have the same variable names, but with values suited for a production environment.ng build --prod
, so let's just skip that pain entirely.npm run dev-server
to run the aping serve --aot --env=e2e
to run the frontend which protracter will use in watch modenpm run e2e:watch
e2e tests which rerun upon file save.ng serve --aot
- Run in frontend aot development mode on port 4200.npm run dev-server
- Runs server on port 8000 via ts-node, assumes no frontend changes in regards to rendering with universal.npm run prep-dev-server
- Full build of frontend, then serves frontend and backend on port 8000 via ts-node.npm run deploy
- Build and push server & frontend assets to github deployment repo.npm run analyze-aot
- Bundle analysis of non-tree shaken bundle. lets you see the individual angular module pieces.npm run analyze-deploy
- Bundle analysis of tree shaken bundle. kind of opaque, but truest to reality.yarn upgrade-interactive
- Upgrade only what you want to.npm run format
- formats with tsfmt (typescript-formatter) based on tsfmt.json settings. This script gets called automatically before prep-dev-server
and deploy
.npm run deploy
format
whichs reads options from tsfmt.json and formats code for consistent style.prep-front-end
ng build prod
to build the frontend production app.ng build --prod --app 1 --output-hashing=false
to build the server Aot Factory: AppServerModuleNgFactory
prep-server
which uses nestjs.tsconfig.json to compile the server assets to js.copy-needed-files-to-deploy-folder
which copies yarn.lock and package.json for installing dependencies on server and moves the dist folder to angular-universal-pwa-starter-deploy (or whatever you name your folder ending in -deploy)deploy-to-github
which changes your directory to the deploy folder, then makes an auto generated commit of the contents of the deploy folder.creating deployment on vps:
cd /var/www/
sudo git remote add origin https://github.com/EreckGordon/angular-universal-pwa-starter-deploy
sudo git pull origin master
yarn
updating deployment:
ssh root@ipv4 address
su - web
cd /var/www/
sudo git pull origin master
yarn
pm2 restart dist/server
~linting + standardize code formatting~ <-- ~tsfmt~ prettier
~testing~
~configure environment variable for server like cli. This would allow insecure cookies during dev and secure during prod without fiddling by hand.~ <-- dotenv
~Error: Could not extract user from request: jwt expired
need to deal with expired JWT.~
~frontend auth module~
refactor backend auth
~baseUrl as a part of environment~
~social provider upgrades:~
provider: 'emailAndPassword'
~~recaptchas everywhere that you can sign in or create account. missing in a few areas:~
~SEO Stuff:~
~ssr module -- currently AppController eats any get requests. Put it into its own module and import it last, so it only eats unused routes, letting us use get requests.~
~wipe out frontent functions except create anonymous user as hello world to server + db~
~frontend has an unauthorize function. i think it may be useless, because the server should just handle unauthorize upon account deletion.~
~websocket~ <-- see auth gateway + auth cache.
~update auth module middleware usage~
~Move shared interfaces to dedicated shared folder.~
~Rename from src
to frontend
to clarify intentions.~
google analytics
file uploads with dropzone
flesh out blog
service worker push
second theme - simultaneously active for additional color options
comments / chat system
database migrations
copy over only a barebones package.json that just gives the dependencies, rather than the entire copy of package.json as currently implemented.
auto delete anonymous users over a certain age. maybe a cron job? maybe with a subject.
self-hosted fonts, icons (maybe?)
needed tests