This repo contains an Angular project with everything you need to start developing a new web app.
- Angular SSR
- TailwindCSS
- Node.js
- TypeScript
Needs Prisma in Angular SSR? Check out the prisma branch and its README.md
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:
componentsfolder.components/UIfolder.components/pagesfolder withHomePageComponentandPage404Component.servicesfolder withEnvService.
<router-outlet></router-outlet>inapp.component.html.- Angular CDK.
- Ability to set different
titleanddescriptionper page. sitemapandapicacheto serverobots.txtandsitemap.xml.Dockerfileto 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.
Hybrid renderingready to use.- Shell script
development.shto reload the docker container. - Unified
.envfile for both frontend and backend (Read more). - Zoneless change detection (Read more)
- Clone the repository (you can choose the Angular version from the
GitHub tags). - Move the repository to new git repository.
cdto the repo folder.- remove .git (hidden) folder.
- run
git init.
- Rename the project.
- rename the project folder.
- find all occurrences of
angular-app-templatein the project and replace it with your new app name.
- Rename path in Dockerfile.
- in the last line, replace
project-namewith your project name.
- in the last line, replace
- Set parameters in
development.sh. - Add
.envto.gitignore.
- Customize routes in
app.routes.ts. - Setup
server.tsby 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
.envvariables. 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
- Choose the rendering mode for each page in
app.routes.server.ts.
- 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-templatewhit your app name).
Feel free to open issues or pull requests to discuss improvements and additional features.