{"id":19134560,"url":"https://github.com/azerothcore/universal-pwa","last_synced_at":"2025-10-14T15:39:32.011Z","repository":{"id":140478567,"uuid":"170697484","full_name":"azerothcore/universal-pwa","owner":"azerothcore","description":"Boilerplate project to build an Universal Progressive Web App with ReactJS (CRA)","archived":false,"fork":false,"pushed_at":"2023-02-22T23:00:58.000Z","size":1905,"stargazers_count":11,"open_issues_count":2,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-10-12T00:24:02.502Z","etag":null,"topics":["create-react-app","graphql","prerender","pwa","react","reactstrap","rest-api","seo","sitemap","ssg","ssr","universal-app"],"latest_commit_sha":null,"homepage":"https://azerothcore.github.io/universal-pwa/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/azerothcore.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-02-14T13:42:35.000Z","updated_at":"2024-11-28T17:45:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"5fabd5ff-ec9e-4b26-8259-19ed852a5253","html_url":"https://github.com/azerothcore/universal-pwa","commit_stats":{"total_commits":38,"total_committers":1,"mean_commits":38.0,"dds":0.0,"last_synced_commit":"f7178681f9e08d7e6a22bca6b229d227284e8766"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/azerothcore/universal-pwa","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azerothcore%2Funiversal-pwa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azerothcore%2Funiversal-pwa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azerothcore%2Funiversal-pwa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azerothcore%2Funiversal-pwa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azerothcore","download_url":"https://codeload.github.com/azerothcore/universal-pwa/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azerothcore%2Funiversal-pwa/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279019345,"owners_count":26086711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["create-react-app","graphql","prerender","pwa","react","reactstrap","rest-api","seo","sitemap","ssg","ssr","universal-app"],"created_at":"2024-11-09T06:27:08.373Z","updated_at":"2025-10-14T15:39:31.996Z","avatar_url":"https://github.com/azerothcore.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HW Universal PWA\n\n![image](https://i.imgur.com/mDWWMum.jpg)\n\nThis is a boilerplate React project that allows you to start creating an Universal PWA. It is based on a flexible setup of [create-react-app](https://facebook.github.io/create-react-app/) script without any external framework such as Next.js or GatsbyJS.\n\n**An universal PWA is an app that:**\n+ can be indexable by web crawler (even those who cannot execute javascript)\n+ can work offline (thankfully to the serviceWorker)\n+ can work on any devices\n+ can be installed natively and uses devices APIs\n+ can be used for every kind of project: app, static website, hybrid\n\n**Moreover it's preconfigured to have:**\n+ path aliases\n+ full-working intellisense\n+ debug configurations\n+ modular directory structure\n+ formatting rules and settings for visual studio code\n+ automatic sitemap.xml for both SSG and SSR\n+ automatic installation of missing npm modules at start\n+ GraphQL and REST ready\n  \nand many other useful features allowing you to develop at the best!\n\nSo please, use VSCode, try to be [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), comment your code with [JSDocs](http://usejsdoc.org/),\nlearn to use [React contexts](https://reactjs.org/docs/context.html) and all Javascript ES6 and React best practices and patterns!\n\n**Note:** we're using 4 spaces (instead of 2 that is common in javascript because of [callback hell](http://callbackhell.com/)) because it discourages nesting. In fact reducing the spaces to fit more levels in is a counterproductive idea. Use async/await as much as possible. \n\n### How to install\n\n1. npm install\n2. create a copy of /src/conf/conf.dist.js and rename in conf.js (do not delete or rename the .dist.js file directly!)\n3. Configure your conf.js\n\n### How to develop\n\nYou can edit this project on your needs, even ejecting CRA to have a full configurable project.\nHowever in most cases you just need to edit following files:\n\n1. **package.json:** app name, version etc.\n2. **src/conf/conf.js**\n3. **public/manifest.json**\n4. **src/client/** files implementing your logic\n5. **optional:** other /apps/ configurations\n\n### How to run (development):\n\n1. npm run start\n\n### How to serve (production)\n\n1. **npm run build** or **npm run build:ssg** (for static generation of routes)\n2. **npm run start:serve** (or deploy everywhere you want if you don't need SSR)\n\nyou can use **npm run serve:screen**  to run the process in background with linux screen utility\n\n**NOTE:** to improve SEO enable prerender feature for SSR (Read dedicated paragraph below)\n\n## Core concepts\n\nWith this base you can build 3 kind of projects:\n\n### 1. PWA: Client Side Rendered App (CSR)\n\nA CSR application is totally rendered by the client via Javascript. The client will receive only a small index.html\nand the bundled javascript application will render the content.\n\nTo build this kind of app you don't need any kind of requirement since you could develop and start/build\nyour app directly with npm commands.\n\n**Pros:**\n+ No server-side nodejs required, you can host everywhere you want\n+ Building process is relatively fast\n\n**Cons**\n- Not all Web-Crawlers can indexing such app properly.\n- Browser with old or deactivated Javascript cannot content of this app.\n\nYou should use it as a web app not as a blog or any other website that needs indexing and high compatibility.\n\n\n### 2. Static PWA: CSR + Static Site Generation (CSR+SSG)\n\nA Static Site Generation is a technique that allow you to pre-render your app pages/routes during the build process\ncreating a version of that page that contains the content to index and the bundler will only attach event-listener to pre-existing html (hydration). This will allow you to deploy a static site that will be fully indexable by the crawlers.\n\nTo use SSG you should install react-snap globally using **npm install -g react-snap** then you can use: **npm run build:ssg** instead of normal build command. We don't include it in our package.json because it downloads the entire chromium engine that is quite big, so you will download it on your needs.\n\n**Pros**\n+ No server-side nodejs required, you can host everywhere you want\n+ Can be indexed by all crawlers\n+ First loading is very fast because it contains already all html\n\n**Cons**\n+ Build process is slower\n+ If you add new content you must build it again if you need SSG features\n\nMore info Here: [React Static](https://medium.com/@tannerlinsley/%EF%B8%8F-introducing-react-static-a-progressive-static-site-framework-for-react-3470d2a51ebc)\n\n### 3. Universal PWA: CSR + SSG + Server Side Rendering (SSR)\n\nThe approach above (CSR+SSG) already allows you to develop an app/website that can be modern and indexable, but it's not yet an Universal PWA. There are a lot of websites that changes their contents very often (a blog) or even in real-time depending on some parameters (search engine). Such apps cannot be totally static generated at build time of course so we need an extra layer to handle the \"crowling problem\". This is called Server Side Rendering.\nThe SSR is the method used by old web apps (often written in PHP or Java Servlets) to serve the entire content to the client directly rendered by the server. This method can be used now as an helper to CSR and SSG serving pre-rendered and not dynamic static page only to some kind of clients (such as Web-Crawlers).\n\nTo use SSR you need to install following packages:\n\n**npm install prerender prerender-node**\n\nWe don't include it in our package.json because it downloads the entire chromium engine that is quite big, so you will download it on your needs.\n\nthen you have just to configure your conf.js and enable prerender conf.\n\n**Pros**\n+ Can be indexed by all crawlers\n+ First loading is very fast because it contains already all html\n+ Can automatically generate pages not included in SSG build\n\n**Cons**\n+ It requires nodejs server\n+ You cannot deploy everywhere\n\n\n**NOTE:** Of course you can even use CSR+SSG with a 3rd party CDN service that will prerender your pages allowing you to host your app everywhere, but mostly such services are not free.\n\n\n## Directory Structure\n\nThis project follows partially the [hw-core directory structure](http://hw-core.github.io/directory-structure/) on (CRA folder structure)[https://facebook.github.io/create-react-app/docs/folder-structure]\n\nWith following specs:\n\n* apps: tools used by the project for specific tasks \n* public: public assets included in build but not directly required by src/\n* src: application sources\n  * client\n    * App: Application Layout\n    * Components: Reusable application-specific components **(generally they cannot be shared between projects)**\n    * Routes: Components related to specific routes\n  * conf: platform configuration files\n  * deps: internal reusable dependencies **(they can be shared between projects)**\n  * modules: optional and pluggable modules to extend app functionalities\n\nFor internal deps and modules we're using [subrepo](https://github.com/ingydotnet/git-subrepo) instead of subtree/submodule that\nare not enough to both include a git based dependency and working on it at the same time. \nYou can check the app.sh script to see how to sync your dependencies.\n\n## Folder aliases:\n\nWe're monkey-patching the CRA via [craco](https://github.com/sharegate/craco/blob/master/README.md) library allowing us to \ncreate some useful path alias to avoid relative path hell: ( ../../ )\n\nSo you can use paths defined in cra-config.js file:\n\n        \"@this/src\": path.resolve(__dirname, 'src/'),\n        \"@this/conf\": path.resolve(__dirname, 'src/conf'),\n        \"@hw-core\": path.resolve(__dirname, 'src/deps/hw-core')\n\n## TODO (check our issuetracker for details):\n\n- Improve generation of static sitemaps\n- Implement exclude option for SSG routes\n- Integration with cordova/phonegap and electron\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazerothcore%2Funiversal-pwa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazerothcore%2Funiversal-pwa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazerothcore%2Funiversal-pwa/lists"}