Skip to content

Repository files navigation

Pipey

🚧 Early beta / work in progress. This is an ambitious full-stack CRM built as a portfolio project. The architecture and core flows are in place, but it is NOT production-ready β€” see Known Limitations below.

Pipey is a lightweight, multi-channel CRM. It brings conversations from Telegram, MAX, and Avito into a single inbox, links them to contacts and deals on a visual pipeline, and adds a layer of automation on top: AI reply suggestions, PDF quotes and invoices, a public booking page, and analytics. The frontend ships as a PWA with an experimental mobile build via Capacitor.

The product is built around one idea: connect a channel, see your conversations, take an action, and reply to the customer β€” without a steep learning curve.


Known Limitations

Pipey is honest about its current state. Before relying on it for anything serious, be aware that:

  • No automated tests yet. There is no meaningful test suite. Jest is configured in the backend, but there are zero *.spec.ts / test files in either backend/ or frontend/. Treat all behavior as unverified.
  • Channel integrations are uneven. Telegram is the most complete path β€” incoming webhooks are processed end to end (contact upsert, conversation, message persistence). MAX and Avito are partially stubbed: their API clients (MaxService, AvitoService) and webhook controllers exist and enqueue jobs, but the queue worker handlers (processMax, processAvito in queues/processors/webhook.processor.ts) are placeholders that only log and do not yet persist messages.
  • Email magic-link delivery is a TODO. Authentication itself works (passwordless magic-link tokens are issued and verified), but actually sending the email is stubbed β€” in development the link is returned in the API response (// TODO: Send email with magic link in auth/auth.service.ts). There is no SMTP/email provider wired up.
  • Observability is wired but not fully integrated. Prometheus, Grafana, and Sentry/GlitchTip are defined in docker-compose.monitoring.yml / docker-compose.sentry.yml, and a /metrics endpoint plus a Sentry instrument.ts exist, but the dashboards, alerting, and end-to-end tracing are not finished. Sentry/GlitchTip is disabled unless SENTRY_DSN is set.
  • The mobile (Capacitor) build is experimental and untested. A capacitor.config.ts and mobile:* scripts exist and the app can be exported as a static bundle, but native iOS/Android builds have not been validated.
  • Not hardened for production. Default secrets in example files, in-memory AI response caching, and unfinished infrastructure mean this should be treated as a development/portfolio project, not a deployable product.

Features

  • Unified inbox β€” one place for conversations across Telegram, MAX, and Avito.
  • Contacts β€” a lightweight contact database, automatically populated from incoming conversations and the booking form.
  • Deals & pipeline β€” a visual, customizable pipeline with stages; drag deals through your sales process.
  • AI reply suggestions β€” draft replies, suggested next actions (send quote, send invoice, send booking link, create deal, etc.), and conversation summaries, powered by OpenRouter. The default product model is anthropic/claude-3-haiku with an automatic fallback model. When no API key is configured, the service degrades gracefully to mock responses.
  • PDF artifacts β€” generate quotes and invoices as PDFs, plus reusable product cards and calendar links.
  • Public booking page β€” share a public link; customers pick a slot from your configured working hours, and a contact + deal are created automatically. No authentication required for the customer.
  • Analytics β€” dashboards over conversations, deals, and pipeline performance.
  • Team & RBAC β€” organizations, memberships, and roles (OWNER, plus additional roles) with an audit log.
  • PWA + mobile β€” installable progressive web app, with an experimental Capacitor wrapper for iOS/Android and web push notifications (VAPID).

Architecture

Pipey is a monorepo with a NestJS backend and a Next.js frontend, backed by PostgreSQL, Redis, and MinIO, and orchestrated with Docker Compose.

                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   Telegram ─────▢│                              β”‚
   MAX      ─────▢│   NestJS API (backend)       β”‚
   Avito    ─────▢│   webhooks β†’ BullMQ queues   β”‚
                  β”‚                              β”‚
                  β”‚   Auth Β· Channels Β· Inbox    β”‚
                  β”‚   Contacts Β· Deals/Pipeline  β”‚
   Next.js  ◀────▢│   AI Β· Artifacts Β· Booking   β”‚
   (PWA/    REST  β”‚   Analytics Β· Team/RBAC      β”‚
   Capacitor)     β”‚                              β”‚
                  β””β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜
                      β”‚          β”‚          β”‚
                 PostgreSQL    Redis      MinIO
                 (Prisma)    (BullMQ)   (S3 files)
  • Incoming messages arrive via per-channel webhook endpoints, which enqueue jobs onto a Redis-backed BullMQ queue (webhook-processing). Workers process them asynchronously with retries and backoff.
  • AI and PDF generation are designed to run as background jobs as well, keeping request latency low.
  • Files (generated PDFs, attachments) are stored in MinIO (S3-compatible).
  • Data is modeled in Prisma over PostgreSQL (organizations, users, memberships, channels, conversations, messages, contacts, pipelines, stages, deals, artifacts, AI suggestions, audit logs, push subscriptions).

Tech stack

Backend

  • NestJS (TypeScript)
  • Prisma ORM over PostgreSQL
  • Redis + BullMQ for queues and background jobs
  • MinIO (S3-compatible object storage) for files
  • JWT auth with passwordless magic links
  • Optional Sentry / GlitchTip error tracking and a Prometheus /metrics endpoint

Frontend

  • Next.js (App Router, TypeScript)
  • Tailwind CSS
  • Zustand for state management
  • PWA support, with an experimental Capacitor build for iOS/Android

AI

  • OpenRouter as the model gateway (default model anthropic/claude-3-haiku)

Infrastructure

  • Docker & Docker Compose
  • Optional Prometheus + Grafana monitoring stack
  • Optional Sentry / GlitchTip for error tracking

Quick start

Requirements

  • Node.js >= 18
  • npm >= 9
  • Docker & Docker Compose

1. Configure environment

cp .env.example .env

Then edit .env and set real values β€” at minimum POSTGRES_PASSWORD, JWT_SECRET, MAGIC_LINK_SECRET, ENCRYPTION_KEY, and MINIO_SECRET_KEY. Channel tokens (TELEGRAM_BOT_TOKEN, MAX_BOT_TOKEN, AVITO_CLIENT_ID / AVITO_CLIENT_SECRET) and OPENROUTER_API_KEY are optional β€” the app runs without them, and AI features fall back to mock responses when no key is set.

2. Run the full stack with Docker Compose (recommended)

Builds and runs the entire stack (frontend, backend, PostgreSQL, Redis, MinIO) from local code:

./docker.sh start
# or
make start

The app will be available at:

Useful commands:

./docker.sh dev       # infrastructure only (PostgreSQL, Redis, MinIO)
./docker.sh stop      # stop everything
./docker.sh status    # service status
./docker.sh logs-f    # follow logs
./docker.sh help      # full command list

See DOCKER.md for details.

3. Local development (with hot reload)

Run the infrastructure in Docker and the app processes locally:

# 1. Start infrastructure only
./docker.sh dev        # or: make dev

# 2. Backend (in a separate terminal)
cd backend
npm install
npx prisma migrate dev
npm run start:dev

# 3. Frontend (in a separate terminal)
cd frontend
npm install
npm run dev

Database

make db-migrate      # apply migrations
make prisma-studio   # open Prisma Studio
make db-reset        # reset the database (destructive!)

Optional: monitoring & error tracking

docker compose -f docker-compose.monitoring.yml up -d   # Prometheus + Grafana
docker compose -f docker-compose.sentry.yml up -d       # GlitchTip (Sentry-compatible)

Note: these are wired into Compose but not fully integrated β€” see Known Limitations.

Mobile (experimental)

cd frontend
npm run mobile:build      # static export + Capacitor sync
npm run mobile:ios        # open the iOS project
npm run mobile:android    # open the Android project

See frontend/MOBILE.md. The mobile build is experimental and untested.


Project structure

pipey/
β”œβ”€β”€ backend/                  # NestJS API
β”‚   β”œβ”€β”€ prisma/               # Prisma schema & migrations
β”‚   └── src/
β”‚       β”œβ”€β”€ auth/             # passwordless magic-link auth, JWT
β”‚       β”œβ”€β”€ channels/         # Telegram / MAX / Avito integrations
β”‚       β”œβ”€β”€ conversations/    # unified inbox
β”‚       β”œβ”€β”€ contacts/         # contact database
β”‚       β”œβ”€β”€ deals/            # deals
β”‚       β”œβ”€β”€ pipelines/        # pipelines & stages
β”‚       β”œβ”€β”€ ai/               # OpenRouter-backed AI suggestions
β”‚       β”œβ”€β”€ artifacts/        # PDF quotes/invoices, product cards, calendar links
β”‚       β”œβ”€β”€ booking/          # public booking page endpoints
β”‚       β”œβ”€β”€ analytics/        # dashboards & metrics
β”‚       β”œβ”€β”€ team/             # organizations, memberships, RBAC
β”‚       β”œβ”€β”€ settings/         # org settings
β”‚       β”œβ”€β”€ push/             # web push notifications
β”‚       β”œβ”€β”€ queues/           # BullMQ processors (webhook, ai, pdf, message)
β”‚       └── common/           # guards, interceptors, health, metrics, logger
β”œβ”€β”€ frontend/                 # Next.js (App Router) PWA
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ (dashboard)/      # inbox, pipeline, contacts, analytics, team, settings…
β”‚   β”‚   β”œβ”€β”€ auth/             # magic-link sign-in / verify
β”‚   β”‚   β”œβ”€β”€ book/             # public booking page
β”‚   β”‚   └── onboarding/       # first-run onboarding
β”‚   β”œβ”€β”€ components/           # shared UI (AiPanel, MobileNav, pipeline, analytics…)
β”‚   β”œβ”€β”€ lib/                  # API client & helpers
β”‚   └── capacitor.config.ts   # experimental mobile config
β”œβ”€β”€ docker/                   # Docker service configs (postgres, redis, minio, nginx)
β”œβ”€β”€ docker-compose.yml        # main stack
β”œβ”€β”€ docker-compose.monitoring.yml  # Prometheus + Grafana (optional)
β”œβ”€β”€ docker-compose.sentry.yml      # GlitchTip / Sentry (optional)
β”œβ”€β”€ docker.sh                 # convenience CLI
└── Makefile                  # convenience targets

License

MIT Β© 2026 Alexander Zabrodin

About

Lightweight multi-channel CRM (Telegram/MAX/Avito) with AI reply suggestions, visual pipeline, PDF artifacts and public booking. Early beta.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages