{"id":503991,"date":"2026-11-19T19:15:28","date_gmt":"2026-11-19T16:15:28","guid":{"rendered":"https:\/\/savepearlharbor.com\/?p=503991"},"modified":"2026-11-19T19:15:28","modified_gmt":"2026-11-19T16:15:28","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=503991","title":{"rendered":"\u00ab\u0427\u0435\u043a\u043b\u0438\u0441\u0442 \u0434\u0435\u043b\u00bb: \u0441\u0435\u043c\u0435\u0439\u043d\u044b\u0439 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u043d\u0430 Fastify, React \u0438 PWA \u2014 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0438 \u0433\u0440\u0430\u0431\u043b\u0438"},"content":{"rendered":"<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/extt\/d4\/6f\/e8\/d46fe80e4135c612dbd071c42f3e1b6a.png\" alt=\"\u041e\u0431\u043b\u043e\u0436\u043a\u0430\" width=\"1200\" height=\"630\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/extt\/d4\/6f\/e8\/d46fe80e4135c612dbd071c42f3e1b6a.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/extt\/d4\/6f\/e8\/d46fe80e4135c612dbd071c42f3e1b6a.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u041e\u0431\u043b\u043e\u0436\u043a\u0430<\/figcaption><\/div>\n<\/figure>\n<p><em>\u0414\u0438\u0441\u043a\u043b\u0435\u0439\u043c\u0435\u0440: \u044d\u0442\u043e \u043c\u043e\u0439 \u043f\u0435\u0442-\u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u0441\u0442\u0430\u0442\u044c\u044f \u043e \u043d\u0451\u043c, \u0431\u0435\u0437 \u0437\u0430\u043a\u0430\u0437\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f. \u041a\u043e\u0434\u0430 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u043c\u0430\u0440\u043a\u0435\u0442\u0438\u043d\u0433\u0430.<\/em><\/p>\n<p>\u041e\u0431\u044b\u0447\u043d\u044b\u0435 \u0442\u0430\u0441\u043a-\u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u0443\u044e\u0442 \u043f\u043e\u0434 \u043e\u0434\u043d\u043e\u0433\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430: \u043c\u043e\u0439 \u0434\u0435\u043d\u044c, \u043c\u043e\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u044b, \u043c\u043e\u0438 \u043f\u0440\u0438\u0432\u044b\u0447\u043a\u0438. \u0412 \u0441\u0435\u043c\u044c\u0435 \u0432\u0441\u0451 \u043b\u043e\u043c\u0430\u0435\u0442\u0441\u044f. \u0423 \u0432\u0437\u0440\u043e\u0441\u043b\u044b\u0445 \u0440\u0430\u0431\u043e\u0442\u0430 \u0438 \u0431\u044b\u0442, \u0443 \u0434\u0435\u0442\u0435\u0439 \u0448\u043a\u043e\u043b\u0430 \u0438 \u043a\u0440\u0443\u0436\u043a\u0438, \u0430 \u043e\u0431\u0449\u0438\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0447\u0430\u0441\u0442\u043e \u0436\u0438\u0432\u0451\u0442 \u0432 \u0433\u043e\u043b\u043e\u0432\u0435 \u0443 \u043e\u0434\u043d\u043e\u0433\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430.<\/p>\n<p>\u00ab\u0427\u0435\u043a\u043b\u0438\u0441\u0442 \u0434\u0435\u043b\u00bb \u2014 \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u044d\u0442\u043e \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435: \u0434\u0435\u043d\u044c, \u043d\u0435\u0434\u0435\u043b\u044f, \u043c\u0435\u0441\u044f\u0446, \u0433\u043e\u0434, \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u0434\u0435\u043b\u0430, \u0434\u0435\u0442\u0441\u043a\u0438\u0439 \u0440\u0435\u0436\u0438\u043c, \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u044f \u0438 \u043e\u0444\u043b\u0430\u0439\u043d-\u0440\u0430\u0431\u043e\u0442\u0430. \u041d\u0438\u0436\u0435 \u2014 \u043a\u0430\u043a \u0443\u0441\u0442\u0440\u043e\u0435\u043d \u043f\u0440\u043e\u0435\u043a\u0442, \u043a\u0430\u043a\u0438\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u0443\u0434\u0430\u0447\u043d\u044b\u043c\u0438 \u0438 \u0433\u0434\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u044b\u0432\u0430\u0442\u044c.<\/p>\n<h3>\u041a\u0430\u043a\u0438\u0435 \u0431\u044b\u043b\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f<\/h3>\n<p>\u0421 \u0441\u0430\u043c\u043e\u0433\u043e \u043d\u0430\u0447\u0430\u043b\u0430 \u044f \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439:<\/p>\n<ul>\n<li>\n<p><strong>PWA, \u0430 \u043d\u0435 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<\/strong> \u041d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u043e\u0442 App Store, Google Play \u0438 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>\u0420\u0430\u0431\u043e\u0442\u0430 \u043d\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0435 \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c.<\/strong> \u041d\u0430\u0441\u0442\u043e\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u2014 \u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0439 \u0431\u043e\u043d\u0443\u0441, \u043d\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u2014 \u00ab\u0434\u043e\u0441\u0442\u0430\u043b \u0442\u0435\u043b\u0435\u0444\u043e\u043d \u043d\u0430 \u043a\u0443\u0445\u043d\u0435\u00bb.<\/p>\n<\/li>\n<li>\n<p><strong>\u041e\u0444\u043b\u0430\u0439\u043d.<\/strong> \u0420\u0435\u0431\u0451\u043d\u043e\u043a \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 \u0432 \u043c\u0430\u0448\u0438\u043d\u0435 \u0438\u043b\u0438 \u0432 \u0448\u043a\u043e\u043b\u0435 \u0431\u0435\u0437 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>\u0414\u0435\u0442\u0438 \u043a\u0430\u043a \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438.<\/strong> \u041d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u00ab\u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u0441\u043f\u0438\u0441\u043e\u043a\u00bb, \u0430 \u0441\u0432\u043e\u0439 \u0432\u0445\u043e\u0434, \u0441\u0432\u043e\u0438 \u043f\u0440\u0430\u0432\u0430 \u0438 \u0441\u0432\u043e\u0439 \u044d\u043a\u0440\u0430\u043d.<\/p>\n<\/li>\n<li>\n<p><strong>\u041c\u0438\u043d\u0438\u043c\u0443\u043c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439.<\/strong> \u041d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b, \u043d\u0435 \u0434\u043e\u0441\u043a\u0438, \u043d\u0435 \u0441\u043f\u0440\u0438\u043d\u0442\u044b. \u0427\u0435\u043a\u043b\u0438\u0441\u0442, \u0437\u0430\u0434\u0430\u0447\u0430, \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u0435, \u0440\u0435\u0431\u0451\u043d\u043e\u043a.<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0437 \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0440\u043e\u0441 \u0441\u0442\u0435\u043a: React + Vite \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435, Fastify + PostgreSQL \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435, Docker Compose \u0438 nginx \u043d\u0430 \u0434\u0435\u043f\u043b\u043e\u0435.<\/p>\n<h3>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430<\/h3>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/extt\/c7\/0c\/22\/c70c228e44964e3e89b83d184d005321.png\" alt=\"\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430\" width=\"1200\" height=\"650\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/extt\/c7\/0c\/22\/c70c228e44964e3e89b83d184d005321.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/extt\/c7\/0c\/22\/c70c228e44964e3e89b83d184d005321.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430<\/figcaption><\/div>\n<\/figure>\n<p>\u041a\u043b\u0438\u0435\u043d\u0442 \u2014 React 19, React Query, Dexie \u0434\u043b\u044f \u043e\u0444\u043b\u0430\u0439\u043d-\u0434\u0430\u043d\u043d\u044b\u0445 \u0438 Workbox \u0434\u043b\u044f service worker. \u0421\u0435\u0440\u0432\u0435\u0440 \u2014 Fastify 5, PostgreSQL, JWT \u043d\u0430 15 \u043c\u0438\u043d\u0443\u0442 \u0438 refresh-cookie \u043d\u0430 30 \u0434\u043d\u0435\u0439. \u0421\u0442\u0430\u0442\u0438\u043a\u0443 \u0438 API \u0440\u0430\u0437\u0434\u0430\u0451\u0442 nginx, \u0432\u0441\u0451 \u0436\u0438\u0432\u0451\u0442 \u0432 Docker Compose.<\/p>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 Fastify, \u0430 \u043d\u0435 Nest \u0438\u043b\u0438 Express:<\/p>\n<ul>\n<li>\n<p>\u0441\u0445\u0435\u043c\u0430 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0447\u0435\u0440\u0435\u0437 Zod \u0443\u0436\u0435 \u0431\u044b\u043b\u0430 \u0432 \u043e\u0431\u0449\u0435\u043c \u043f\u0430\u043a\u0435\u0442\u0435;<\/p>\n<\/li>\n<li>\n<p>\u043c\u0435\u043d\u044c\u0448\u0435 \u043c\u0430\u0433\u0438\u0438, \u0447\u0435\u043c \u0432 Nest, \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u0435\u0435, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435;<\/p>\n<\/li>\n<li>\n<p>\u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0430 \u043f\u0435\u0442-\u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0432\u0430\u0436\u043d\u0435\u0435 \u00ab\u044d\u043d\u0442\u0435\u0440\u043f\u0440\u0430\u0439\u0437\u043d\u043e\u0441\u0442\u0438\u00bb.<\/p>\n<\/li>\n<\/ul>\n<p>\u041c\u043e\u043d\u043e\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043d\u0430 pnpm: <code>apps\/web<\/code>, <code>apps\/api<\/code>, <code>packages\/shared<\/code>. \u0412 shared \u043b\u0435\u0436\u0430\u0442 \u0442\u0438\u043f\u044b, Zod-\u0441\u0445\u0435\u043c\u044b \u0438 \u0447\u0438\u0441\u0442\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u0440\u043e\u0434\u0435 \u0440\u0430\u0441\u0447\u0451\u0442\u0430 \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u0438 \u0440\u0430\u0441\u043a\u0440\u044b\u0442\u0438\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u0439. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0435 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u044b \u043c\u0435\u0436\u0434\u0443 \u0444\u0440\u043e\u043d\u0442\u043e\u043c \u0438 \u0431\u044d\u043a\u043e\u043c.<\/p>\n<h3>\u041c\u043e\u0434\u0435\u043b\u044c \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b:<\/p>\n<ul>\n<li>\n<p><code>users<\/code> \u2014 \u0432\u0437\u0440\u043e\u0441\u043b\u044b\u0435 \u0438 \u0434\u0435\u0442\u0438, \u0440\u043e\u043b\u044c, \u0441\u0442\u0430\u0442\u0443\u0441, \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438;<\/p>\n<\/li>\n<li>\n<p><code>checklists<\/code> \u2014 \u0434\u0435\u043d\u044c\/\u043d\u0435\u0434\u0435\u043b\u044f\/\u043c\u0435\u0441\u044f\u0446\/\u0433\u043e\u0434, \u0434\u0430\u0442\u0430 \u043d\u0430\u0447\u0430\u043b\u0430, \u0432\u043b\u0430\u0434\u0435\u043b\u0435\u0446, \u0440\u0435\u0436\u0438\u043c \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438;<\/p>\n<\/li>\n<li>\n<p><code>tasks<\/code> \u2014 \u0437\u0430\u0434\u0430\u0447\u0430, \u0434\u0430\u0442\u0430, \u0432\u0440\u0435\u043c\u044f, \u0441\u0442\u0430\u0442\u0443\u0441, \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442, \u043e\u0446\u0435\u043d\u043a\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438;<\/p>\n<\/li>\n<li>\n<p><code>recurrence_rules<\/code> \u2014 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u044f;<\/p>\n<\/li>\n<li>\n<p><code>parent_child_links<\/code> \u2014 \u0441\u0432\u044f\u0437\u044c \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0438 \u0440\u0435\u0431\u0451\u043d\u043a\u0430 \u0441 \u043f\u0440\u0430\u0432\u0430\u043c\u0438;<\/p>\n<\/li>\n<li>\n<p><code>routines<\/code> \u2014 \u0441\u043e\u0445\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0435 \u043d\u0430\u0431\u043e\u0440\u044b \u0437\u0430\u0434\u0430\u0447;<\/p>\n<\/li>\n<li>\n<p><code>reminders<\/code> \u0438 <code>devices<\/code> \u2014 push \u0438 \u0431\u0443\u0434\u0438\u043b\u044c\u043d\u0438\u043a\u0438.<\/p>\n<\/li>\n<\/ul>\n<p>\u0427\u0435\u043a\u043b\u0438\u0441\u0442 \u043d\u0435 \u0445\u0440\u0430\u043d\u0438\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u0434\u0430\u0447 \u043a\u0430\u043a JSON. \u0417\u0430\u0434\u0430\u0447\u0438 \u043b\u0435\u0436\u0430\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0443 \u043d\u0438\u0445 \u0435\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u0443\u0441, \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c, \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u044f \u0438 \u0438\u0441\u0442\u043e\u0440\u0438\u044f. JSON-\u043f\u043e\u043b\u0435 \u0431\u044b\u043b\u043e \u0431\u044b \u043f\u0440\u043e\u0449\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0430, \u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0441\u0442\u0430\u043b\u043e \u0431\u044b \u0431\u043e\u043b\u044c\u044e \u043f\u0440\u0438 \u043e\u0442\u0447\u0451\u0442\u0430\u0445 \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u044f\u0445.<\/p>\n<p>\u041f\u0435\u0440\u0438\u043e\u0434 \u0437\u0430\u0434\u0430\u0451\u0442\u0441\u044f \u043f\u0430\u0440\u043e\u0439 <code>period_type<\/code> + <code>period_start<\/code>. \u0414\u043b\u044f \u0434\u043d\u044f \u044d\u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u0434\u0430\u0442\u0430, \u0434\u043b\u044f \u043d\u0435\u0434\u0435\u043b\u0438 \u2014 \u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a (\u0438\u043b\u0438 \u0434\u0435\u043d\u044c, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u0434\u0435\u043b\u044f \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f), \u0434\u043b\u044f \u043c\u0435\u0441\u044f\u0446\u0430 \u2014 \u043f\u0435\u0440\u0432\u043e\u0435 \u0447\u0438\u0441\u043b\u043e.<\/p>\n<h3>\u041d\u0435\u0434\u0435\u043b\u044f \u043f\u043e \u0434\u043d\u044f\u043c, \u0430 \u043d\u0435 \u043e\u0434\u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u044b\u043d\u044f<\/h3>\n<p>\u041f\u0435\u0440\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043d\u0435\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0447\u0435\u043a\u043b\u0438\u0441\u0442\u0430 \u0431\u044b\u043b\u0430 \u043e\u0431\u044b\u0447\u043d\u044b\u043c \u0441\u043f\u0438\u0441\u043a\u043e\u043c. \u041d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u043e\u0441\u044c: 30 \u0437\u0430\u0434\u0430\u0447 \u043f\u043e\u0434\u0440\u044f\u0434 \u2014 \u044d\u0442\u043e \u043d\u0435 \u043f\u043b\u0430\u043d, \u0430 \u0441\u0442\u0435\u043d\u0430 \u0442\u0435\u043a\u0441\u0442\u0430. \u041f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e \u0434\u043d\u044f\u043c.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c API \u043e\u0442\u0434\u0430\u0451\u0442 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432 \u0445\u0440\u043e\u043d\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435, \u0430 \u0444\u0440\u043e\u043d\u0442 \u0440\u0430\u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u0438\u0445 \u043f\u043e <code>plannedDate<\/code>. \u0412\u043d\u0443\u0442\u0440\u0438 \u0434\u043d\u044f \u2014 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0430 \u043d\u0435 \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0412 PostgreSQL \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>sql<\/p>\n<pre><code>SELECT t.*  FROM tasks t WHERE t.checklist_id = $1   AND t.deleted_at IS NULL ORDER BY   CASE WHEN $2 = 'MANUAL' THEN t.sort_order END ASC,   CASE     WHEN $2 = 'TIME' THEN COALESCE(t.scheduled_start_at, t.due_at)   END ASC NULLS LAST,   CASE WHEN $2 = 'TIME' THEN t.planned_date END ASC NULLS LAST,   t.sort_order ASC,   t.created_at ASC;<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper\"><\/span><\/a><\/div><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0435\u0441\u0442\u044c \u0432\u0430\u0436\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u0440\u043e\u043c\u0438\u0441\u0441. \u0421\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u2014 \u0440\u0435\u0436\u0438\u043c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u043d\u043e \u0435\u0441\u043b\u0438 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u044f\u0432\u043d\u043e \u043f\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u043b \u0437\u0430\u0434\u0430\u0447\u0443, \u0447\u0435\u043a\u043b\u0438\u0441\u0442 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442 \u0432 <code>MANUAL<\/code> \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0435\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043e\u043a. \u0418\u043d\u0430\u0447\u0435 drag-and-drop \u0431\u044b\u043b \u0431\u044b \u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u044b\u043c: \u043b\u044e\u0431\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b\u043e \u0431\u044b \u0445\u0440\u043e\u043d\u043e\u043b\u043e\u0433\u0438\u044e.<\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 <code>checklists<\/code> \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u043f\u043e\u043b\u0435:<\/p>\n<p>sql<\/p>\n<pre><code>ALTER TABLE checklists  ADD COLUMN IF NOT EXISTS sort_mode text NOT NULL DEFAULT 'TIME'  CHECK (sort_mode IN ('TIME', 'MANUAL'));<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0440\u0443\u0447\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u2014 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 endpoint. \u041e\u043d \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 <strong>\u0432\u0441\u0435<\/strong> \u0437\u0430\u0434\u0430\u0447\u0438 \u0447\u0435\u043a\u043b\u0438\u0441\u0442\u0430, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0447\u0442\u043e \u0441\u043f\u0438\u0441\u043e\u043a \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0441\u044f \u0441 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f, \u0438 \u0432 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 <code>sort_order<\/code>:<\/p>\n<p>ts<\/p>\n<pre><code>await app.db.transaction(async (tx) =&gt; {  for (const [index, taskId] of input.taskIds.entries()) {    await tx.query(      'UPDATE tasks SET sort_order = $2, updated_at = now() WHERE id = $1',      [taskId, index],    );  }  await tx.query(    \"UPDATE checklists SET sort_mode = 'MANUAL', updated_at = now() WHERE id = $1\",    [id],  );});<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u041d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435 \u2014 <code>@dnd-kit\/core<\/code> \u0438 <code>@dnd-kit\/sortable<\/code>. \u041e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 <code>SortableTaskRow<\/code> \u0434\u0430\u0451\u0442 \u0440\u0443\u0447\u043a\u0443 \u0438 transform, \u0430 <code>DndContext<\/code> \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043d\u044f:<\/p>\n<p>tsx<\/p>\n<pre><code>const sensors = useSensors(  useSensor(PointerSensor, { activationConstraint: { distance: 6 } }),  useSensor(TouchSensor, {    activationConstraint: { delay: 180, tolerance: 6 },  }),);&lt;DndContext  sensors={sensors}  collisionDetection={closestCenter}  onDragEnd={(event) =&gt; handleDragEnd(event, dayTasks, dayKey)}&gt;  &lt;SortableContext items={dayTasks.map((task) =&gt; task.id)}&gt;    {dayTasks.map((task) =&gt; renderTaskRow(task, true))}  &lt;\/SortableContext&gt;&lt;\/DndContext&gt;<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/extt\/76\/a3\/22\/76a322f634dd07c4ab01a3e170bec25b.png\" alt=\"\u041d\u0435\u0434\u0435\u043b\u044f \u043f\u043e \u0434\u043d\u044f\u043c\" width=\"1440\" height=\"1000\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/extt\/76\/a3\/22\/76a322f634dd07c4ab01a3e170bec25b.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/extt\/76\/a3\/22\/76a322f634dd07c4ab01a3e170bec25b.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u041d\u0435\u0434\u0435\u043b\u044f \u043f\u043e \u0434\u043d\u044f\u043c<\/figcaption><\/div>\n<\/figure>\n<p><em>\u041d\u0435\u0434\u0435\u043b\u044f \u0440\u0430\u0437\u0431\u0438\u0442\u0430 \u043d\u0430 \u0434\u043d\u0438; \u0432\u043d\u0443\u0442\u0440\u0438 \u0434\u043d\u044f \u2014 \u0432\u0440\u0435\u043c\u044f, \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u0440\u0443\u0447\u043a\u0430 \u0434\u043b\u044f \u0440\u0443\u0447\u043d\u043e\u0439 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438.<\/em><\/p>\n<p>\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u2014 \u0447\u0430\u0441\u043e\u0432\u044b\u0435 \u043f\u043e\u044f\u0441\u0430. \u0414\u0430\u0442\u044b \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u043a\u0430\u043a <code>date<\/code>, \u0432\u0440\u0435\u043c\u044f \u2014 \u043a\u0430\u043a <code>timestamptz<\/code>. \u0412 UI \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0447\u0430\u0441\u043e\u0432\u043e\u043c \u043f\u043e\u044f\u0441\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0430 \u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0418\u043d\u0430\u0447\u0435 \u0437\u0430\u0434\u0430\u0447\u0430 \u00ab\u0432 18:00\u00bb \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u041a\u0430\u043b\u0438\u043d\u0438\u043d\u0433\u0440\u0430\u0434\u0435 \u0438 \u0432 \u041c\u043e\u0441\u043a\u0432\u0435 \u0432\u0435\u043b\u0430 \u0431\u044b \u0441\u0435\u0431\u044f \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443.<\/p>\n<h3>\u041e\u0444\u043b\u0430\u0439\u043d-\u0440\u0435\u0436\u0438\u043c<\/h3>\n<p>PWA \u0431\u0435\u0437 \u043e\u0444\u043b\u0430\u0439\u043d\u0430 \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0430\u0439\u0442 \u0441 \u0438\u043a\u043e\u043d\u043a\u043e\u0439. \u041c\u043d\u0435 \u043d\u0443\u0436\u0435\u043d \u0431\u044b\u043b \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439: \u043e\u0442\u043a\u0440\u044b\u043b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0435\u0437 \u0441\u0435\u0442\u0438, \u043e\u0442\u043c\u0435\u0442\u0438\u043b \u0437\u0430\u0434\u0430\u0447\u0443, \u0437\u0430\u043a\u0440\u044b\u043b, \u0430 \u043f\u0440\u0438 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0438 \u0441\u0432\u044f\u0437\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0443\u043b\u0435\u0442\u0435\u043b\u043e \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n<p>\u0421\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b service worker API-\u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438\u0434\u0443\u0442 \u043f\u043e \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 network-first \u0441 \u043a\u044d\u0448\u0435\u043c:<\/p>\n<p>ts<\/p>\n<pre><code>registerRoute(  ({ url, request }) =&gt;    request.method === 'GET' &amp;&amp; url.pathname.startsWith('\/api\/v1\/'),  async ({ request }) =&gt; {    const cache = await caches.open(apiCacheName(request));    try {      const response = await fetch(request);      if (response.ok) {        await cache.put(request, response.clone());      }      return response;    } catch (error) {      const cached = await cache.match(request);      if (cached) return cached;      throw error;    }  },);<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u041a\u044d\u0448 \u0438\u043c\u0435\u043d\u0443\u0435\u0442\u0441\u044f \u043f\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e (<code>api-${userId}<\/code>), \u0447\u0442\u043e\u0431\u044b \u043d\u0430 \u043e\u0431\u0449\u0435\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u043f\u043e\u0441\u043b\u0435 \u0441\u043c\u0435\u043d\u044b \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430 \u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0447\u0443\u0436\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<p>\u041c\u0443\u0442\u0430\u0446\u0438\u0438 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 IndexedDB-\u043e\u0447\u0435\u0440\u0435\u0434\u044c:<\/p>\n<p>ts<\/p>\n<pre><code>export async function enqueueTaskAction(userId, taskId, action) {  const row = {    id: crypto.randomUUID(),    userId,    taskId,    action,    createdAt: Date.now(),    attempts: 0,  };  await offlineDb.queue.put(row);  return row;}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u041f\u0440\u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u0441\u0432\u044f\u0437\u0438 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443. \u041a\u0430\u0436\u0434\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 <code>Idempotency-Key<\/code>, \u0440\u0430\u0432\u043d\u044b\u043c id \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u0438:<\/p>\n<p>ts<\/p>\n<pre><code>await api.post(`\/tasks\/${row.taskId}\/${row.action}`, undefined, {  headers: { 'Idempotency-Key': row.id },});<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u042d\u0442\u043e \u0432\u0430\u0436\u043d\u043e: \u0441\u0435\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u043e\u0440\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0441\u0435\u0440\u0432\u0435\u0440 \u0443\u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435, \u043d\u043e \u0434\u043e \u043e\u0442\u0432\u0435\u0442\u0430. \u0411\u0435\u0437 \u0438\u0434\u0435\u043c\u043f\u043e\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u0430\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0430 \u0431\u044b \u0437\u0430\u0434\u0430\u0447\u0443 \u0434\u0432\u0430\u0436\u0434\u044b \u0438\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u043b\u0430 \u0434\u0443\u0431\u043b\u044c.<\/p>\n<p>\u041e\u0447\u0435\u0440\u0435\u0434\u044c \u043d\u0435 \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0431\u044b\u0442\u044c \u00ab\u0443\u043c\u043d\u043e\u0439\u00bb. \u0415\u0441\u043b\u0438 \u043f\u0440\u0438\u0448\u0451\u043b <code>401<\/code>\/<code>403<\/code>, \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0438 \u0436\u0434\u0451\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0433\u043e \u0432\u0445\u043e\u0434\u0430. \u0415\u0441\u043b\u0438 <code>4xx<\/code>, \u043a\u0440\u043e\u043c\u0435 <code>429<\/code>, \u2014 \u0437\u0430\u0434\u0430\u0447\u0430, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0443\u0434\u0430\u043b\u0435\u043d\u0430 \u0438\u043b\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e, \u0437\u0430\u043f\u0438\u0441\u044c \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f. \u0421\u0435\u0442\u0435\u0432\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u2014 \u0441\u0442\u043e\u043f \u0438 \u043f\u043e\u0432\u0442\u043e\u0440 \u043f\u043e\u0437\u0436\u0435.<\/p>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/extt\/e2\/4a\/56\/e24a5656b910383b72b9fa3677a8e0af.png\" alt=\"\u041c\u043e\u0431\u0438\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f\" width=\"780\" height=\"1688\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/extt\/e2\/4a\/56\/e24a5656b910383b72b9fa3677a8e0af.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/extt\/e2\/4a\/56\/e24a5656b910383b72b9fa3677a8e0af.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u041c\u043e\u0431\u0438\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f<\/figcaption><\/div>\n<\/figure>\n<p><em>\u041c\u043e\u0431\u0438\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f: \u0442\u043e\u0442 \u0436\u0435 API, \u043d\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u2014 \u0442\u0435\u043b\u0435\u0444\u043e\u043d \u0438 \u043e\u0444\u043b\u0430\u0439\u043d.<\/em><\/p>\n<h3>\u041f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u044f<\/h3>\n<p>\u041f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u044f \u2014 \u044d\u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u043f\u0440\u0430\u0432\u0438\u043b, \u0430 \u043d\u0435 \u0444\u043b\u0430\u0433 \u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0435:<\/p>\n<p>sql<\/p>\n<pre><code>CREATE TABLE recurrence_rules (  id uuid PRIMARY KEY DEFAULT gen_random_uuid(),  task_template_id uuid NOT NULL REFERENCES tasks(id) ON DELETE CASCADE,  freq text NOT NULL,  interval integer NOT NULL DEFAULT 1,  by_weekday integer[],  until date,  count integer,  reminder_config jsonb NOT NULL DEFAULT '[]'::jsonb,  active boolean NOT NULL DEFAULT true);<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0420\u0430\u0441\u043a\u0440\u044b\u0442\u0438\u0435 \u0434\u0430\u0442 \u2014 \u0447\u0438\u0441\u0442\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>occurrenceDates(rule, originDate, start, horizonEnd)<\/code>. \u041e\u043d\u0430 \u043d\u0435 \u0445\u043e\u0434\u0438\u0442 \u0432 \u0431\u0430\u0437\u0443, \u043d\u0435 \u0437\u043d\u0430\u0435\u0442 \u043f\u0440\u043e HTTP \u0438 \u043b\u0435\u0433\u043a\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f. \u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0437\u0430\u0434\u0430\u0447 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0435\u0451 \u043d\u0430 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0435 45 \u0434\u043d\u0435\u0439 \u0438 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0434\u0430\u0442\u044b.<\/p>\n<p>ts<\/p>\n<pre><code>const dates = occurrenceDates(  { freq, interval, byWeekday },  originDate,  start,  horizonEnd,);for (const date of dates) {  if (existingDates.has(date)) continue;  await createTaskFromTemplate(tx, template, date);}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435 RRULE \u0446\u0435\u043b\u0438\u043a\u043e\u043c? \u0414\u043b\u044f MVP \u0445\u0432\u0430\u0442\u0438\u043b\u043e daily\/weekly\/monthly\/yearly \u0438 <code>BYDAY<\/code>. \u041f\u043e\u043b\u043d\u044b\u0439 RFC 5545 \u0441 <code>BYSETPOS<\/code>, \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0438 \u00ab\u043a\u0430\u0436\u0434\u044b\u043c \u0432\u0442\u043e\u0440\u044b\u043c \u0432\u0442\u043e\u0440\u043d\u0438\u043a\u043e\u043c\u00bb \u2014 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0442\u0435\u043c\u0430. \u041a\u043e\u0433\u0434\u0430 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f, <code>occurrenceDates<\/code> \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443, \u043d\u0435 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u0434.<\/p>\n<h3>\u0414\u0435\u0442\u0441\u043a\u0438\u0439 \u0440\u0435\u0436\u0438\u043c<\/h3>\n<p>\u0421\u0430\u043c\u0430\u044f \u043e\u043f\u0430\u0441\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u2014 \u0434\u043e\u0441\u0442\u0443\u043f\u044b. \u0420\u0435\u0431\u0451\u043d\u043e\u043a \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u0438\u0434\u0435\u0442\u044c \u0447\u0443\u0436\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438, \u0430 \u0432\u0437\u0440\u043e\u0441\u043b\u044b\u0439 \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0432 \u0447\u0443\u0436\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435.<\/p>\n<p>\u0412\u0441\u0435 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u0438\u0434\u0443\u0442 \u0447\u0435\u0440\u0435\u0437 <code>resolveOwner<\/code>. \u0415\u0441\u043b\u0438 \u0430\u043a\u0442\u043e\u0440 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u043d\u0435 \u0441\u0435\u0431\u044f, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043e\u043d \u0432\u0437\u0440\u043e\u0441\u043b\u044b\u0439, \u0443 \u043d\u0435\u0433\u043e \u0432\u043a\u043b\u044e\u0447\u0451\u043d \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0440\u0435\u0436\u0438\u043c \u0438 \u0435\u0441\u0442\u044c \u0430\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u0441\u0432\u044f\u0437\u044c \u0441 \u0440\u0435\u0431\u0451\u043d\u043a\u043e\u043c:<\/p>\n<p>ts<\/p>\n<pre><code>if (ownerId !== actor.id) {  if (actor.accountType !== 'ADULT' || !actor.isParent) {    throw forbidden();  }  const link = await getActiveParentLink(db, actor.id, ownerId);  if (!link) throw forbidden();}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u041f\u0440\u0430\u0432\u0430 \u0440\u0435\u0431\u0451\u043d\u043a\u0430 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 <code>parent_child_links.permissions<\/code>: \u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438, \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438, \u0432\u0438\u0434\u0435\u0442\u044c \u0441\u0435\u043c\u0435\u0439\u043d\u044b\u0435 \u0440\u0443\u0442\u0438\u043d\u044b. \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0438 \u0432 UI, \u043d\u043e \u0441\u0435\u0440\u0432\u0435\u0440 \u2014 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0438\u0441\u0442\u0438\u043d\u044b.<\/p>\n<p>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447 \u0441\u043e\u0437\u043d\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043e \u0432\u0437\u0440\u043e\u0441\u043b\u044b\u043c\u0438:<\/p>\n<p>ts<\/p>\n<pre><code>if (actor.accountType !== 'ADULT') {  throw forbidden('\u0423\u0434\u0430\u043b\u044f\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438 \u043c\u043e\u0436\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0437\u0440\u043e\u0441\u043b\u044b\u0439');}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0412 \u0434\u0435\u0442\u0441\u043a\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 \u043a\u043d\u043e\u043f\u043a\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u0442. \u042d\u0442\u043e \u043d\u0435 \u043f\u0440\u043e \u043d\u0435\u0434\u043e\u0432\u0435\u0440\u0438\u0435, \u0430 \u043f\u0440\u043e \u0441\u0442\u0440\u0430\u0445\u043e\u0432\u043a\u0443: \u0440\u0435\u0431\u0451\u043d\u043e\u043a \u043c\u043e\u0436\u0435\u0442 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0441\u0442\u0435\u0440\u0435\u0442\u044c \u0432\u0430\u0436\u043d\u043e\u0435 \u0434\u0435\u043b\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043e\u0437\u0434\u0430\u043b \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c.<\/p>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/extt\/b6\/42\/19\/b64219c90139a11d33257c838046acea.png\" alt=\"\u0414\u0435\u0442\u0441\u043a\u0438\u0439 \u0440\u0435\u0436\u0438\u043c\" width=\"780\" height=\"1688\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/extt\/b6\/42\/19\/b64219c90139a11d33257c838046acea.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/extt\/b6\/42\/19\/b64219c90139a11d33257c838046acea.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0414\u0435\u0442\u0441\u043a\u0438\u0439 \u0440\u0435\u0436\u0438\u043c<\/figcaption><\/div>\n<\/figure>\n<p><em>\u0414\u0435\u0442\u0441\u043a\u0438\u0439 \u044d\u043a\u0440\u0430\u043d: \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0432\u043e\u0438 \u0437\u0430\u0434\u0430\u0447\u0438, \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441 \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f.<\/em><\/p>\n<h3>\u0428\u0430\u0431\u043b\u043e\u043d\u044b \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u044f<\/h3>\n<p>\u0415\u0449\u0451 \u043e\u0434\u043d\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u2014 \u043f\u0443\u0441\u0442\u043e\u0439 \u044d\u043a\u0440\u0430\u043d. \u0427\u0435\u043b\u043e\u0432\u0435\u043a \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043d\u0435\u0434\u0435\u043b\u044e, \u0432\u0438\u0434\u0438\u0442 \u0447\u0438\u0441\u0442\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0438 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0448\u0430\u0431\u043b\u043e\u043d\u044b: 11 \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u043a\u0430\u0440\u043a\u0430\u0441\u043e\u0432 \u043d\u0430 \u0431\u0443\u0434\u043d\u0438 \u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435.<\/p>\n<p>\u0412\u043d\u0443\u0442\u0440\u0438 \u2014 \u0434\u0430\u043d\u043d\u044b\u0435, \u0430 \u043d\u0435 \u043c\u0430\u0433\u0438\u044f:<\/p>\n<p>ts<\/p>\n<pre><code>{  id: 'builtin-work-week',  title: '\u0420\u0430\u0431\u043e\u0447\u0430\u044f \u043d\u0435\u0434\u0435\u043b\u044f \u0431\u0435\u0437 \u043f\u0435\u0440\u0435\u0440\u0430\u0431\u043e\u0442\u043e\u043a',  items: [    {      dayOfWeek: 1,      title: '\u041f\u043e\u0434\u044a\u0451\u043c \u0438 \u0441\u0442\u0430\u043a\u0430\u043d \u0432\u043e\u0434\u044b',      time: '07:30',      category: 'HEALTH',      estimatedMinutes: 10,      priority: 'NORMAL',    },    \/\/ ...  ],}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0428\u0430\u0431\u043b\u043e\u043d \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435: \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043c \u043f\u043e items \u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0437\u0430\u0434\u0430\u0447\u0438 \u0447\u0435\u0440\u0435\u0437 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 API. \u041f\u043b\u044e\u0441 \u2014 \u043d\u0435 \u043d\u0443\u0436\u0435\u043d \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 endpoint \u0438 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f. \u041c\u0438\u043d\u0443\u0441 \u2014 20\u201330 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430. \u0415\u0441\u043b\u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0432 \u043f\u0440\u043e\u0434\u0435 \u0435\u0449\u0451 \u0440\u0430\u0437, \u044f \u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b batch-endpoint <code>POST \/checklists\/:id\/tasks\/bulk<\/code> \u0441 \u043e\u0434\u043d\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0435\u0439.<\/p>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/extt\/7c\/c1\/84\/7cc184b4d37777895846fb396ebd2825.png\" alt=\"\u0428\u0430\u0431\u043b\u043e\u043d\u044b\" width=\"1440\" height=\"900\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/extt\/7c\/c1\/84\/7cc184b4d37777895846fb396ebd2825.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/extt\/7c\/c1\/84\/7cc184b4d37777895846fb396ebd2825.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0428\u0430\u0431\u043b\u043e\u043d\u044b<\/figcaption><\/div>\n<\/figure>\n<p><em>\u0428\u0430\u0431\u043b\u043e\u043d\u044b \u043d\u0435\u0434\u0435\u043b\u0438: \u0431\u0443\u0434\u043d\u0438, \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435, \u043f\u043e\u0434\u044a\u0451\u043c, \u0441\u043e\u043d \u0438 \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u043a \u0434\u0435\u043b\u0430\u043c.<\/em><\/p>\n<h3>\u0427\u0442\u043e \u0432\u044b\u043b\u0435\u0437\u043b\u043e \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430<\/h3>\n<h4>Source maps \u0432 production<\/h4>\n<p>\u041e\u0434\u043d\u0430 \u0438\u0437 \u043f\u0435\u0440\u0432\u044b\u0445 \u043d\u0430\u0445\u043e\u0434\u043e\u043a \u0430\u0443\u0434\u0438\u0442\u0430: \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0435 <code>.<\/code><a href=\"http:\/\/js.map\" rel=\"noopener nofollow\"><code>js.map<\/code><\/a> \u043b\u0435\u0436\u0430\u043b\u0438 \u0440\u044f\u0434\u043e\u043c \u0441 \u0431\u0430\u043d\u0434\u043b\u043e\u043c \u0438 \u043e\u0442\u0434\u0430\u0432\u0430\u043b\u0438\u0441\u044c \u0432\u0441\u0435\u043c \u0436\u0435\u043b\u0430\u044e\u0449\u0438\u043c. \u0418\u0441\u043f\u0440\u0430\u0432\u0438\u043b \u0434\u0432\u0443\u043c\u044f \u0441\u043b\u043e\u044f\u043c\u0438: <code>build.sourcemap = false<\/code> \u0432 Vite \u0438 \u0437\u0430\u043f\u0440\u0435\u0442 <code>.map<\/code> \u043d\u0430 nginx.<\/p>\n<h4>\u0421\u043b\u0438\u0448\u043a\u043e\u043c \u0448\u0438\u0440\u043e\u043a\u0438\u0439 public-\u043f\u0440\u0435\u0444\u0438\u043a\u0441<\/h4>\n<p>\u0420\u0430\u043d\u044c\u0448\u0435 \u0432\u0441\u0451, \u0447\u0442\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u043b\u043e\u0441\u044c \u0441 <code>\/api\/v1\/auth\/<\/code>, \u0441\u0447\u0438\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u043c. \u042d\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u043e, \u043f\u043e\u043a\u0430 \u043d\u0435 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 auth-\u043c\u0430\u0440\u0448\u0440\u0443\u0442. \u0421\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u043c\u0435\u043d\u0438\u043b \u043d\u0430 \u0442\u043e\u0447\u043d\u044b\u0435 \u043f\u0443\u0442\u0438: register, login, refresh, logout, forgot\/reset, child-login.<\/p>\n<h4>Rate limit \u0438 X-Forwarded-For<\/h4>\n<p>\u0417\u0430 nginx <code>request.ip<\/code> \u043d\u0435\u043b\u044c\u0437\u044f \u0441\u043b\u0435\u043f\u043e \u0434\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0443. \u0415\u0441\u043b\u0438 nginx \u043f\u0440\u043e\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0439 <code>X-Forwarded-For<\/code>, \u043b\u0438\u043c\u0438\u0442 \u043e\u0431\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u043c\u0435\u043d\u043e\u0439 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430. \u0418\u0441\u043f\u0440\u0430\u0432\u0438\u043b: nginx \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 <code>X-Forwarded-For<\/code> \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c \u0430\u0434\u0440\u0435\u0441\u043e\u043c, Fastify \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 <code>trustProxy: 1<\/code>. \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430: \u0448\u0435\u0441\u0442\u044c \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u043b\u043e\u0433\u0438\u043d\u0430 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043d\u044b\u043c\u0438 IP \u0434\u0430\u044e\u0442 <code>429<\/code> \u043d\u0430 \u0448\u0435\u0441\u0442\u043e\u0439.<\/p>\n<h4>\u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438<\/h4>\n<p><code>pnpm audit<\/code> \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u043b high \u0432 Zod 3.25. \u041e\u0431\u043d\u043e\u0432\u0438\u043b \u0434\u043e Zod 4.6.7 \u0438 \u043f\u0435\u0440\u0435\u0432\u0451\u043b OpenAPI-\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u043d\u0430 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 <code>z.toJSONSchema<\/code>. \u0410\u0443\u0434\u0438\u0442 \u0441\u0442\u0430\u043b \u0447\u0438\u0441\u0442\u044b\u043c, \u043d\u043e \u0442\u0430\u043a\u0438\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0433\u0434\u0430 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u043f\u0440\u043e\u0433\u043e\u043d\u0430 \u0432\u0441\u0435\u0445 \u0441\u0445\u0435\u043c.<\/p>\n<h4>\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438<\/h4>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043b CSP, HSTS, <code>nosniff<\/code>, <code>SAMEORIGIN<\/code>, Referrer-Policy, Permissions-Policy. \u0417\u0430\u043e\u0434\u043d\u043e \u0443\u0431\u0440\u0430\u043b \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 host nginx \u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u043c: \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u043f\u043e\u043b\u0443\u0447\u0430\u043b <code>X-Frame-Options<\/code> \u0434\u0432\u0430\u0436\u0434\u044b.<\/p>\n<h3>\u0422\u0435\u0441\u0442\u044b \u0438 \u0434\u0435\u043f\u043b\u043e\u0439<\/h3>\n<p>\u0421\u0435\u0439\u0447\u0430\u0441 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435:<\/p>\n<ul>\n<li>\n<p>22 unit-\u0442\u0435\u0441\u0442\u0430 shared-\u043b\u043e\u0433\u0438\u043a\u0438;<\/p>\n<\/li>\n<li>\n<p>63 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u0430 API \u043d\u0430 PGlite;<\/p>\n<\/li>\n<li>\n<p>62 E2E-\u0442\u0435\u0441\u0442\u0430 Playwright (\u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0439 \u0438 \u0434\u0435\u0441\u043a\u0442\u043e\u043f\u043d\u044b\u0439 viewport);<\/p>\n<\/li>\n<li>\n<p>production offline-\u0442\u0435\u0441\u0442.<\/p>\n<\/li>\n<\/ul>\n<p>API \u0438 \u0444\u0440\u043e\u043d\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u0432 Docker-\u043e\u0431\u0440\u0430\u0437\u044b, \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435. \u041d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u2014 nginx \u0441 TLS \u043e\u0442 Let\u2019s Encrypt, API \u0438 PostgreSQL \u0441\u043b\u0443\u0448\u0430\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e <a href=\"http:\/\/localhost\" rel=\"noopener nofollow\">localhost<\/a>.<\/p>\n<p>\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e PWA: \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442, service worker, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0438 \u043e\u0444\u043b\u0430\u0439\u043d-\u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443. \u042d\u0442\u043e \u043d\u0435 \u00ab\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u043f\u043b\u0430\u0433\u0438\u043d \u0438 \u0437\u0430\u0431\u044b\u043b\u0438\u00bb \u2014 service worker \u043b\u0435\u0433\u043a\u043e \u043b\u043e\u043c\u0430\u0435\u0442 \u043a\u044d\u0448, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0432\u0435\u0440\u0441\u0438\u044f\u043c\u0438.<\/p>\n<h3>\u0427\u0442\u043e \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0438 \u0447\u0442\u043e \u0434\u0430\u043b\u044c\u0448\u0435<\/h3>\n<p>\u0427\u0435\u0441\u0442\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a:<\/p>\n<ul>\n<li>\n<p><strong>\u041d\u0435\u0442 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/strong> \u042d\u0442\u043e PWA, \u0430 \u043d\u0435 APK\/IPA. \u0414\u043b\u044f App Store \u0438 Google Play \u043d\u0443\u0436\u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u0431\u0451\u0440\u0442\u043a\u0430, \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0438 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u044b.<\/p>\n<\/li>\n<li>\n<p><strong>\u041d\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 email.<\/strong> \u0412\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u043e\u043b\u044f \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438 \u0435\u0441\u0442\u044c, \u043d\u043e \u043f\u0438\u0441\u044c\u043c\u0430 \u043d\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u2014 \u0432 production \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u043f\u043e\u043a\u0430 \u043d\u0435\u0440\u0430\u0431\u043e\u0447\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p><strong>\u041d\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432.<\/strong> \u041c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0438 \u043e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438, \u043d\u043e \u043d\u0435\u043b\u044c\u0437\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0441\u0432\u043e\u044e \u043d\u0435\u0434\u0435\u043b\u044e \u043a\u0430\u043a \u043d\u043e\u0432\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d.<\/p>\n<\/li>\n<li>\n<p><strong>\u041d\u0435\u0442 SSR.<\/strong> \u041f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u2014 React SPA. \u0414\u043b\u044f SEO \u0435\u0441\u0442\u044c sitemap, canonical, JSON-LD \u0438 \u0441\u0442\u0430\u0442\u044c\u0438, \u043d\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u0439 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433 \u0431\u044b\u043b \u0431\u044b \u043d\u0430\u0434\u0451\u0436\u043d\u0435\u0435.<\/p>\n<\/li>\n<li>\n<p><strong>\u041d\u0435\u0442 batch-\u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432.<\/strong> 30 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0434\u043d\u043e\u0433\u043e \u2014 \u0442\u0435\u0440\u043f\u0438\u043c\u043e, \u043d\u043e \u043d\u0435 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e.<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0437 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0445 \u043f\u043b\u0430\u043d\u043e\u0432: batch-\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b, \u0431\u043e\u043b\u0435\u0435 \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u044f\u043c\u0438 \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, TWA-\u043e\u0431\u0451\u0440\u0442\u043a\u0430 \u0434\u043b\u044f Android.  <\/p>\n<h3>\u0421\u0441\u044b\u043b\u043a\u0438<\/h3>\n<ul>\n<li>\n<p>\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435: <a href=\"http:\/\/sdelatb.ru\" rel=\"noopener nofollow\">sdelatb.ru<\/a><\/p>\n<\/li>\n<li>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 PWA: <a href=\"http:\/\/sdelatb.ru\/app\" rel=\"noopener nofollow\">sdelatb.ru\/app<\/a><\/p>\n<\/li>\n<li>\n<p>\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f: <a href=\"http:\/\/sdelatb.ru\/guide\" rel=\"noopener nofollow\">sdelatb.ru\/guide<\/a><\/p>\n<\/li>\n<li>\n<p>\u0421\u0442\u0430\u0442\u044c\u0438 \u043e \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438: <a href=\"http:\/\/sdelatb.ru\/articles\" rel=\"noopener nofollow\">sdelatb.ru\/articles<\/a><\/p>\n<\/li>\n<\/ul>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u043f\u044b\u0442 \u0441 PWA, \u043e\u0444\u043b\u0430\u0439\u043d-\u043e\u0447\u0435\u0440\u0435\u0434\u044f\u043c\u0438 \u0438\u043b\u0438 \u0441\u0435\u043c\u0435\u0439\u043d\u044b\u043c\u0438 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430\u043c\u0438 \u2014 \u0431\u0443\u0434\u0443 \u0440\u0430\u0434 \u043a\u0440\u0438\u0442\u0438\u043a\u0435. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0433\u0434\u0435 \u044f \u043f\u0435\u0440\u0435\u0443\u0441\u043b\u043e\u0436\u043d\u0438\u043b \u0438 \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0449\u0435.<\/p>\n<p>\u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u044f\u043c\u0438 \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, TWA-\u043e\u0431\u0451\u0440\u0442\u043a\u0430 \u0434\u043b\u044f Android.<\/p>\n<\/div>\n<p>\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/1110014\/\">https:\/\/habr.com\/ru\/articles\/1110014\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041e\u0431\u043b\u043e\u0436\u043a\u0430\u0414\u0438\u0441\u043a\u043b\u0435\u0439\u043c\u0435\u0440: \u044d\u0442\u043e \u043c\u043e\u0439 \u043f\u0435\u0442-\u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u0441\u0442\u0430\u0442\u044c\u044f \u043e \u043d\u0451\u043c, \u0431\u0435\u0437 \u0437\u0430\u043a\u0430\u0437\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f. \u041a\u043e\u0434\u0430 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u043c\u0430\u0440\u043a\u0435\u0442\u0438\u043d\u0433\u0430.\u041e\u0431\u044b\u0447\u043d\u044b\u0435 \u0442\u0430\u0441\u043a-\u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u0443\u044e\u0442 \u043f\u043e\u0434 \u043e\u0434\u043d\u043e\u0433\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430: \u043c\u043e\u0439 \u0434\u0435\u043d\u044c, \u043c\u043e\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u044b, \u043c\u043e\u0438 \u043f\u0440\u0438\u0432\u044b\u0447\u043a\u0438. \u0412 \u0441\u0435\u043c\u044c\u0435 \u0432\u0441\u0451 \u043b\u043e\u043c\u0430\u0435\u0442\u0441\u044f. \u0423 \u0432\u0437\u0440\u043e\u0441\u043b\u044b\u0445 \u0440\u0430\u0431\u043e\u0442\u0430 \u0438 \u0431\u044b\u0442, \u0443 \u0434\u0435\u0442\u0435\u0439 \u0448\u043a\u043e\u043b\u0430 \u0438 \u043a\u0440\u0443\u0436\u043a\u0438, \u0430 \u043e\u0431\u0449\u0438\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0447\u0430\u0441\u0442\u043e \u0436\u0438\u0432\u0451\u0442 \u0432 \u0433\u043e\u043b\u043e\u0432\u0435 \u0443 \u043e\u0434\u043d\u043e\u0433\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430.\u00ab\u0427\u0435\u043a\u043b\u0438\u0441\u0442 \u0434\u0435\u043b\u00bb \u2014 \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u044d\u0442\u043e \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435: \u0434\u0435\u043d\u044c, \u043d\u0435\u0434\u0435\u043b\u044f, \u043c\u0435\u0441\u044f\u0446, \u0433\u043e\u0434, \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u0434\u0435\u043b\u0430, \u0434\u0435\u0442\u0441\u043a\u0438\u0439 \u0440\u0435\u0436\u0438\u043c, \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u044f \u0438 \u043e\u0444\u043b\u0430\u0439\u043d-\u0440\u0430\u0431\u043e\u0442\u0430. \u041d\u0438\u0436\u0435 \u2014 \u043a\u0430\u043a \u0443\u0441\u0442\u0440\u043e\u0435\u043d \u043f\u0440\u043e\u0435\u043a\u0442, \u043a\u0430\u043a\u0438\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u0443\u0434\u0430\u0447\u043d\u044b\u043c\u0438 \u0438 \u0433\u0434\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u044b\u0432\u0430\u0442\u044c.\u041a\u0430\u043a\u0438\u0435 \u0431\u044b\u043b\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\u0421 \u0441\u0430\u043c\u043e\u0433\u043e \u043d\u0430\u0447\u0430\u043b\u0430 \u044f \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439:PWA, \u0430 \u043d\u0435 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u041d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u043e\u0442 App Store, Google Play \u0438 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430.\u0420\u0430\u0431\u043e\u0442\u0430 \u043d\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0435 \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c. \u041d\u0430\u0441\u0442\u043e\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u2014 \u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0439 \u0431\u043e\u043d\u0443\u0441, \u043d\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u2014 \u00ab\u0434\u043e\u0441\u0442\u0430\u043b \u0442\u0435\u043b\u0435\u0444\u043e\u043d \u043d\u0430 \u043a\u0443\u0445\u043d\u0435\u00bb.\u041e\u0444\u043b\u0430\u0439\u043d. \u0420\u0435\u0431\u0451\u043d\u043e\u043a \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 \u0432 \u043c\u0430\u0448\u0438\u043d\u0435 \u0438\u043b\u0438 \u0432 \u0448\u043a\u043e\u043b\u0435 \u0431\u0435\u0437 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430.\u0414\u0435\u0442\u0438 \u043a\u0430\u043a \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438. \u041d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u00ab\u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u0441\u043f\u0438\u0441\u043e\u043a\u00bb, \u0430 \u0441\u0432\u043e\u0439 \u0432\u0445\u043e\u0434, \u0441\u0432\u043e\u0438 \u043f\u0440\u0430\u0432\u0430 \u0438 \u0441\u0432\u043e\u0439 \u044d\u043a\u0440\u0430\u043d.\u041c\u0438\u043d\u0438\u043c\u0443\u043c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439. \u041d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b, \u043d\u0435 \u0434\u043e\u0441\u043a\u0438, \u043d\u0435 \u0441\u043f\u0440\u0438\u043d\u0442\u044b. \u0427\u0435\u043a\u043b\u0438\u0441\u0442, \u0437\u0430\u0434\u0430\u0447\u0430, \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u0435, \u0440\u0435\u0431\u0451\u043d\u043e\u043a.\u0418\u0437 \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0440\u043e\u0441 \u0441\u0442\u0435\u043a: React + Vite \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435, Fastify + PostgreSQL \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435, Docker Compose \u0438 nginx \u043d\u0430 \u0434\u0435\u043f\u043b\u043e\u0435.\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430\u041a\u043b\u0438\u0435\u043d\u0442 \u2014 React 19, React Query, Dexie \u0434\u043b\u044f \u043e\u0444\u043b\u0430\u0439\u043d-\u0434\u0430\u043d\u043d\u044b\u0445 \u0438 Workbox \u0434\u043b\u044f service worker. \u0421\u0435\u0440\u0432\u0435\u0440 \u2014 Fastify 5, PostgreSQL, JWT \u043d\u0430 15 \u043c\u0438\u043d\u0443\u0442 \u0438 refresh-cookie \u043d\u0430 30 \u0434\u043d\u0435\u0439. \u0421\u0442\u0430\u0442\u0438\u043a\u0443 \u0438 API \u0440\u0430\u0437\u0434\u0430\u0451\u0442 nginx, \u0432\u0441\u0451 \u0436\u0438\u0432\u0451\u0442 \u0432 Docker Compose.\u041f\u043e\u0447\u0435\u043c\u0443 Fastify, \u0430 \u043d\u0435 Nest \u0438\u043b\u0438 Express:\u0441\u0445\u0435\u043c\u0430 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0447\u0435\u0440\u0435\u0437 Zod \u0443\u0436\u0435 \u0431\u044b\u043b\u0430 \u0432 \u043e\u0431\u0449\u0435\u043c \u043f\u0430\u043a\u0435\u0442\u0435;\u043c\u0435\u043d\u044c\u0448\u0435 \u043c\u0430\u0433\u0438\u0438, \u0447\u0435\u043c \u0432 Nest, \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u0435\u0435, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435;\u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0430 \u043f\u0435\u0442-\u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0432\u0430\u0436\u043d\u0435\u0435 \u00ab\u044d\u043d\u0442\u0435\u0440\u043f\u0440\u0430\u0439\u0437\u043d\u043e\u0441\u0442\u0438\u00bb.\u041c\u043e\u043d\u043e\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043d\u0430 pnpm: apps\/web, apps\/api, packages\/shared. \u0412 shared \u043b\u0435\u0436\u0430\u0442 \u0442\u0438\u043f\u044b, Zod-\u0441\u0445\u0435\u043c\u044b \u0438 \u0447\u0438\u0441\u0442\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u0440\u043e\u0434\u0435 \u0440\u0430\u0441\u0447\u0451\u0442\u0430 \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u0438 \u0440\u0430\u0441\u043a\u0440\u044b\u0442\u0438\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u0439. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0435 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u044b \u043c\u0435\u0436\u0434\u0443 \u0444\u0440\u043e\u043d\u0442\u043e\u043c \u0438 \u0431\u044d\u043a\u043e\u043c.\u041c\u043e\u0434\u0435\u043b\u044c \u0434\u0430\u043d\u043d\u044b\u0445\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b:users \u2014 \u0432\u0437\u0440\u043e\u0441\u043b\u044b\u0435 \u0438 \u0434\u0435\u0442\u0438, \u0440\u043e\u043b\u044c, \u0441\u0442\u0430\u0442\u0443\u0441, \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438;checklists \u2014 \u0434\u0435\u043d\u044c\/\u043d\u0435\u0434\u0435\u043b\u044f\/\u043c\u0435\u0441\u044f\u0446\/\u0433\u043e\u0434, \u0434\u0430\u0442\u0430 \u043d\u0430\u0447\u0430\u043b\u0430, \u0432\u043b\u0430\u0434\u0435\u043b\u0435\u0446, \u0440\u0435\u0436\u0438\u043c \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438;tasks \u2014 \u0437\u0430\u0434\u0430\u0447\u0430, \u0434\u0430\u0442\u0430, \u0432\u0440\u0435\u043c\u044f, \u0441\u0442\u0430\u0442\u0443\u0441, \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442, \u043e\u0446\u0435\u043d\u043a\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438;recurrence_rules \u2014 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u044f;parent_child_links \u2014 \u0441\u0432\u044f\u0437\u044c \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0438 \u0440\u0435\u0431\u0451\u043d\u043a\u0430 \u0441 \u043f\u0440\u0430\u0432\u0430\u043c\u0438;routines \u2014 \u0441\u043e\u0445\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0435 \u043d\u0430\u0431\u043e\u0440\u044b \u0437\u0430\u0434\u0430\u0447;reminders \u0438 devices \u2014 push \u0438 \u0431\u0443\u0434\u0438\u043b\u044c\u043d\u0438\u043a\u0438.\u0427\u0435\u043a\u043b\u0438\u0441\u0442 \u043d\u0435 \u0445\u0440\u0430\u043d\u0438\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u0434\u0430\u0447 \u043a\u0430\u043a JSON. \u0417\u0430\u0434\u0430\u0447\u0438 \u043b\u0435\u0436\u0430\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0443 \u043d\u0438\u0445 \u0435\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u0443\u0441, \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c, \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u044f \u0438 \u0438\u0441\u0442\u043e\u0440\u0438\u044f. JSON-\u043f\u043e\u043b\u0435 \u0431\u044b\u043b\u043e \u0431\u044b \u043f\u0440\u043e\u0449\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0430, \u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0441\u0442\u0430\u043b\u043e \u0431\u044b \u0431\u043e\u043b\u044c\u044e \u043f\u0440\u0438 \u043e\u0442\u0447\u0451\u0442\u0430\u0445 \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u044f\u0445.\u041f\u0435\u0440\u0438\u043e\u0434 \u0437\u0430\u0434\u0430\u0451\u0442\u0441\u044f \u043f\u0430\u0440\u043e\u0439 period_type + period_start. \u0414\u043b\u044f \u0434\u043d\u044f \u044d\u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u0434\u0430\u0442\u0430, \u0434\u043b\u044f \u043d\u0435\u0434\u0435\u043b\u0438 \u2014 \u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a (\u0438\u043b\u0438 \u0434\u0435\u043d\u044c, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u0434\u0435\u043b\u044f \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f), \u0434\u043b\u044f \u043c\u0435\u0441\u044f\u0446\u0430 \u2014 \u043f\u0435\u0440\u0432\u043e\u0435 \u0447\u0438\u0441\u043b\u043e.\u041d\u0435\u0434\u0435\u043b\u044f \u043f\u043e \u0434\u043d\u044f\u043c, \u0430 \u043d\u0435 \u043e\u0434\u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u044b\u043d\u044f\u041f\u0435\u0440\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043d\u0435\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0447\u0435\u043a\u043b\u0438\u0441\u0442\u0430 \u0431\u044b\u043b\u0430 \u043e\u0431\u044b\u0447\u043d\u044b\u043c \u0441\u043f\u0438\u0441\u043a\u043e\u043c. \u041d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u043e\u0441\u044c: 30 \u0437\u0430\u0434\u0430\u0447 \u043f\u043e\u0434\u0440\u044f\u0434 \u2014 \u044d\u0442\u043e \u043d\u0435 \u043f\u043b\u0430\u043d, \u0430 \u0441\u0442\u0435\u043d\u0430 \u0442\u0435\u043a\u0441\u0442\u0430. \u041f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e \u0434\u043d\u044f\u043c.\u0422\u0435\u043f\u0435\u0440\u044c API \u043e\u0442\u0434\u0430\u0451\u0442 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432 \u0445\u0440\u043e\u043d\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435, \u0430 \u0444\u0440\u043e\u043d\u0442 \u0440\u0430\u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u0438\u0445 \u043f\u043e plannedDate. \u0412\u043d\u0443\u0442\u0440\u0438 \u0434\u043d\u044f \u2014 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0430 \u043d\u0435 \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f.\u0412 PostgreSQL \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:sqlSELECT t.*  FROM tasks t WHERE t.checklist_id = $1   AND t.deleted_at IS NULL ORDER BY   CASE WHEN $2 = &#8216;MANUAL&#8217; THEN t.sort_order END ASC,   CASE     WHEN $2 = &#8216;TIME&#8217; THEN COALESCE(t.scheduled_start_at, t.due_at)   END ASC NULLS LAST,   CASE WHEN $2 = &#8216;TIME&#8217; THEN t.planned_date END ASC NULLS LAST,   t.sort_order ASC,   t.created_at ASC;\u0417\u0434\u0435\u0441\u044c \u0435\u0441\u0442\u044c \u0432\u0430\u0436\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u0440\u043e\u043c\u0438\u0441\u0441. \u0421\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u2014 \u0440\u0435\u0436\u0438\u043c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u043d\u043e \u0435\u0441\u043b\u0438 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u044f\u0432\u043d\u043e \u043f\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u043b \u0437\u0430\u0434\u0430\u0447\u0443, \u0447\u0435\u043a\u043b\u0438\u0441\u0442 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442 \u0432 MANUAL \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0435\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043e\u043a. \u0418\u043d\u0430\u0447\u0435 drag-and-drop \u0431\u044b\u043b \u0431\u044b \u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u044b\u043c: \u043b\u044e\u0431\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b\u043e \u0431\u044b \u0445\u0440\u043e\u043d\u043e\u043b\u043e\u0433\u0438\u044e.\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 checklists \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u043f\u043e\u043b\u0435:sqlALTER TABLE checklists  ADD COLUMN IF NOT EXISTS sort_mode text NOT NULL DEFAULT &#8216;TIME&#8217;  CHECK (sort_mode IN (&#8216;TIME&#8217;, &#8216;MANUAL&#8217;));\u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0440\u0443\u0447\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u2014 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 endpoint. \u041e\u043d \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0432\u0441\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0447\u0435\u043a\u043b\u0438\u0441\u0442\u0430, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0447\u0442\u043e \u0441\u043f\u0438\u0441\u043e\u043a \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0441\u044f \u0441 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f, \u0438 \u0432 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 sort_order:tsawait app.db.transaction(async (tx) =&gt; {  for (const [index, taskId] of input.taskIds.entries()) {    await tx.query(      &#8216;UPDATE tasks SET sort_order = $2, updated_at = now() WHERE id = $1&#8217;,      [taskId, index],    );  }  await tx.query(    &#171;UPDATE checklists SET sort_mode = &#8216;MANUAL&#8217;, updated_at = now() WHERE id = $1&#187;,    [id],  );});\u041d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435 \u2014 @dnd-kit\/core \u0438 @dnd-kit\/sortable. \u041e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 SortableTaskRow \u0434\u0430\u0451\u0442 \u0440\u0443\u0447\u043a\u0443 \u0438 transform, \u0430 DndContext \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043d\u044f:tsxconst sensors = useSensors(  useSensor(PointerSensor, { activationConstraint: { distance: 6 } }),  useSensor(TouchSensor, {    activationConstraint: { delay: 180, tolerance: 6 },  }),);&lt;DndContext  sensors={sensors}  collisionDetection={closestCenter}  onDragEnd={(event) =&gt; handleDragEnd(event, dayTasks, dayKey)}&gt;  &lt;SortableContext items={dayTasks.map((task) =&gt; task.id)}&gt;    {dayTasks.map((task) =&gt; renderTaskRow(task, true))}  &lt;\/SortableContext&gt;&lt;\/DndContext&gt;\u041d\u0435\u0434\u0435\u043b\u044f \u043f\u043e \u0434\u043d\u044f\u043c\u041d\u0435\u0434\u0435\u043b\u044f \u0440\u0430\u0437\u0431\u0438\u0442\u0430 \u043d\u0430 \u0434\u043d\u0438; \u0432\u043d\u0443\u0442\u0440\u0438 \u0434\u043d\u044f \u2014 \u0432\u0440\u0435\u043c\u044f, \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u0440\u0443\u0447\u043a\u0430 \u0434\u043b\u044f \u0440\u0443\u0447\u043d\u043e\u0439 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438.\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u2014 \u0447\u0430\u0441\u043e\u0432\u044b\u0435 \u043f\u043e\u044f\u0441\u0430. \u0414\u0430\u0442\u044b \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u043a\u0430\u043a date, \u0432\u0440\u0435\u043c\u044f \u2014 \u043a\u0430\u043a timestamptz. \u0412 UI \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0447\u0430\u0441\u043e\u0432\u043e\u043c \u043f\u043e\u044f\u0441\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0430 \u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0418\u043d\u0430\u0447\u0435 \u0437\u0430\u0434\u0430\u0447\u0430 \u00ab\u0432 18:00\u00bb \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u041a\u0430\u043b\u0438\u043d\u0438\u043d\u0433\u0440\u0430\u0434\u0435 \u0438 \u0432 \u041c\u043e\u0441\u043a\u0432\u0435 \u0432\u0435\u043b\u0430 \u0431\u044b \u0441\u0435\u0431\u044f \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443.\u041e\u0444\u043b\u0430\u0439\u043d-\u0440\u0435\u0436\u0438\u043cPWA \u0431\u0435\u0437 \u043e\u0444\u043b\u0430\u0439\u043d\u0430 \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0430\u0439\u0442 \u0441 \u0438\u043a\u043e\u043d\u043a\u043e\u0439. \u041c\u043d\u0435 \u043d\u0443\u0436\u0435\u043d \u0431\u044b\u043b \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439: \u043e\u0442\u043a\u0440\u044b\u043b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0435\u0437 \u0441\u0435\u0442\u0438, \u043e\u0442\u043c\u0435\u0442\u0438\u043b \u0437\u0430\u0434\u0430\u0447\u0443, \u0437\u0430\u043a\u0440\u044b\u043b, \u0430 \u043f\u0440\u0438 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0438 \u0441\u0432\u044f\u0437\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0443\u043b\u0435\u0442\u0435\u043b\u043e \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440.\u0421\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b service worker API-\u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438\u0434\u0443\u0442 \u043f\u043e \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 network-first \u0441 \u043a\u044d\u0448\u0435\u043c:tsregisterRoute(  ({ url, request }) =&gt;    request.method === &#8216;GET&#8217; &amp;&amp; url.pathname.startsWith(&#8216;\/api\/v1\/&#8217;),  async ({ request }) =&gt; {    const cache = await caches.open(apiCacheName(request));    try {      const response = await fetch(request);      if (response.ok) {        await cache.put(request, response.clone());      }      return response;    } catch (error) {      const cached = await cache.match(request);      if (cached) return cached;      throw error;    }  },);\u041a\u044d\u0448 \u0438\u043c\u0435\u043d\u0443\u0435\u0442\u0441\u044f \u043f\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e (api-${userId}), \u0447\u0442\u043e\u0431\u044b \u043d\u0430 \u043e\u0431\u0449\u0435\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u043f\u043e\u0441\u043b\u0435 \u0441\u043c\u0435\u043d\u044b \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430 \u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0447\u0443\u0436\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435.\u041c\u0443\u0442\u0430\u0446\u0438\u0438 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 IndexedDB-\u043e\u0447\u0435\u0440\u0435\u0434\u044c:tsexport async function enqueueTaskAction(userId, taskId, action) {  const row = {    id: crypto.randomUUID(),    userId,    taskId,    action,    createdAt: Date.now(),    attempts: 0,  };  await offlineDb.queue.put(row);  return row;}\u041f\u0440\u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u0441\u0432\u044f\u0437\u0438 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443. \u041a\u0430\u0436\u0434\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 Idempotency-Key, \u0440\u0430\u0432\u043d\u044b\u043c id \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u0438:tsawait api.post(`\/tasks\/${row.taskId}\/${row.action}`, undefined, {  headers: { &#8216;Idempotency-Key&#8217;: row.id },});\u042d\u0442\u043e \u0432\u0430\u0436\u043d\u043e: \u0441\u0435\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u043e\u0440\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0441\u0435\u0440\u0432\u0435\u0440 \u0443\u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435, \u043d\u043e \u0434\u043e \u043e\u0442\u0432\u0435\u0442\u0430. \u0411\u0435\u0437 \u0438\u0434\u0435\u043c\u043f\u043e\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u0430\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0430 \u0431\u044b \u0437\u0430\u0434\u0430\u0447\u0443 \u0434\u0432\u0430\u0436\u0434\u044b \u0438\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u043b\u0430 \u0434\u0443\u0431\u043b\u044c.\u041e\u0447\u0435\u0440\u0435\u0434\u044c \u043d\u0435 \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0431\u044b\u0442\u044c \u00ab\u0443\u043c\u043d\u043e\u0439\u00bb. \u0415\u0441\u043b\u0438 \u043f\u0440\u0438\u0448\u0451\u043b 401\/403, \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0438 \u0436\u0434\u0451\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0433\u043e \u0432\u0445\u043e\u0434\u0430. \u0415\u0441\u043b\u0438 4xx, \u043a\u0440\u043e\u043c\u0435 429, \u2014 \u0437\u0430\u0434\u0430\u0447\u0430, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0443\u0434\u0430\u043b\u0435\u043d\u0430 \u0438\u043b\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e, \u0437\u0430\u043f\u0438\u0441\u044c \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f. \u0421\u0435\u0442\u0435\u0432\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u2014 \u0441\u0442\u043e\u043f \u0438 \u043f\u043e\u0432\u0442\u043e\u0440 \u043f\u043e\u0437\u0436\u0435.\u041c\u043e\u0431\u0438\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f\u041c\u043e\u0431\u0438\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f: \u0442\u043e\u0442 \u0436\u0435 API, \u043d\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u2014 \u0442\u0435\u043b\u0435\u0444\u043e\u043d \u0438 \u043e\u0444\u043b\u0430\u0439\u043d.\u041f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u044f\u041f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u044f \u2014 \u044d\u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u043f\u0440\u0430\u0432\u0438\u043b, \u0430 \u043d\u0435 \u0444\u043b\u0430\u0433 \u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0435:sqlCREATE TABLE recurrence_rules (  id uuid PRIMARY KEY DEFAULT gen_random_uuid(),  task_template_id uuid NOT NULL REFERENCES tasks(id) ON DELETE CASCADE,  freq text NOT NULL,  interval integer NOT NULL DEFAULT 1,  by_weekday integer[],  until date,  count integer,  reminder_config jsonb NOT NULL DEFAULT &#8216;[]&#8217;::jsonb,  active boolean NOT NULL DEFAULT true);\u0420\u0430\u0441\u043a\u0440\u044b\u0442\u0438\u0435 \u0434\u0430\u0442 \u2014 \u0447\u0438\u0441\u0442\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f occurrenceDates(rule, originDate, start, horizonEnd). \u041e\u043d\u0430 \u043d\u0435 \u0445\u043e\u0434\u0438\u0442 \u0432 \u0431\u0430\u0437\u0443, \u043d\u0435 \u0437\u043d\u0430\u0435\u0442 \u043f\u0440\u043e HTTP \u0438 \u043b\u0435\u0433\u043a\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f. \u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0437\u0430\u0434\u0430\u0447 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0435\u0451 \u043d\u0430 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0435 45 \u0434\u043d\u0435\u0439 \u0438 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0434\u0430\u0442\u044b.tsconst dates = occurrenceDates(  { freq, interval, byWeekday },  originDate,  start,  horizonEnd,);for (const date of dates) {  if (existingDates.has(date)) continue;  await createTaskFromTemplate(tx, template, date);}\u041f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435 RRULE \u0446\u0435\u043b\u0438\u043a\u043e\u043c? \u0414\u043b\u044f MVP \u0445\u0432\u0430\u0442\u0438\u043b\u043e daily\/weekly\/monthly\/yearly \u0438 BYDAY. \u041f\u043e\u043b\u043d\u044b\u0439 RFC 5545 \u0441 BYSETPOS, \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0438 \u00ab\u043a\u0430\u0436\u0434\u044b\u043c \u0432\u0442\u043e\u0440\u044b\u043c \u0432\u0442\u043e\u0440\u043d\u0438\u043a\u043e\u043c\u00bb \u2014 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0442\u0435\u043c\u0430. \u041a\u043e\u0433\u0434\u0430 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f, occurrenceDates \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443, \u043d\u0435 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u0434.\u0414\u0435\u0442\u0441\u043a\u0438\u0439 \u0440\u0435\u0436\u0438\u043c\u0421\u0430\u043c\u0430\u044f \u043e\u043f\u0430\u0441\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u2014 \u0434\u043e\u0441\u0442\u0443\u043f\u044b. \u0420\u0435\u0431\u0451\u043d\u043e\u043a \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u0438\u0434\u0435\u0442\u044c \u0447\u0443\u0436\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438, \u0430 \u0432\u0437\u0440\u043e\u0441\u043b\u044b\u0439 \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0432 \u0447\u0443\u0436\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435.\u0412\u0441\u0435 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u0438\u0434\u0443\u0442 \u0447\u0435\u0440\u0435\u0437 resolveOwner. \u0415\u0441\u043b\u0438 \u0430\u043a\u0442\u043e\u0440 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u043d\u0435 \u0441\u0435\u0431\u044f, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043e\u043d \u0432\u0437\u0440\u043e\u0441\u043b\u044b\u0439, \u0443 \u043d\u0435\u0433\u043e \u0432\u043a\u043b\u044e\u0447\u0451\u043d \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0440\u0435\u0436\u0438\u043c \u0438 \u0435\u0441\u0442\u044c \u0430\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u0441\u0432\u044f\u0437\u044c \u0441 \u0440\u0435\u0431\u0451\u043d\u043a\u043e\u043c:tsif (ownerId !== actor.id) {  if (actor.accountType !== &#8216;ADULT&#8217; || !actor.isParent) {    throw forbidden();  }  const link = await getActiveParentLink(db, actor.id, ownerId);  if (!link) throw forbidden();}\u041f\u0440\u0430\u0432\u0430 \u0440\u0435\u0431\u0451\u043d\u043a\u0430 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 parent_child_links.permissions: \u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438, \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438, \u0432\u0438\u0434\u0435\u0442\u044c \u0441\u0435\u043c\u0435\u0439\u043d\u044b\u0435 \u0440\u0443\u0442\u0438\u043d\u044b. \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0438 \u0432 UI, \u043d\u043e \u0441\u0435\u0440\u0432\u0435\u0440 \u2014 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0438\u0441\u0442\u0438\u043d\u044b.\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447 \u0441\u043e\u0437\u043d\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043e \u0432\u0437\u0440\u043e\u0441\u043b\u044b\u043c\u0438:tsif (actor.accountType !== &#8216;ADULT&#8217;) {  throw forbidden(&#8216;\u0423\u0434\u0430\u043b\u044f\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438 \u043c\u043e\u0436\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0437\u0440\u043e\u0441\u043b\u044b\u0439&#8217;);}\u0412 \u0434\u0435\u0442\u0441\u043a\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 \u043a\u043d\u043e\u043f\u043a\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u0442. \u042d\u0442\u043e \u043d\u0435 \u043f\u0440\u043e \u043d\u0435\u0434\u043e\u0432\u0435\u0440\u0438\u0435, \u0430 \u043f\u0440\u043e \u0441\u0442\u0440\u0430\u0445\u043e\u0432\u043a\u0443: \u0440\u0435\u0431\u0451\u043d\u043e\u043a \u043c\u043e\u0436\u0435\u0442 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0441\u0442\u0435\u0440\u0435\u0442\u044c \u0432\u0430\u0436\u043d\u043e\u0435 \u0434\u0435\u043b\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043e\u0437\u0434\u0430\u043b \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c.\u0414\u0435\u0442\u0441\u043a\u0438\u0439 \u0440\u0435\u0436\u0438\u043c\u0414\u0435\u0442\u0441\u043a\u0438\u0439 \u044d\u043a\u0440\u0430\u043d: \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0432\u043e\u0438 \u0437\u0430\u0434\u0430\u0447\u0438, \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441 \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f.\u0428\u0430\u0431\u043b\u043e\u043d\u044b \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u044f\u0415\u0449\u0451 \u043e\u0434\u043d\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u2014 \u043f\u0443\u0441\u0442\u043e\u0439 \u044d\u043a\u0440\u0430\u043d. \u0427\u0435\u043b\u043e\u0432\u0435\u043a \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043d\u0435\u0434\u0435\u043b\u044e, \u0432\u0438\u0434\u0438\u0442 \u0447\u0438\u0441\u0442\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0438 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0448\u0430\u0431\u043b\u043e\u043d\u044b: 11 \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u043a\u0430\u0440\u043a\u0430\u0441\u043e\u0432 \u043d\u0430 \u0431\u0443\u0434\u043d\u0438 \u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435.\u0412\u043d\u0443\u0442\u0440\u0438 \u2014 \u0434\u0430\u043d\u043d\u044b\u0435, \u0430 \u043d\u0435 \u043c\u0430\u0433\u0438\u044f:ts{  id: &#8216;builtin-work-week&#8217;,  title: &#8216;\u0420\u0430\u0431\u043e\u0447\u0430\u044f \u043d\u0435\u0434\u0435\u043b\u044f \u0431\u0435\u0437 \u043f\u0435\u0440\u0435\u0440\u0430\u0431\u043e\u0442\u043e\u043a&#8217;,  items: [    {      dayOfWeek: 1,      title: &#8216;\u041f\u043e\u0434\u044a\u0451\u043c \u0438 \u0441\u0442\u0430\u043a\u0430\u043d \u0432\u043e\u0434\u044b&#8217;,      time: &#8217;07:30&#8242;,      category: &#8216;HEALTH&#8217;,      estimatedMinutes: 10,      priority: &#8216;NORMAL&#8217;,    },    \/\/ &#8230;  ],}\u0428\u0430\u0431\u043b\u043e\u043d \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-503991","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/503991","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=503991"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/503991\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=503991"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=503991"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=503991"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}