Skip to content

tentwinkle/TMA-sticker-collection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telegram Mini App Sticker Catalog

Apache License 2.0 Telegram Node.js MongoDB Atlas Redis React Vite Effector

banner

Description

This is the Telegram Mini App Sticker Catalog.

Huge catalog of sticker packs for Telegram for every taste in one application. A large and convenient set of various and unique stickers for their quick and easy search and installation.

Features

  • Smart search for stickers: Find the perfect sticker with ease by searching for it by name, description, or tags
  • Automatic catalog replenishment: Discover new stickers every day with our automatic catalog replenishment feature
  • Recommendations based on current trends: Stay up-to-date with the latest trends by checking out our recommendations
  • Rating system: Help us promote the best sticker packs by rating them and contributing to the overall ranking
  • Support for animated stickers: Bring your conversations to life with our support for animated stickers
  • Display of similar sticker packs: Discover new sticker packs that you’ll love based on your likes and open sticker packs

Screenshots

banner banner banner banner

Client setup

  • To get started with the client-side, you'll need to have Node.js 16.16.0 or higher and npm installed on your machine. You can download them from here
    • We recommend using the latest LTS version

Installing

Go to the client directory:

cd client

Set the following environment variables in a .env file or in your shell:

Variable Description
VITE_API_URL API server url

To install the dependencies, run:

npm install

To start the dev-server, run:

npm run dev

The dev-server will start listening on port 5173 by default.

To build the project, run:

npm run build

Server setup

  • To get started with the API, you'll need to have Node.js and npm installed on your machine. You can download them from here
    • We recommend using the latest LTS version
  • You definitely need a cloud database MongoDB Atlas
  • You'll also need a Redis database for caching
    • You can get one by signing up here or by installing it locally
  • You'll also need a Telegram bot token. You can get one by talking to BotFather
  • Once you have all of that, you can clone the repository
    • You can do that by running git clone https://github.com/fstik-app/catalog in your terminal or by downloading the repository as a zip archive
    • You can also set them in your shell or in your hosting provider's dashboard

MongoDB Atlas Setup

Why MongoDB Atlas?

The catalog is based on full-text search Atlas Search and MongoDB Atlas is the only way to use it. You can use MongoDB Atlas for free, but you'll need to provide your credit card details. You won't be charged anything unless you upgrade to a paid plan. You can read more about Atlas Search here.

How to set up MongoDB Atlas?

  1. Sign up for MongoDB Atlas here
  2. Create a new project
  3. Create a new cluster
  4. Go to the cluster's settings and click on "Database Access"
  5. Create a new user with the "Atlas admin" role
  6. Go to the cluster's settings and click on "Network Access"
  7. Add your IP address to the whitelist
  8. Go to the cluster's settings and click on "Clusters"
  9. Click on "Connect" and then on "Connect your application"
  10. Copy the connection string and replace the <password> placeholder with the password of the user you created in step 5
  11. Set the MONGODB_URI environment variable to the connection string

Import sample data

We provide a sample date for the minimum functionality of the catalog to work. You can download it here.

Follow the instructions here to import the data into your cluster.

Installing

Go to the server directory:

cd server

Set the following environment variables in a .env file or in your shell:

Variable Description
NODE_ENV The environment to run the API in. Can be one of development or production. Defaults to development.
PORT The port to run the API on. Defaults to 3000.
BOT_TOKEN The Telegram bot token.
MONGODB_URI The MongoDB connection URI.
ATLAS_MONGODB_URI The MongoDB Atlas connection URI.
SESSION_SECRET The session secret.
REDIS_PREFIX The Redis key prefix.

To install the dependencies, run:

npm install

To start the API, run:

npm start

The API will start listening on port 3000 by default.

We recommend using PM2 to run the API in production.

API Documentation

Link to the API documentation: API_DOCS.md

NSFW Stickers Checker

For checking if a sticker set contains NSFW stickers, we use a nsfw checker service.

This is a Node.js script that checks Telegram sticker sets for NSFW content using the nsfwjs library. It also uses the Telegram Bot API to retrieve information about the sticker sets and the sharp library to process images.

Usage

  1. Clone the repository
  2. Run npm install
  3. Create a .env file with the following contents:
BOT_TOKEN=<your bot token>
MONGODB_URI=<your MongoDB URI>
ATLAS_MONGODB_URI=<your MongoDB Atlas URI>
  1. Run npm start

How it works

The script runs indefinitely, periodically checking for new sticker sets to moderate. When it finds a sticker set to moderate, it will download the stickers and check them for NSFW content. If the set contains too much NSFW content, it will mark the set as unsafe and prevent it from being published.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details

Acknowledgments

  • Telegram for creating the Telegram Mini App platform