{"id":463140,"date":"2025-06-13T09:34:08","date_gmt":"2025-06-13T09:34:08","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=463140"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=463140","title":{"rendered":"<span>\u041f\u043e\u0433\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0432 grammY: \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 Telegram-\u0431\u043e\u0442\u0430 \u0441 TypeScript \u0438 Docker<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ov\/mk\/eq\/ovmkeq6hrlkpytoycexgcjbphqq.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/ov\/mk\/eq\/ovmkeq6hrlkpytoycexgcjbphqq.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/ov\/mk\/eq\/ovmkeq6hrlkpytoycexgcjbphqq.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/div>\n<p> \u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! <a href=\"https:\/\/habr.com\/ru\/companies\/selectel\/articles\/799761\/\">\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 grammY \u043c\u044b \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u044b \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f Telegram-\u0431\u043e\u0442\u043e\u0432 \u043d\u0430 JavaScript. \u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u043d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0433\u0440\u0443\u0437\u0438\u0442\u044c\u0441\u044f \u0432 \u0442\u0435\u043c\u0443 \u0433\u043b\u0443\u0431\u0436\u0435 \u0438 \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0444\u0438\u0447\u0438.<\/p>\n<p> \u041c\u044b \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b \u043f\u0430\u0440\u0443 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u043f\u043e \u044d\u0442\u043e\u0439 \u0442\u0435\u043c\u0435. \u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c, \u043a\u0430\u043a \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439. \u0410 \u0435\u0449\u0435 \u0437\u0430\u043b\u043e\u0436\u0438\u043c \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442, \u0447\u0442\u043e\u0431\u044b \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u043c\u0435\u043d\u044e \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u043b\u0430\u0442\u0435\u0436\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c. \u041f\u043e \u0438\u0442\u043e\u0433\u0443 \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0431\u043e\u0442 \u0441 \u043f\u0440\u043e\u0441\u0442\u044b\u043c, \u043d\u043e \u0440\u0430\u0431\u043e\u0447\u0438\u043c \u043e\u043d\u043b\u0430\u0439\u043d-\u043c\u0430\u0433\u0430\u0437\u0438\u043d\u043e\u043c, \u043e\u043f\u043b\u0430\u0442\u043e\u0439 \u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435\u043c \u0441 MongoDB. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c!<a name=\"habracut\"><\/a><\/p>\n<p> <font color=\"#EB4247\"><\/p>\n<h2>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0431\u043e\u0442\u0430 \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0442\u043e\u043a\u0435\u043d\u0430<\/h2>\n<p><\/font><br \/> \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u2014 \u043f\u043e \u0441\u0443\u0442\u0438, \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u2014 \u0441\u0432\u043e\u0435\u0433\u043e \u0431\u043e\u0442\u0430 \u0432 Telegram. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0435\u0433\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439.<\/p>\n<p> 1. \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c Telegram \u0438 \u0432 \u043f\u043e\u0438\u0441\u043a\u0435 \u0432\u0431\u0438\u0432\u0430\u0435\u043c <a href=\"https:\/\/habr.com\/ru\/users\/botfather\/\" class=\"user_link\">BotFather<\/a>.<br \/> 2. \u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u043c\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \/newbot, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0438\u043c\u044f \u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 username \u2014 \u043f\u0440\u0438\u0447\u0435\u043c \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0441\u043b\u043e\u0432\u043e bot.<br \/> 3. \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0431\u043e\u0442\u0430 <a href=\"https:\/\/habr.com\/ru\/users\/botfather\/\" class=\"user_link\">BotFather<\/a> \u043f\u0440\u0438\u0448\u043b\u0435\u0442 \u0434\u043b\u0438\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u043a\u0435\u043d \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 <b>1234567890:UIEaeSx_YsRXdD-C39M0t1PzcdnZZ4HgsKq<\/b> \u2014 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0439\u0442\u0435 \u0438 \u043d\u0435 \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0439\u0442\u0435 \u043d\u0438\u0433\u0434\u0435 \u0441\u0432\u043e\u0439 \u0442\u043e\u043a\u0435\u043d, \u0442\u0430\u043a \u043a\u0430\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0433\u043e \u043a\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e \u0441\u043c\u043e\u0436\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432\u0430\u0448\u0438\u043c \u0431\u043e\u0442\u043e\u043c.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/f1d\/3d0\/f70\/f1d3d0f70524147bff0ab519c65e541c.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/\/post_images\/f1d\/3d0\/f70\/f1d3d0f70524147bff0ab519c65e541c.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/f1d\/3d0\/f70\/f1d3d0f70524147bff0ab519c65e541c.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/div>\n<p> <i>\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0431\u043e\u0442\u0430 \u0432 Telegram.<\/i><\/p>\n<p> \u0412\u0441\u0435 \u0433\u043e\u0442\u043e\u0432\u043e \u2014 \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043a \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044e \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p> <a href=\"https:\/\/selectel.ru\/services\/cloud\/servers\/?utm_source=habr.com&amp;utm_medium=referral&amp;utm_campaign=cloud_article_grammy_210525_banner_001_ord\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/di\/ei\/ks\/dieiksvcuar3umm3kjj24s37br8.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/di\/ei\/ks\/dieiksvcuar3umm3kjj24s37br8.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/di\/ei\/ks\/dieiksvcuar3umm3kjj24s37br8.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/div>\n<p><\/a><\/p>\n<p> <font color=\"#EB4247\"><\/p>\n<h2>\u0420\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h2>\n<p><\/font><br \/> \u041f\u0438\u0441\u0430\u0442\u044c \u0431\u043e\u0442\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043d\u0435 \u0441 \u043d\u0443\u043b\u044f. \u041f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u2014 \u0432\u0441\u0435 \u043d\u0443\u0436\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f <a href=\"https:\/\/github.com\/arseniypom\/grammy-tg-bot.git\">\u0432 \u043c\u043e\u0435\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code class=\"bash\">git clone https:\/\/github.com\/arseniypom\/grammy-tg-bot.git <\/code><\/pre>\n<p> \u0412 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0435\u0441\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0444\u0430\u0439\u043b\u044b:<br \/> \u2013 .gitignore \u2014 \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0437\u0430\u043b\u0438\u0442\u044c \u043d\u0430 GitHub \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u0441\u0435\u043a\u0440\u0435\u0442\u043d\u044b\u0435 env \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043b\u044e\u0447 \u043e\u0442 \u0431\u043e\u0442\u0430);<br \/> \u2013 index.js \u2014 \u0444\u0430\u0439\u043b \u0441 \u043a\u043e\u0434\u043e\u043c Telegram-\u0431\u043e\u0442\u0430;<br \/> \u2013 package.json \u0438 package-lock.json \u2014 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438.<\/p>\n<p> \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0444\u0430\u0439\u043b index.js:<\/p>\n<pre><code class=\"javascript\">import 'dotenv\/config'; import { Bot, GrammyError, HttpError } from 'grammy';  const bot = new Bot(process.env.BOT_TOKEN);  \/\/ \u041e\u0442\u0432\u0435\u0442 \u043d\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \/start bot.command('start', (ctx) =&gt;  ctx.reply('\u041f\u0440\u0438\u0432\u0435\u0442! \u041e\u0442\u043f\u0440\u0430\u0432\u044c \u043c\u043d\u0435 \u043b\u044e\u0431\u043e\u0439 \u0442\u0435\u043a\u0441\u0442, \u0438 \u044f \u0435\u0433\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u044e.'), );  \/\/ \u041e\u0442\u0432\u0435\u0442 \u043d\u0430 \u043b\u044e\u0431\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 bot.on('message', (ctx) =&gt; {  ctx.reply(ctx.message.text); });  \/\/ \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 bot.catch((err) =&gt; {  const ctx = err.ctx;  console.error(`Error while handling update ${ctx.update.update_id}:`);  const e = err.error;  if (e instanceof GrammyError) {    console.error('Error in request:', e.description);  } else if (e instanceof HttpError) {    console.error('Could not contact Telegram:', e);  } else {    console.error('Unknown error:', e);  } });  \/\/ \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0431\u043e\u0442\u0430 async function startBot() {  try {    bot.start();    console.log('Bot started');  } catch (error) {    console.error('Error in startBot:', error);  } } startBot(); <\/code><\/pre>\n<p> \u0427\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0431\u043e\u0442\u0430, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0432\u0441\u0435\u0433\u043e \u0442\u0440\u0438 \u0448\u0430\u0433\u0430.<\/p>\n<p> 1. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438:<\/p>\n<pre><code class=\"bash\">npm i <\/code><\/pre>\n<p> 2. \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0444\u0430\u0439\u043b .env \u0441 \u043a\u043b\u044e\u0447\u043e\u043c \u0432\u0430\u0448\u0435\u0433\u043e \u0431\u043e\u0442\u0430:<\/p>\n<pre><code class=\"bash\">BOT_TOKEN=1234567890:UIEaeSx_YsRXdD-C39M0t1PzcdnZZ4HgsKq <\/code><\/pre>\n<p> 3. \u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438:<\/p>\n<pre><code class=\"bash\">npm run start <\/code><\/pre>\n<p> \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0438 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u0442\u0430 \u0432 Telegram:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/247\/71f\/2f7\/24771f2f7feb06799853a5068d3e229b.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/\/post_images\/247\/71f\/2f7\/24771f2f7feb06799853a5068d3e229b.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/247\/71f\/2f7\/24771f2f7feb06799853a5068d3e229b.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/div>\n<p> <font color=\"#EB4247\"><\/p>\n<h2>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 TypeScript<\/h2>\n<p><\/font><br \/> \u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c TypeScript \u0432 \u043f\u0440\u043e\u0435\u043a\u0442, \u0437\u0430\u043d\u0435\u0441\u0435\u043c \u0444\u0430\u0439\u043b index.js \u0432 \u043f\u0430\u043f\u043a\u0443 src. \u0414\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b .ts \u043b\u0435\u0436\u0430\u043b\u0438 \u0432 \u043e\u0434\u043d\u043e\u0439 \u043f\u0430\u043f\u043a\u0435 \u2014 \u0442\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0449\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442. \u0421\u0434\u0435\u043b\u0430\u043b\u0438? \u0422\u043e\u0433\u0434\u0430 \u0438\u0434\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<p> 1. \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code class=\"bash\">npm i -D typescript tsx @types\/node <\/code><\/pre>\n<p> \u0417\u0434\u0435\u0441\u044c typescript \u2014 \u0441\u0430\u043c TypeScript, tsx \u2014 \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c TypeScript-\u043a\u043e\u0434\u0430 \u0432 \u0441\u0440\u0435\u0434\u0435 Node.js, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0435\u0433\u043e \u0431\u0435\u0437 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0432 JavaScript. \u0410 @types\/node \u2014 \u043f\u0430\u043a\u0435\u0442 \u0441 TypeScript-\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u0442\u0438\u043f\u043e\u0432 \u0434\u043b\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0438 API Node.js.<\/p>\n<p> 2. \u0427\u0442\u043e\u0431\u044b TypeScript \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u043b, \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433-\u0444\u0430\u0439\u043b tsconfig.json:<\/p>\n<pre><code class=\"json\">{  \"compilerOptions\": {    \"target\": \"ES2020\",    \"module\": \"NodeNext\",    \"moduleResolution\": \"NodeNext\",    \"outDir\": \".\/dist\",    \"rootDir\": \".\/src\",    \"strict\": true,    \"esModuleInterop\": true,    \"skipLibCheck\": true,    \"forceConsistentCasingInFileNames\": true  },  \"include\": [    \"src\/**\/*\"  ],  \"exclude\": [    \"node_modules\",    \"dist\"  ] } <\/code><\/pre>\n<p> \u0412 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0446\u0435\u043b\u0435\u0432\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 JS (ES2020), \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0441\u0442\u0440\u043e\u0433\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0442\u0438\u043f\u043e\u0432, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0430\u043f\u043a\u0443 \u0434\u043b\u044f \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 (dist), \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0433\u0434\u0435 \u043b\u0435\u0436\u0430\u0442 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 (src), \u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0443 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b \u0438\u0437 \u043f\u0430\u043f\u043a\u0438 src \u0438 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c node_modules.<\/p>\n<p> 3. \u0421\u0440\u0430\u0437\u0443 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0430\u043f\u043a\u0443 dist \u0432 .gitignore:<\/p>\n<pre><code class=\"json\">.env node_modules .DS_Store dist <\/code><\/pre>\n<p> 4. \u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c package.json \u2014 \u0432 \u043d\u0435\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c main \u043d\u0430 dist\/index.js, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d-\u0441\u0431\u043e\u0440\u043a\u043e\u0439 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0444\u0430\u0439\u043b JavaScript. \u0422\u0430\u043a\u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442\u044b:<\/p>\n<pre><code class=\"json\"> \"main\": \"dist\/index.js\",  \"scripts\": {    \"dev\": \"nodemon --exec tsx src\/index.ts\",    \"build\": \"tsc\",    \"start:prod\": \"node dist\/index.js\"  }, <\/code><\/pre>\n<p> 5. \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u0442\u044c index.js \u0432 index.ts \u0432 \u043f\u0430\u043f\u043a\u0435 src. \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0435\u0442\u0435, \u0441\u0440\u0430\u0437\u0443 \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0434\u0432\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u0444\u0430\u0439\u043b\u0435:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/d8c\/9d4\/f1f\/d8c9d4f1f267a15e8174604203ed1309.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/\/post_images\/d8c\/9d4\/f1f\/d8c9d4f1f267a15e8174604203ed1309.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/d8c\/9d4\/f1f\/d8c9d4f1f267a15e8174604203ed1309.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/div>\n<p> TypeScript \u0440\u0443\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c env-\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0432 new Bot, \u0445\u043e\u0442\u044f \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043d\u0435 \u0437\u043d\u0430\u0435\u043c, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u043d\u0430 \u0438\u043b\u0438 \u043d\u0435\u0442. \u041f\u043e\u0444\u0438\u043a\u0441\u0438\u043c, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0441 if:<\/p>\n<pre><code class=\"javascript\">const BOT_API_KEY = process.env.BOT_API_KEY;  if (!BOT_API_KEY) {     throw new Error('BOT_API_KEY is not defined'); }  const bot = new Bot(BOT_API_KEY); <\/code><\/pre>\n<p> \u0412\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c: \u0442\u0430\u043a \u043a\u0430\u043a \u0432 bot.on \u043c\u044b \u0432\u044b\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0441\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 message \u0432 \u0446\u0435\u043b\u043e\u043c, \u0442\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u043c, \u0435\u0441\u0442\u044c \u043b\u0438 \u0432 \u043d\u0435\u043c \u0442\u0435\u043a\u0441\u0442 \u0438\u043b\u0438 \u043d\u0435\u0442. \u0418 \u044d\u0442\u043e \u043b\u043e\u0433\u0438\u0447\u043d\u043e, \u0432\u0435\u0434\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0437 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438. \u041f\u043e\u0444\u0438\u043a\u0441\u0438\u043c \u044d\u0442\u043e, \u0443\u0442\u043e\u0447\u043d\u0438\u0432, \u0447\u0442\u043e \u0445\u043e\u0442\u0438\u043c \u0440\u0435\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0442\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441 \u0442\u0435\u043a\u0441\u0442\u043e\u043c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043a message \u0434\u043e\u0431\u0430\u0432\u0438\u043c :text.<\/p>\n<pre><code class=\"javascript\">bot.on('message:text', (ctx) =&gt; {  ctx.reply(ctx.message.text); }); <\/code><\/pre>\n<p> \u041e\u0442\u043b\u0438\u0447\u043d\u043e \u2014 TypeScript \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d. \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044e \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u043e\u0442\u0430.<\/p>\n<p> <font color=\"#EB4247\"><\/p>\n<h2>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 MongoDB \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Docker <\/h2>\n<p><\/font><br \/> \u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0438 \u0440\u0430\u0437\u0443 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0441 Docker, \u043d\u0435 \u043f\u0435\u0440\u0435\u0436\u0438\u0432\u0430\u0439\u0442\u0435 \u2014 \u044f \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u043f\u0438\u0448\u0443 \u0432\u0441\u0435 \u0448\u0430\u0433\u0438.<\/p>\n<p> <b>\u0428\u0430\u0433 1. \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c Docker. <\/b>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u043d\u0430 \u0432\u0430\u0448\u0435\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d Docker \u0438 Docker Compose. \u0415\u0441\u043b\u0438 \u0435\u0449\u0435 \u043d\u0435\u0442, \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435\u0441\u044c <a href=\"https:\/\/docs.docker.com\/desktop\/setup\/install\/mac-install\/\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439<\/a>. \u0414\u043b\u044f Windows \u0438 Mac \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 Docker Desktop, \u0434\u043b\u044f Linux \u2014 \u0441\u0432\u043e\u044f \u0441\u0431\u043e\u0440\u043a\u0430 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u0430. \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043a\u043e\u043c\u0430\u043d\u0434:<\/p>\n<pre><code class=\"json\">docker -v docker-compose -v <\/code><\/pre>\n<p> <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/918\/9a9\/7b2\/9189a97b2062921c9992b6be1bb18d40.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/\/post_images\/918\/9a9\/7b2\/9189a97b2062921c9992b6be1bb18d40.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/918\/9a9\/7b2\/9189a97b2062921c9992b6be1bb18d40.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/div>\n<p> <b>\u0428\u0430\u0433 2. \u0421\u043e\u0437\u0434\u0430\u0435\u043c Dockerfile.<\/b> \u0412 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 (\u0433\u0434\u0435 \u043b\u0435\u0436\u0438\u0442 package.json \u0438 \u043f\u0430\u043f\u043a\u0430 src) \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b Dockerfile \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c:<\/p>\n<pre><code class=\"javascript\"># \u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u043e\u0431\u0440\u0430\u0437 Node.js (\u043b\u0435\u0433\u043a\u043e\u0432\u0435\u0441\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043d\u0430 Alpine Linux) FROM node:18-alpine  # \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435 WORKDIR \/app  # \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c package.json \u0438 package-lock.json COPY package*.json .\/  # \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 RUN npm install  # \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0432\u0435\u0441\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u0432\u043d\u0443\u0442\u0440\u044c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 COPY . .  # \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c TypeScript RUN npm run build  # \u0417\u0430\u0434\u0430\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 # \u0414\u043b\u044f dev-\u0440\u0435\u0436\u0438\u043c\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438 \"npm run dev\", \u043d\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0443\u043a\u0430\u0436\u0435\u043c \u0441\u0442\u0430\u0440\u0442 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d-\u0441\u0431\u043e\u0440\u043a\u0438 CMD [\"npm\", \"run\", \"start:prod\"] <\/code><\/pre>\n<p> \u0412 Dockerfile \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0431\u0430\u0437\u044b \u0443\u043a\u0430\u0437\u0430\u043b\u0438 \u043e\u0431\u0440\u0430\u0437 node:18-alpine, \u0447\u0442\u043e\u0431\u044b \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0431\u044b\u043b \u043b\u0435\u0433\u043a\u0438\u043c (Alpine \u2014 \u0443\u0440\u0435\u0437\u0430\u043d\u043d\u0430\u044f Linux-\u0441\u0438\u0441\u0442\u0435\u043c\u0430), \u0437\u0430\u0434\u0430\u043b\u0438 \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \/app \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430, \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438 \u043f\u0430\u043a\u0435\u0442\u044b. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e \u2014 \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u043b\u0438 \u0432\u0435\u0441\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434, \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043b\u0438 TypeScript \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0431\u043e\u0442\u0430 \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d-\u0440\u0435\u0436\u0438\u043c\u0435.<\/p>\n<p> <b>\u0428\u0430\u0433 3. \u0421\u043e\u0437\u0434\u0430\u0435\u043c docker-compose.yml \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0431\u043e\u0442\u0430 \u0438 MongoDB. <\/b>\u0427\u0442\u043e\u0431\u044b \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0438 \u0431\u043e\u0442\u0430, \u0438 \u0431\u0430\u0437\u0443 MongoDB, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0444\u0430\u0439\u043b docker-compose.yml. \u0412 \u043d\u0435\u043c \u043e\u043f\u0438\u0448\u0435\u043c \u0434\u0432\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0430: bot (\u043d\u0430\u0448 Telegram-\u0431\u043e\u0442) \u0438 mongo (\u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445).<\/p>\n<pre><code class=\"json\">services:  bot:    build: .    container_name: telegram-bot    env_file:      - .env    # \u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \"\u043f\u0440\u043e\u0431\u0440\u043e\u0441\u0438\u0442\u044c\" \u043f\u043e\u0440\u0442 \u0434\u043b\u044f webhook,    # \u0442\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: \"3000:3000\".    # \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f long polling, \u0442\u0430\u043a \u0447\u0442\u043e \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u043e\u0440\u0442\u0443 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f,    # \u043d\u043e \u0432\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u0430\u043c \u043d\u0430 \u0431\u0443\u0434\u0443\u0449\u0435\u0435:    ports:      - '3000:3000'    depends_on:      - mongo    networks:      - app-network  mongo:    image: mongo:6    container_name: mongo-db    environment:      MONGO_INITDB_ROOT_USERNAME: root      MONGO_INITDB_ROOT_PASSWORD: rootpassword    ports:      - '27017:27017'    networks:      - app-network networks:  app-network: <\/code><\/pre>\n<p> <b>\u0420\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u043a\u0430<\/b><\/p>\n<ul>\n<li>build:. \u2014 \u0433\u043e\u0432\u043e\u0440\u0438\u043c Docker Compose, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0434\u043b\u044f \u0431\u043e\u0442\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Dockerfile, \u043b\u0435\u0436\u0430\u0449\u0438\u0439 \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438. <\/li>\n<li>container_name \u2014 \u0437\u0430\u0434\u0430\u0435\u043c \u0443\u0434\u043e\u0431\u043d\u043e\u0435 \u0438\u043c\u044f \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0443, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0442\u043e\u043c \u043d\u0435 \u043f\u0443\u0442\u0430\u0442\u044c\u0441\u044f. <\/li>\n<li>env_file: \u2014 .env \u2014 \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0438\u0437 .env (\u0442\u0430\u043c \u0443 \u043d\u0430\u0441 \u043b\u0435\u0436\u0438\u0442 BOT_TOKEN \u0438 \u043b\u044e\u0431\u044b\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u043a\u043b\u044e\u0447\u0438). <\/li>\n<li>depends_on \u2014 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e bot \u0441\u0442\u0430\u0440\u0442\u0443\u0435\u0442 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 mongo. <\/li>\n<li>mongo \u2014 \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u043d\u0435 \u0431\u0438\u043b\u0434\u0438\u043c \u043d\u0438\u0447\u0435\u0433\u043e, \u0430 \u0431\u0435\u0440\u0435\u043c \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043e\u0431\u0440\u0430\u0437 mongo:6. <\/li>\n<li>environment \u2014 \u0437\u0430\u0434\u0430\u0435\u043c \u0443\u0447\u0435\u0442\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f Mongo. <\/li>\n<li>ports \u2014 \u043f\u0440\u043e\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u043f\u043e\u0440\u0442 27017, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u043a \u0431\u0430\u0437\u0435 \u0438\u0437\u0432\u043d\u0435. <\/li>\n<li>networks \u2014 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0435\u0442\u044c app-network, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u044d\u0442\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b \u0431\u0443\u0434\u0443\u0442 \u0434\u0440\u0443\u0436\u0438\u0442\u044c \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439. \u041e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u0435 \u00ab\u043f\u0443\u0441\u0442\u043e\u0439\u00bb (\u0442\u043e \u0435\u0441\u0442\u044c \u0431\u0435\u0437 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432). \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 Docker Compose \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0441\u0435\u0442\u044c \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/li>\n<\/ul>\n<p> <b>\u0428\u0430\u0433 4. \u0421\u043e\u0437\u0434\u0430\u0435\u043c .dockerignore \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c .env. <\/b>\u0427\u0442\u043e\u0431\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u043b\u0438\u0448\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, node_modules \u0438\u043b\u0438 \u043b\u043e\u0433\u0438), \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 .dockerignore (\u0430\u043d\u0430\u043b\u043e\u0433 .gitignore, \u043d\u043e \u0434\u043b\u044f Docker) \u0441 \u0442\u0430\u043a\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c:<\/p>\n<pre><code class=\"bash\">node_modules&lt;br&gt;dist&lt;br&gt;.git&lt;br&gt;.gitignore&lt;br&gt;docker-compose.yml <\/code><\/pre>\n<p> \u0412 .env \u0440\u044f\u0434\u043e\u043c \u0441 \u0442\u043e\u043a\u0435\u043d\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre><code class=\"bash\">BOT_TOKEN=7931645971:AAHoi2edFIHnym2DogmfLrzoToMAio0TOlc MONGODB_URI=mongodb:\/\/root:rootpassword@mongo:27017\/telegram_bot?authSource=admin <\/code><\/pre>\n<p> <b>\u0428\u0430\u0433 5. \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442. <\/b>\u041f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u0441\u0431\u043e\u0440\u043a\u0443. \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 Docker, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u0432 \u043f\u0430\u043f\u043a\u0435 \u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c:<\/p>\n<pre><code class=\"bash\">docker-compose up -d <\/code><\/pre>\n<p> \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 -d \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442 \u0432\u0441\u0435 \u0432 \u0444\u043e\u043d\u043e\u0432\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435. \u0421\u043f\u0435\u0440\u0432\u0430 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d \u043e\u0431\u0440\u0430\u0437 mongo, \u0430 \u0437\u0430\u0442\u0435\u043c \u043d\u0430\u0448\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0438 \u043f\u043e\u0434\u043d\u044f\u0442\u044c\u0441\u044f.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/60f\/c4e\/e25\/60fc4ee25b4adee6b8dcb310aafd70e5.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/\/post_images\/60f\/c4e\/e25\/60fc4ee25b4adee6b8dcb310aafd70e5.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/60f\/c4e\/e25\/60fc4ee25b4adee6b8dcb310aafd70e5.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/div>\n<p> <i>\u0412\u044b\u0432\u043e\u0434 \u043a\u043e\u043c\u0430\u043d\u0434\u044b docker-compose up-d.<\/i><\/p>\n<p> \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u043f\u043e\u0434\u043d\u044f\u043b\u0438\u0441\u044c \u043b\u0438 \u043d\u0430\u0448\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b:<\/p>\n<pre><code class=\"bash\">docker ps <\/code><\/pre>\n<p> <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/94b\/f6e\/d85\/94bf6ed85a03769c18db2af0edd367d6.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/\/post_images\/94b\/f6e\/d85\/94bf6ed85a03769c18db2af0edd367d6.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/94b\/f6e\/d85\/94bf6ed85a03769c18db2af0edd367d6.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/div>\n<p> \u0412\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0434\u0432\u0430 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430: telegram-bot \u0438 mongo-db. \u0415\u0441\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a, \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043b\u043e\u0433\u0438:<\/p>\n<pre><code class=\"bash\">docker-compose logs -f <\/code><\/pre>\n<p> \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0434\u0430\u043d\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043d\u0435\u0442 \u043b\u0438 \u043e\u0448\u0438\u0431\u043e\u043a \u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0438\u043b\u0438 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u043e\u0442\u0430.<\/p>\n<p> <b>\u0428\u0430\u0433 6. \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a \u0431\u0430\u0437\u0435. <\/b>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 mongoose \u0438 \u0435\u0433\u043e \u0442\u0438\u043f\u044b:<\/p>\n<pre><code class=\"bash\">npm i mongoose &amp;&amp; npm i -D @types\/mongoose <\/code><\/pre>\n<p> \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 mongoose. \u0412 \u0444\u0430\u0439\u043b\u0435 index.ts \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c mongoose:<\/p>\n<pre><code class=\"javascript\">import mongoose from 'mongoose'; <\/code><\/pre>\n<p> \u0414\u0430\u043b\u0435\u0435 \u043e\u0431\u043d\u043e\u0432\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0431\u043e\u0442\u0430:<\/p>\n<pre><code class=\"javascript\">async function startBot() {  const MONGODB_URI = process.env.MONGODB_URI;   if (!MONGODB_URI) {    throw new Error('MONGODB_URI is not defined');  }   try {    await mongoose.connect(MONGODB_URI);    bot.start();    console.log('MongoDB connected &amp; bot started');  } catch (error) {    console.error('Error connecting to MongoDB:', error);  } } <\/code><\/pre>\n<p> \u0427\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u043e \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0431\u043e\u0442\u0430, \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u043d\u0430 npm run dev. \u041d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0430\u043c \u0432\u0430\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0438 \u0431\u0430\u0437\u0430. \u0427\u0442\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c?<\/p>\n<p> \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432 .env:<\/p>\n<pre><code class=\"json\">BOT_TOKEN=7931645971:AAHoi2edFIHnym2DogmfLrzoToMAio0TOlc # MONGODB_URI=mongodb:\/\/root:rootpassword@mongo:27017\/telegram_bot?authSource=admin MONGODB_URI=mongodb:\/\/root:rootpassword@localhost:27017 <\/code><\/pre>\n<p> \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0431\u043e\u0442\u0430 \u0432 Docker:<\/p>\n<pre><code class=\"bash\">docker compose stop bot <\/code><\/pre>\n<p> \u0422\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0431\u043e\u0442\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u0438 \u0443\u0431\u0435\u0434\u0438\u043c\u0441\u044f, \u0447\u0442\u043e \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/ee9\/5f7\/26f\/ee95f726f49454c7f28089eddb83a27d.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/\/post_images\/ee9\/5f7\/26f\/ee95f726f49454c7f28089eddb83a27d.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/ee9\/5f7\/26f\/ee95f726f49454c7f28089eddb83a27d.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/div>\n<p> <i>\u0417\u0430\u043f\u0443\u0441\u043a \u0431\u043e\u0442\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 npm run dev, \u0432\u044b\u0432\u043e\u0434.<\/i><\/p>\n<p> <font color=\"#EB4247\"><\/p>\n<h2>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/h2>\n<p><\/font><br \/> \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0430 \u0442\u043e\u0447\u043d\u0435\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0435\u0433\u043e \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043d\u0430\u0448\u0443 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u043f\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \/start. \u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u044e\u0437\u0435\u0440\u0430, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0443\u0437\u043d\u0430\u0435\u043c, \u043a\u0430\u043a\u0438\u0435 \u0435\u0433\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u0432\u044b\u0432\u0435\u0434\u0435\u043c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"javascript\">bot.command('start', (ctx) =&gt; {     console.log(ctx.from);     ctx.reply('\u041f\u0440\u0438\u0432\u0435\u0442! \u041e\u0442\u043f\u0440\u0430\u0432\u044c \u043c\u043d\u0435 \u043b\u044e\u0431\u043e\u0439 \u0442\u0435\u043a\u0441\u0442, \u0438 \u044f \u0435\u0433\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u044e.'); }); <\/code><\/pre>\n<p> \u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0431\u043e\u0442\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \/start \u0438 \u0432\u0438\u0434\u0438\u043c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0442\u0430\u043a\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442:<\/p>\n<pre><code class=\"json\">{   id: 265123456,   is_bot: false,   first_name: 'Arseniy',   username: 'realusername',   language_code: 'en',   is_premium: true } <\/code><\/pre>\n<p> \u0418\u0437 \u043d\u0435\u0433\u043e \u043d\u0430\u043c \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f id, \u0438\u043c\u044f (first_name) \u0438 username. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0438 \u043c\u043e\u0434\u0435\u043b\u044c Mongo \u0441 \u044d\u0442\u0438\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 \u043f\u0430\u043f\u043a\u0435 src\/models. \u0424\u0430\u0439\u043b \u043d\u0430\u0437\u043e\u0432\u0435\u043c <a href=\"http:\/\/user.ts\">User.ts<\/a>:<\/p>\n<pre><code class=\"javascript\">import { Schema, model, Document } from 'mongoose';  export interface IUser extends Document {  telegramId: number;  firstName: string;  username: string;  createdAt: Date; }  const userSchema = new Schema&lt;IUser&gt;(  {    telegramId: {      type: Number,      required: [true, 'Telegram ID is required'],      unique: true,    },    firstName: { type: String },    username: { type: String },  },  {    timestamps: true,  }, );  export const User = model&lt;IUser&gt;('User', userSchema); <\/code><\/pre>\n<p> \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0431\u043d\u043e\u0432\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \/start \u0432 \u0444\u0430\u0439\u043b\u0435 src\/index.ts, \u0447\u0442\u043e\u0431\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f: \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0443\u0436\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d (\u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u044b \u0432 \u0411\u0414), \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u0435\u043c\u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c. \u0415\u0441\u043b\u0438 \u0435\u0449\u0435 \u043d\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d, \u0442\u043e \u0441\u043f\u0435\u0440\u0432\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0435\u0433\u043e \u0434\u0430\u043d\u043d\u044b\u0435, \u0430 \u0437\u0430\u0442\u0435\u043c \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c.<\/p>\n<p> \u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"javascript\">\/\/ \u041e\u0442\u0432\u0435\u0442 \u043d\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \/start bot.command('start', async (ctx) =&gt; {  if (!ctx.from) {    return ctx.reply('Error: User information not available');  }   const { id, first_name, username } = ctx.from;  try {    \/\/ \u0418\u0449\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0439    \/\/ \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e existingUser    const existingUser = await User.findOne({ telegramId: id });    \/\/ \u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435    \/\/ \u0438 \u0432\u044b\u0445\u043e\u0434\u0438\u043c \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438    if (existingUser) {      return ctx.reply('\u0412\u044b \u0443\u0436\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u044b');    }    \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f    const newUser = new User({      telegramId: id,      firstName: first_name,      username,    });    \/\/ \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445    await newUser.save();    \/\/ \u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438    ctx.reply('\u0412\u044b \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u044b!');  } catch (error) {    console.error('\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:', error);    ctx.reply('\u041f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043f\u043e\u0437\u0436\u0435.');  } }); <\/code><\/pre>\n<p> \u041f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c Telegram-\u0431\u043e\u0442\u0430:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/493\/2df\/999\/4932df9993694a04bffb8e3f2853b095.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/\/post_images\/493\/2df\/999\/4932df9993694a04bffb8e3f2853b095.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/493\/2df\/999\/4932df9993694a04bffb8e3f2853b095.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/div>\n<p> \u0418 \u043f\u0435\u0440\u0432\u044b\u0439, \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u044b \/start \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0432\u0435\u0440\u043d\u043e. \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0441\u044c \u0432 \u0411\u0414: \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 MongoDB Compass, \u043e\u043d\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a \u043b\u044e\u0431\u043e\u0439 \u0431\u0430\u0437\u0435 \u043d\u0430 \u043c\u043e\u043d\u0433\u043e \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0435\u0451 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435.<\/p>\n<p> 1. \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 <a href=\"https:\/\/www.mongodb.com\/try\/download\/compass\">\u0441 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0430\u0439\u0442\u0430<\/a>, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0438 \u0436\u043c\u0435\u043c <b>Add new connection<\/b>:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/50e\/ded\/292\/50eded292b69fcac54132acc42fbbc81.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/\/post_images\/50e\/ded\/292\/50eded292b69fcac54132acc42fbbc81.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/50e\/ded\/292\/50eded292b69fcac54132acc42fbbc81.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/div>\n<p> 2. \u0414\u0430\u043b\u0435\u0435 \u0432\u0432\u043e\u0434\u0438\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 .env:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/95b\/517\/94c\/95b51794c984d93e377c0056b20a548e.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/\/post_images\/95b\/517\/94c\/95b51794c984d93e377c0056b20a548e.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/95b\/517\/94c\/95b51794c984d93e377c0056b20a548e.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/div>\n<p> 3. \u041d\u0430\u0436\u0438\u043c\u0430\u0435\u043c <b>Save &amp; Connect<\/b> \u0438 \u0432 \u043b\u0435\u0432\u043e\u0439 \u043f\u0430\u043d\u0435\u043b\u0438 \u0432\u0438\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/1c4\/f30\/633\/1c4f30633ac78e189d53e8c875ecb627.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/\/post_images\/1c4\/f30\/633\/1c4f30633ac78e189d53e8c875ecb627.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/1c4\/f30\/633\/1c4f30633ac78e189d53e8c875ecb627.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/div>\n<p> 4. \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b <b>test \u2192 users<\/b>:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/c18\/e16\/d2a\/c18e16d2a7afb7c06b2935e53af07147.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/\/post_images\/c18\/e16\/d2a\/c18e16d2a7afb7c06b2935e53af07147.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/c18\/e16\/d2a\/c18e16d2a7afb7c06b2935e53af07147.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/div>\n<p> \u0412\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0441\u044c: \u0441\u043b\u0435\u0432\u0430 \u2014 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f users, \u0441\u043f\u0440\u0430\u0432\u0430 \u2014 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0432 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0439 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c.<\/p>\n<p> \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0448\u0430\u0433 \u2014 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u043c\u0435\u043d\u044e. \u041d\u043e \u043e\u0431 \u044d\u0442\u043e\u043c \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435. \u041f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u0438 \u0441\u043b\u0435\u0434\u0438\u0442\u0435 \u0437\u0430 \u043d\u043e\u0432\u044b\u043c\u0438 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430\u043c\u0438 <a href=\"https:\/\/habr.com\/ru\/companies\/selectel\/articles\/\">\u0432 \u0431\u043b\u043e\u0433\u0435 Selectel<\/a>.<\/p>\n<p> <b>\u0410\u0432\u0442\u043e\u0440:<\/b> \u0410\u0440\u0441\u0435\u043d\u0438\u0439 \u041f\u043e\u043c\u0430\u0437\u043a\u043e\u0432, \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0438 \u0430\u0432\u0442\u043e\u0440 \u043e\u0434\u043d\u043e\u0438\u043c\u0435\u043d\u043d\u043e\u0433\u043e YouTube-\u043a\u0430\u043d\u0430\u043b\u0430<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \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\/910174\/\"> https:\/\/habr.com\/ru\/articles\/910174\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ov\/mk\/eq\/ovmkeq6hrlkpytoycexgcjbphqq.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/ov\/mk\/eq\/ovmkeq6hrlkpytoycexgcjbphqq.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/ov\/mk\/eq\/ovmkeq6hrlkpytoycexgcjbphqq.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/div>\n<p> \u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! <a href=\"https:\/\/habr.com\/ru\/companies\/selectel\/articles\/799761\/\">\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 grammY \u043c\u044b \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u044b \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f Telegram-\u0431\u043e\u0442\u043e\u0432 \u043d\u0430 JavaScript. \u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u043d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0433\u0440\u0443\u0437\u0438\u0442\u044c\u0441\u044f \u0432 \u0442\u0435\u043c\u0443 \u0433\u043b\u0443\u0431\u0436\u0435 \u0438 \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0444\u0438\u0447\u0438.<\/p>\n<p> \u041c\u044b \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b \u043f\u0430\u0440\u0443 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u043f\u043e \u044d\u0442\u043e\u0439 \u0442\u0435\u043c\u0435. \u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c, \u043a\u0430\u043a \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439. \u0410 \u0435\u0449\u0435 \u0437\u0430\u043b\u043e\u0436\u0438\u043c \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442, \u0447\u0442\u043e\u0431\u044b \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u043c\u0435\u043d\u044e \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u043b\u0430\u0442\u0435\u0436\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c. \u041f\u043e \u0438\u0442\u043e\u0433\u0443 \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0431\u043e\u0442 \u0441 \u043f\u0440\u043e\u0441\u0442\u044b\u043c, \u043d\u043e \u0440\u0430\u0431\u043e\u0447\u0438\u043c \u043e\u043d\u043b\u0430\u0439\u043d-\u043c\u0430\u0433\u0430\u0437\u0438\u043d\u043e\u043c, \u043e\u043f\u043b\u0430\u0442\u043e\u0439 \u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435\u043c \u0441 MongoDB. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c!<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-463140","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/463140","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=463140"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/463140\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=463140"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=463140"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=463140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}