Giter Site home page Giter Site logo

tg-bot's Introduction

This project represents a simple Telegram bot API with a backend for authentication.

Dependencies

To run this project locally, you will need the following dependencies:

Setup Project Locally

  1. Clone the repository:

    git clone [email protected]:rexemtoxa/tg-bot.git
    cd tg-bot
  2. Install the dependencies listed above.

  3. Frontend Setup:

    • Navigate to the frontend folder:
      cd frontend
    • Switch to the correct Node.js version:
      nvm use
    • Install Node.js dependencies:
      npm ci
    • Build the frontend:
      npm run build
  4. Backend Setup:

    • Navigate to the backend folder:
      cd backend
    • Switch to the correct Node.js version:
      nvm use
    • Install Node.js dependencies:
      npm ci
    • Copy the example environment variables file and adjust values if necessary:
      cp .env.example .env
  5. Start the database container:

    make start-dev-env
  6. Enjoy! Do not forget to generate the bot token from the BotFather.

For additional commands, please check the scripts section in the package.json files in both the frontend and backend folders.

CI/CD Process

  • Continuous Integration (CI):

    • Runs tests on PRs and pushes.
    • Executes linters to ensure code quality.
  • Continuous Deployment (CD):

    • After each commit to the main branch, deployment to DigitalOcean starts.
    • The bot is deployed as a separate worker to avoid scaling problems since only one bot with one token can exist at a time.
    • The backend is deployed separately to facilitate scaling.
    • Before each deployment, a migration job attempts to apply migrations to the database instance.
    • If something goes wrong during the build or deployment process, a rollback to the previous version is initiated.

Check the Bot and Web

TODO

  • Cover all backend handlers with types.
  • Generate OpenAPI schema from backend handlers.
  • Validate all requests by JSON schema at runtime.
  • Generate web client from OpenAPI schema.
  • Extract dependencies like DB queries from the backend server to some dependency injection to facilitate testing.
  • Write a few integration tests using Playwright or a similar tool and include these steps in the CI pipeline.
  • Move handling of temp tokens/sessions to Redis.
  • Improve logging.

PS. CI/CD and deployed app were destroyed at 19.05

tg-bot's People

Contributors

rexemtoxa avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.