{"id":13604755,"url":"https://github.com/Lomray-Software/vite-template","last_synced_at":"2025-04-12T02:31:31.199Z","repository":{"id":180743274,"uuid":"662252596","full_name":"Lomray-Software/vite-template","owner":"Lomray-Software","description":"Vite SSR BOOST template","archived":false,"fork":false,"pushed_at":"2024-10-02T10:04:45.000Z","size":736,"stargazers_count":27,"open_issues_count":0,"forks_count":5,"subscribers_count":4,"default_branch":"prod","last_synced_at":"2024-10-29T20:50:57.405Z","etag":null,"topics":["express","react","react-router","ssr","vite","vite-ssr-boost"],"latest_commit_sha":null,"homepage":"https://vite-template.lomray.com","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Lomray-Software.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-04T17:40:35.000Z","updated_at":"2024-10-29T09:21:24.000Z","dependencies_parsed_at":"2024-05-29T18:00:25.878Z","dependency_job_id":"cd02b391-8fe6-422f-ad93-83b80a4e9224","html_url":"https://github.com/Lomray-Software/vite-template","commit_stats":null,"previous_names":["lomray-software/vite-template"],"tags_count":58,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lomray-Software%2Fvite-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lomray-Software%2Fvite-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lomray-Software%2Fvite-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lomray-Software%2Fvite-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lomray-Software","download_url":"https://codeload.github.com/Lomray-Software/vite-template/tar.gz/refs/heads/prod","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223489629,"owners_count":17153791,"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","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":["express","react","react-router","ssr","vite","vite-ssr-boost"],"created_at":"2024-08-01T19:00:50.916Z","updated_at":"2024-11-07T09:30:50.867Z","avatar_url":"https://github.com/Lomray-Software.png","language":"TypeScript","funding_links":[],"categories":["Get Started"],"sub_categories":["Templates"],"readme":"# Vite template\n\n## Demo links\n - Streaming supported\n   - [SSR Docker (Streaming supported)](https://vite-template.lomray.com/)\n - Streaming **NOT** supported\n   - [SSR Amplify (Streaming not supported)](https://prod.d947n8vxd7uac.amplifyapp.com/)  \n   - [SSR Vercel (Streaming not supported)](https://vite-template-three.vercel.app/)  \n   - [SPA Amplify](https://prod.d2fyemmi74bwx3.amplifyapp.com/)\n\n## Explore\n - [prod](https://github.com/Lomray-Software/vite-template/tree/prod) current branch with Mobx + Store Manager, Head Manager (meta), Route Manager\n - [feature/localization](https://github.com/Lomray-Software/vite-template/tree/feature/localization) branch with example of localization\n\n## Used libraries\n - [VITE SSR BOOST](https://github.com/Lomray-Software/vite-ssr-boost)\n - [CONSISTENT SUSPENSE](https://github.com/Lomray-Software/consistent-suspense)\n - [REACT MOBX MANAGER](https://github.com/Lomray-Software/react-mobx-manager)\n - [REACT HEAD MANAGER](https://github.com/Lomray-Software/react-head-manager)\n - [REACT ROUTE MANAGER](https://github.com/Lomray-Software/react-route-manager)\n\n# Local development\n\n```bash\ngit clone git@github.com:Lomray-Software/vite-template.git\nnpm ci\nnpm run develop\n```\n\n## Structure\n- `constants/index` - configure application constants\n- `common/services/route-manager` - configure site routes\n\n## Bundle analyze\n```bash\nvite-bundle-visualizer\n```\n\n## Git workflow\n__NOTE: see .github for understand CI/CD__\n1. Create feature, bugfix, etc.\n2. Create Pull Request \u0026 test\n3. Squash \u0026 merge into `prod`\n\n## Some cases to pay attention to.\n - Right solution for wrap `\u003cOutlet /\u003e` into `\u003cSuspense /\u003e`. If you would like to wrap your lazy routes only once:\n```typescript jsx\nimport { Outlet, useLocation } from 'react-router-dom';\nimport type { FCRoute } from '@lomray/vite-ssr-boost/interfaces/fc-route';\nimport { Suspense } from '@lomray/consistent-suspense';\n\n/**\n * NOTE: without key it's doesn't work\n * @see https://github.com/remix-run/react-router/issues/10568\n * @constructor\n */\nconst MyLayout: FCRoute = () =\u003e {\n  const { key } = useLocation();\n\n  return (\n    \u003cSuspense key={key}\u003e\n      \u003cOutlet/\u003e\n    \u003c/Suspense\u003e\n  )\n}\n```\n\n- In some cases nested Suspense should be memorized for preventing \"This Suspense boundary received an update before it finished hydrating.\"\n```typescript jsx\n/**\n * Parent component can receive update what will entail rerender.\n * We should avoid rerenders for children suspense. \n * @constructor\n */\nconst Parent: FC = () =\u003e {\n  /**\n   * Memorize Suspense to avoid errors\n   */\n  const children = useMemo(\n    () =\u003e (\n      \u003cSuspense fallback={\u003cFallback/\u003e}\u003e\n        \u003cUserWrapper id={id} fields={restFields}/\u003e\n      \u003c/Suspense\u003e\n    ),\n    [],\n  );\n\n  return (\n    \u003cdiv style={{ paddingLeft: '50px', textAlign: 'left' }}\u003e\n      {children}\n    \u003c/div\u003e\n  );\n}\n```\n\n## Docker build\n[See github workflow](.github/workflows/release.yml) or\n```bash\nnpm run build\nssr-boost build-docker --image-name test-image\n```\n\n## AWS Amplify build (amplify.yml) - SPA\n```yaml\nversion: 1\nfrontend:\n  phases:\n    preBuild:\n      commands:\n        - nvm use 18.19.0\n        - npm ci\n    build:\n      commands:\n        - npm run build -- --only-client\n  artifacts:\n    baseDirectory: build/client\n    files:\n      - '**/*'\n  cache:\n    paths:\n      - node_modules/**/*\n```\n\n## AWS Amplify build (amplify.yml) - SSR\n```yaml\nversion: 1\nfrontend:\n  phases:\n    preBuild:\n      commands:\n        - nvm use 18.19.0\n        - npm pkg delete scripts.prepare\n        - npm ci\n    build:\n      commands:\n        - npm run build -- --eject\n        - npm run build:amplify\n  artifacts:\n    baseDirectory: .amplify-hosting\n    files:\n      - '**/*'\n  cache:\n    paths:\n      - node_modules/**/*\n```\n\n## Vercel build (vercel.json) - SSR\n```json\n{\n  \"buildCommand\": \"npm pkg delete scripts.prepare \u0026\u0026 npm run build -- --serverless \u0026\u0026 npm run build:vercel\",\n  \"installCommand\": \"npm ci\",\n  \"outputDirectory\": \".vercel/output\"\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLomray-Software%2Fvite-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLomray-Software%2Fvite-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLomray-Software%2Fvite-template/lists"}