This repo contains an Angular project with everything you need to start developing a new web app.
- Angular SSR
- TailwindCSS
- Node.js
- TypeScript
Check out the GitHub tags
to see which Angular versions are supported by this project.
- Angular with SSR (A complete guide to SSR).
- TailwindCSS.
- Folder structure:
components
folder.components/UI
folder.components/pages
folder withHomePageComponent
andPage404Component
.services
folder withEnvService
.
<router-outlet></router-outlet>
inapp.component.html
.- Angular CDK.
- Ability to set different
title
anddescription
per page. sitemap
andapicache
to serverobots.txt
andsitemap.xml
.Dockerfile
to build a Docker Image.provideHttpClient(withFetch())
already configured.- From angular.dev:
It's strongly recommended to enable fetch for applications that use Server-Side Rendering for better performance and compatibility.
- From angular.dev:
- Hydration already configured with:
EventReplay
- custom
HttpTransferCacheOptions
.
- Shell script
development.sh
to reload the docker container. - Unified
.env
file for both frontend and backend (Read more).
- Clone the repository (you can choose the Angular version from the
GitHub tags
). - Move the repository to new git repository.
cd
to the repo folder.- remove .git (hidden) folder.
- run
git init
.
- Rename the project.
- rename the project folder.
- find all occurrences of
angular-app-template
in the project and replace it with your new app name.
- Rename path in Dockerfile.
- in the last line, replace
project-name
with your project name.
- in the last line, replace
- Set parameters in
development.sh
. - Add
.env
to.gitignore
.
- Customize routes in
app.routes.ts
. - Setup
server.ts
by following the TODOs.- define the content of
robots.txt
- static routes are automatically added to
sitemap.xml
(it's your task to manage the dynamic ones).
- define the content of
- Customize the HTTP request cache system in
app.config.ts
. - Customize
.env
variables. To pass them to the frontend, follow this steps:- Add a new variable into
.env
. - Pass it into TransferState in
app.config.server.ts
. - Retrieve it from TransferState into
env.service.ts
.
- Add a new variable into
- run
development.sh
.
Running with ng serve
means some server functionality (like robots.txt
and sitemap.xml
) will not work. So:
- run
npm run watch
(This will build the app each time the files are changed). - start the node.js server to serve the app
npm run serve:ssr:angular-app-template
(replaceangular-app-template
whit your app name).
Feel free to open issues or pull requests to discuss improvements and additional features.