RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Configs/Cursor rules/groupultra/telegram-search

Cursor rule

.cursor/rules/backend-server.mdc
Cursor rules

Quality

52/100

Scores the file, not the repository.

Length

315 words

5 headings · 0 code blocks

Repository

4.0k

— · pushed 2 days ago

Last changed

3 days ago

First indexed 3 days ago.
groupultra/telegram-search/.cursor/rules/backend-server.mdcRawGitHub
1---
2globs: apps/server/src/**/*
3---
4 
5## Backend Server (apps/server)
6 
7- **Role**: Thin WebSocket + HTTP edge that:
8 - Hosts a **`CoreContext` per WebSocket connection**.
9 - Exposes health/metrics endpoints.
10 - Delegates all business logic to `packages/core`.
11- Do **not** add business rules, Telegram API calls, or heavy data processing into `apps/server`; push those into `packages/core`.
12 
13### Bootstrap & Lifecycle
14 
15- Preserve the bootstrap sequence from `src/app.ts`:
16 1. Parse env flags (`parseEnvFlags`).
17 2. Initialize logging (`initLogger` + `useLogger().useGlobalConfig()`).
18 3. Build runtime config from environment (`parseEnvToConfig(process.env)`).
19 4. Initialize database via `initDrizzle` using that config.
20 5. Configure the HTTP/WebSocket server.
21 6. Start listening via `listhen` and register graceful shutdown handlers.
22- Any changes must keep this order clear and failure modes explicit.
23 
24### HTTP & WebSocket Design
25 
26- HTTP:
27 - Keep endpoints minimal: health checks, metrics, and potentially a small set of diagnostics.
28 - Reuse `h3` helpers (`createApp`, `createRouter`, `defineEventHandler`) and centralize error handling in `onError`.
29 - Never leak internal error details in HTTP responses; log full details, return generic messages.
30- WebSocket:
31 - Route all WS traffic through a dedicated module (e.g. `ws/routes`) that knows how to instantiate and manage `CoreContext`.
32 - Enforce **one `CoreContext` per connection**; no cross-connection sharing.
33 - When adding new events, ensure types are synchronized with `@tg-search/server/types` and `@tg-search/core`.
34 
35### Configuration & Environment
36 
37- Source configuration from `config.yaml` + environment variables only; avoid hard-coding URLs, ports, or credentials.
38- Keep the config schema compatible between server and browser modes where applicable (database, embedding, Telegram API).
39- When adding new configuration options:
40 - Document them in `.env.example`.
41 - Provide safe defaults that will not break existing deployments.
42 
43### Error Handling & Observability
44 
45- Use central error handlers:
46 - `setupErrorHandlers` for process-level errors (uncaughtException, unhandledRejection).
47 - `h3`'s `onError` hook for HTTP path errors.
48- Metrics:
49 - Use `prom-client` and expose metrics from `/metrics` using the shared registry.
50 - Only add new metrics when they support explicit SLOs (latency, error rate, throughput).
51 
52 

Sections

  • Backend Server (apps/server)
  • Bootstrap & Lifecycle
  • HTTP & WebSocket Design
  • Configuration & Environment
  • Error Handling & Observability

What it covers

setupsecuritymonorepo

Stack — with the evidence

typescript

(1.00)

drizzle

(1.00)

turborepo

(1.00)

vitest

(1.00)

eslint

(1.00)

node

(0.70)

vue

(0.70)

postgres

(0.70)

vite

(0.70)

javascript

(0.60)

monorepo

(0.60)

pnpm

(0.60)

github-actions

(0.60)

Glob targeting

  • apps/server/src/**/*

Format

Cursor rules

The most expressive format here. Many small .mdc files, each with frontmatter declaring when it should load, so a rule about migrations only enters context when a migration is open. Costs the most to maintain and only one editor reads it.

What the corpus says about it

Repository

Owner
groupultra
Language
—
License
—
Archived
no

All configs in this repo

Also in groupultra/telegram-search

Diff this repo’s formats

One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?

The other instruction files in this repository
RepositoryFormatStackCoversScoreChanged
groupultra/telegram-search.cursor/rules/testing.mdc · 4.0kCursor rulestypescriptdrizzle+11teststyletesting-strategydatabase55/1003 days ago
groupultra/telegram-search.cursor/rules/architecture.mdc · 4.0kCursor rulestypescriptdrizzle+11buildtestlint-formatarch+489/1003 days ago
groupultra/telegram-search.cursor/rules/client.mdc · 4.0kCursor rulestypescriptdrizzle+11stylearchtypesdependencies+160/1003 days ago
groupultra/telegram-search.cursor/rules/contributing.mdc · 4.0kCursor rulestypescriptdrizzle+11styletypesgit56/1003 days ago
groupultra/telegram-search.cursor/rules/core.mdc · 4.0kCursor rulestypescriptdrizzle+11stylearchdependenciesdatabase+160/1003 days ago
groupultra/telegram-search.cursor/rules/db.mdc · 4.0kCursor rulestypescriptdrizzle+11styletypesdatabaseperformance59/1003 days ago
groupultra/telegram-search.cursor/rules/events.mdc · 4.0kCursor rulestypescriptdrizzle+11style60/1003 days ago
groupultra/telegram-search.cursor/rules/frontend-web.mdc · 4.0kCursor rulestypescriptdrizzle+11stylesecurityuimonorepo56/1003 days ago
groupultra/telegram-search.cursor/rules/pglite-inspector.mdc · 4.0kCursor rulestypescriptdrizzle+11securityapi47/1003 days ago
groupultra/telegram-search.cursor/rules/tooling.mdc · 4.0kCursor rulestypescriptdrizzle+11buildlint-formatstyledeployment+167/1003 days ago
groupultra/telegram-search.github/copilot-instructions.md · 4.0kCopilot instructionstypescriptdrizzle+11teststyleagent-behaviour76/1003 days ago
groupultra/telegram-searchAGENTS.md · 4.0kAGENTS.mdtypescriptdrizzle+11setupbuildtestlint-format+1083/1003 days ago
Diff against .cursor/rules/testing.mdc Diff against .cursor/rules/architecture.mdc Diff against .cursor/rules/client.mdc Diff against .cursor/rules/contributing.mdc Diff against .cursor/rules/core.mdc Diff against .cursor/rules/db.mdc Diff against .cursor/rules/events.mdc Diff against .cursor/rules/frontend-web.mdc Diff against .cursor/rules/pglite-inspector.mdc Diff against .cursor/rules/tooling.mdc Diff against .github/copilot-instructions.md Diff against AGENTS.md

Similar configs

Same format, overlapping stack, ranked by quality.

Same format, overlapping stack, ranked by quality
RepositoryFormatStackCoversScoreChanged
hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126Cursor rulesgobun+5setupbuildtestlint-format+6100/1003 days ago
TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45Cursor rulestypescriptpytest+15testlint-formatstylearch+5100/1003 days ago
markstev/mark-starter.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+14setuptestlint-formatstyle+699/1003 days ago
Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+13setuptestlint-formatstyle+799/1003 days ago
dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+15setuptestlint-formatstyle+799/1003 days ago
deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1Cursor rulestypescriptnextjs+5setuptestlint-formatstyle+799/1003 days ago
langflow-ai/langflow.cursor/rules/docs_development.mdc · 153kCursor rulespythonnode+16setupbuildtestlint-format+797/1003 days ago
TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45Cursor rulestypescriptpytest+15teststyletesting-strategysecurity+397/1003 days ago
RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack