Alexander Chekmenev
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Meetly -- a Telegram mini app Slogan - Appointments made easy Description - Meet anyone you want with Meetly - the app that makes booking appointments easy. f Logo link: https://looka.com/editor/156460361 Domain names: - getmeet.ly - 75 USD - meetly.link - 41.3 USD - meetly.cc - 6 USD --- Фича №1: Создать ссылку для бронирования Сценарий 1 - Открывается страница https://meetly.cc/new (как webApp) - Пользователь вводит: - date range - X days into the future - dateFrom & dateTo - Indefinitely into the future - duration - hours and minutes - schedule - working hours per day - user's timezone - Нажимает Создать - создается Link { id: link-id, userId: ..., dateRange: ..., duration: ..., schedule: ..., timezone: ... } --- - 2 вида ссылок - https://t.me/meetly_bot/app?startapp=l_%link-id% - https://go.meetly.cc/link-id (редирект на direct link) --- Фича №2: Открыть ссылку и забронировать слот - Пользователь выбирает слот - Указывает свой email - Отправляет запрос - создается Appointment { id, linkId: ..., userId: ..., email: ..., timezone: ... } - Хост получает нотификацию о новом запросе --- Фича №3: Подтверждение запроса - Хост открывает уведомление в чате с ботом - --- ## TODO - [x] - встроить telegram.js на страницу - [x] - детекция tgUserId на странице (пробросить из telegram.js) - [x] - поддержать роутинг по deeplink - с linkId -> на страницу createNewAppointment - иначе -> на страницу createNewLink - [x] - отправка уведомления хосту при создании Appointment - добавления поля isApproved в Appointment - обновляем уведомление при апруве - isApproved=true - шлем уведомление requestingUserId - [x] - предсоздание User в базе - add firstName, username - [x] - страница создания ссылки - [..] - стилизация обеих страниц (DaisyUI) ~~- вынести timezone selector в правый верхний угол~~ - [x] - интеграция кнопок MainButton / BackButton - [..] - **страница создания встречи** - [x] - XX добавить в шапку "Book an appointment with Ivan Ivanov" (**useEnsureLink**) - [x] - открываем введение каждого поля поочередно, чтобы в фокусе всегде был только один инпут (timezone, date, timeSlot, email) - [x] - XX success screen после создания appointment - https://www.npmjs.com/package/react-confetti - [x] - XX link not found case - [..] - **страница создания ссылки** - [x] - XX шапка по стадиям с описаниями - [x] - XXX поддержать нерабочие дни - [x] - открываем введение каждого поля поочередно, чтобы в фокусе всегде был только один инпут (timezone, duration, schedule) - [x] - XX success screen после создания link - https://www.npmjs.com/package/react-confetti - [x] - XXX фикс цветов calendar - [x] - XXX фикс цветов timezone selector - [x] - XX фикс цветов main button (color, textColor) - [x] - XXXX ??? welcome screen - [x] показываем ссылку если есть (url, duration, schedule) или кнопку "Создать" ~~- [ ] react-icons~~ - [x] - XX присылать созданную ссылку ботом в чат - [x] - XX добавить информацию о человеке и встрече в уведомления - [x] - XXXXXX написать Readme - [x] - XXX тестирование на разных клиентах - [x] - XXXXX прогнать через light house, FCP/LCP, web-vitals метрики - [x] - X remove Eruda - [x] - XX remove TODOs & console.log() ## Доп фичи - обернуть Client Components в Suspense - requests auto-rejection by ttl - предложить другое время - поддержать dateRange для модели Link ~~- link id picker~~ - https://go.meetly.cc/link-id redirects to https://t.me/meetly_bot/app?startapp=l_%link-id% - disable completely booked days в Calendar - авторизация [через Google] + NextAuth.js https://blog.logrocket.com/using-next-js-route-handlers/#creating-secured-routes - Connect Google Account - Auto-add to Google Calendar - Авторизация на meetly.cc через Telegram - https://tanstack.com/query/latest/docs/react/guides/window-focus-refetching - i18n - Captcha ~~- requester не может создать несколько запросов на одно и то же время на разных ссылках~~ - add Sentry ~~- add HttpError~~ - WebApp.CloudStorage для Schedule - написать интеграционные тесты - создание ссылки - запрос на встречу ## Useful links - https://tkdodo.eu/blog/react-query-and-forms - CORS https://blog.logrocket.com/using-cors-next-js-handle-cross-origin-requests/#enabling-cors-all-api-routes - How to Deploy Grammy to Vercel https://github.com/grammyjs/examples/tree/main/setups/next-node - useQuery invalidation https://tanstack.com/query/latest/docs/react/guides/query-invalidation --- # Meetly Данный репозиторий представляет из себя реализацию Telegram Mini Apps сервиса — Meetly, который является аналогом популярного сервиса [Calendly](https://calendly.com). Meetly — это [Telegram бот](https://t.me/meetly_bot) + [Mini App](https://t.me/meetly_bot/app), который позволяет создать персональную ссылку и использовать ее для приема запросов на встречи. ## Описание бизнес-логики Каждый пользователь может иметь единственную ссылку. При повторном создании ссылки она будет обновлена с предоставленным расписанием и интервалом. **Ссылка для отправки запросов** Созданная ссылка содержит в себе: - рабочие часы на каждый день недели - длительность отрезка времени бронирования - таймзону в которой находится пользователь создавший ссылку **Запрос на бронь времени** - каждый запрос содержит email пользователя, отправившего запрос - может быть подтвержден или отклонен пользователем создавшим ссылку (в результате ботом будут отпрвлены соответствующие уведомления) ### Features - создание ссылки - любой пользователь Telegram может создать персональную ссылку - за ссылкой закрепляется расписание пользователя и длительность отрезка времени бронь - отправка запроса на бронь - любой пользователь Telegram, которой перешел по уже созданной ссылке, попадает в интерфейс выбора даты и времени - доступные отрезки для бронирования отображаются в часовом поясе пользователя, отправляющего запрос - уведомления в боте - уведомление о полученном запросе на бронь - уведомление о подтвержденном / отклоненном запросе - уведомление о создании / обновлении ссылки для броней - запрос персональной ссылки через команду /link - в ответ бот пришлет уже созданную ссылку ### Use-cases **Отправка запроса на бронь** Для того, чтобы отправить запрос на бронь времени человека X, нужно запросить у него его персональную ссылку и перейти по ней внутри Telegram. Далее в открывшемся UI выбрать подходящие дату и время и указать email. **Создание персональной ссылки для получения запросов** Для того, чтобы предоставить доступ к свободным отрезками времени в своем расписании, необходимо зайти на [страницу создания ссылки](https://t.me/meetly_bot/app?startapp=new), ввести в расписание рабочание дни и часы, а также длительность отрезка, на который будет бронироваться время. ## Техническая реализация Проект реализован на базе [Next.js](https://nextjs.org/) framework (v14). С его помощью как отдаются клиентские страницы, так и обрабатываются запросы в API. Список специфичных инструментов и технологий использованных на сервере: - PostgreSQL + [Prisma](https://www.prisma.io/) - для работы с данными - [grammY](https://grammy.dev/) - для взаимодействия с Telegram Bots API Для реализации современного, адаптивного клиентского интерфейса использовались: - [react-query](https://tanstack.com/query/v3/) - [react-hook-form](https://react-hook-form.com/) - [react-day-picker](https://react-day-picker.js.org/) - [react-timezone-select](https://github.com/ndom91/react-timezone-select) - a также [Tailwind CSS](https://tailwindcss.com/) вместе с [daisyUI](https://daisyui.com/) В качестве инфраструктуры для deployment решения был выбран популярный cloud-oriented сервис [Vercel](https://vercel.com/). ### Структура кода - `/app/layout.tsx` - точка входа в клиентское приложение - `/app/page.tsx` - основная SSR страница - `/app/api/**/route.ts` - файлы с реализациями обработчикой CRUD запросов к основным сущностям - `/app/api/webhook/route.ts` - webhook для получения обновлений от Telegram Bots API - `/components/*` - реализация обших клиентских компонентов - `/components/CreateNewAppointment/*` - компоненты реализующие логику отправки запроса на бронь - `/components/CreateNewLink/*` - компоненты реализующие логику создания и обновления ссылки - `/components/MainPage/index.tsx` - реализация компонента MainPageComponent, который является точкой входа в клиентском UI - `/components/WelcomePage/*` - реализация страницы, которая открывается при нажатии кнопки [Menu](https://t.me/meetly_bot/app) - `/lib/models/*` - типы описывающие все сущности - `/lib/services/*` - бизнес-логика - `/lib/bot.ts` - реализация Telegram бота [@meetly_bot](https://t.me/meetly_bot) - `/prisma/schema.prisma` - описание DB сущностей и их отношений ## Ссылки - https://t.me/meetly_bot - Telegram бот - https://t.me/meetly_bot/app - Telegram Mini App

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully