Files
web-petting/CLAUDE.md
T
ab 1bd3e17672
Build and Publish / Build and Publish Docker Image (push) Successful in 1m42s
Moved to PSQL.
2026-07-11 14:11:31 +03:00

2.5 KiB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project Overview

Pet sitting web service for managing clients and bookings. The owner uses the site to:

  • Receive and manage client requests (leads) from the website
  • Schedule calls and visits with clients
  • Upload photos/videos of pets for remote viewing by clients (public media page via unique token)
  • Get Telegram notifications about new requests

Tech Stack

  • Language: Rust (edition 2024)
  • Web framework: Cot - Rust web framework (Django-like), local path ../cot/cot
  • Database: PostgreSQL (via Cot ORM)
  • Notifications: Telegram Bot API

Build & Run

cargo build              # build
cargo run                # run dev server at http://127.0.0.1:8000
cargo test               # run all tests
cargo test <name>        # run a single test by name
cargo clippy             # lint
cargo fmt --check        # check formatting
cot migration make       # generate migrations from model changes (requires cot-cli)

Set WEB_PETTING_DATABASE_URL (or DATABASE_URL) before running the app or migrations. Example:

WEB_PETTING_DATABASE_URL=postgresql://postgres:postgres@localhost:5432/web_petting cargo run

Architecture

Monolithic Cot web app with a single PostgreSQL database.

  • src/main.rs - project/app setup, router, config
  • src/models.rs - all database models (Lead, Client, Visit, Media, User, Setting)
  • src/migrations.rs - migration registry
  • src/migrations/ - migration files

Database Design Principles

  • Soft-delete everywhere: records are never physically deleted, only status changes (e.g. active -> archived, new -> rejected). This ensures data can always be recovered.
  • Status fields are stored as String with enum-like values defined in models.rs.
  • Foreign keys use cot::db::ForeignKey<T> with Restrict on delete/update.

Data Model

  • Lead (new/in_progress/converted/rejected) - public form submission; links to Client when converted
  • Client (active/archived) - confirmed client with media_token for public media page
  • Visit (scheduled/completed/cancelled/deleted) - pet sitting session, belongs to Client and User
  • Media (active/archived) - photo/video, belongs to Client, optionally to Visit
  • User (active/archived) - admin accounts (supports multiple admins)
  • Setting - global key-value config (telegram_bot_token, telegram_chat_id, etc.)