How marikk852/freelance-app works
SafeDeal is a Telegram Mini App for client–freelancer deals, with funds held in TON or other supported-chain escrow contracts. The main workflow runs from deal creation and freelancer acceptance through contract deployment, payment monitoring, protected delivery, client approval or dispute, and release/refund/split; profiles, notifications, subscriptions, and crystals support that flow. The graph includes documented capabilities whose route implementations were not sampled. Dashed edges mark likely integration points not directly evidenced; source excerpts are partial.
Main entry points: escrowService.js Escrow coordinator · db.js PostgreSQL access · server.js HTTP API server · App.tsx Telegram Mini App
Components 24
Deal experience
- Telegram Mini App
miniapp/src/App.tsx - Deal workflow screens
miniapp/src/pages - API client
miniapp/src/utils/api.ts - Telegram bot
bot/bot.js - Bot deal handlers
bot/handlers/deals.js
Backend services
- HTTP API server
backend/server.js - Deal and delivery routes
backend/routes - Telegram auth
backend/middleware/auth.js - Protected delivery files
backend/services/fileProtection.js - Community and account routes
backend/routes - User profiles
backend/routes/users.js
Escrow and chains
- Escrow coordinator
backend/services/escrowService.js - EVM escrow adapter
backend/services/evmEscrowService.js - TON client service
backend/services/tonService.js - TON contract wrappers
contracts/wrappers/EscrowContract.ts - Escrow monitoring
backend/services/monitorService.js
Persistence
- PostgreSQL access
database/db.js - Deal and user models
database/models
Engagement
- Notifications
backend/services/notificationService.js - Subscriptions and tiers
backend/services/tierService.js - Crystal rewards
backend/services/crystalService.js
Other components
- Client and freelancer
- TON and EVM networks
- Telegram platform
Connections 30
- Client and freelancer → Telegram Mini App: uses
- Telegram Mini App → Deal workflow screens: routes to
miniapp/src/App.tsx - Telegram Mini App → API client: requests data
- API client → HTTP API server: calls API
- HTTP API server → Telegram auth: applies
backend/server.js - HTTP API server → Deal and delivery routes: mounts routes
backend/server.js - Deal and delivery routes → Escrow coordinator: delegates escrow
backend/routes/contracts.js - Deal and delivery routes → Protected delivery files: uses delivery protection
backend/routes/deliveries.js - Escrow coordinator → TON client service: uses TON operations
backend/services/escrowService.js - Escrow coordinator → EVM escrow adapter: dispatches EVM
backend/services/escrowService.js - EVM escrow adapter → TON and EVM networks: submits transactions
- TON client service → TON and EVM networks: queries and sends
- TON contract wrappers → TON and EVM networks: defines TON contracts
- Escrow monitoring → Escrow coordinator: checks escrow
backend/services/monitorService.js - Escrow monitoring → TON client service: checks chain state
backend/services/monitorService.js - Escrow coordinator → PostgreSQL access: reads and writes
backend/services/escrowService.js - EVM escrow adapter → PostgreSQL access: reads and writes
backend/services/evmEscrowService.js - Deal and user models → PostgreSQL access: uses database
database/models/User.js - Telegram bot → Bot deal handlers: registers handlers
bot/bot.js - Bot deal handlers → Escrow coordinator: deploys contracts
bot/handlers/deals.js - Bot deal handlers → PostgreSQL access: reads deal data
bot/handlers/deals.js - Escrow coordinator → Notifications: notifies parties
backend/services/escrowService.js - Notifications → PostgreSQL access: stores notifications
backend/services/notificationService.js - Notifications → Telegram platform: sends messages
- Subscriptions and tiers → PostgreSQL access: reads tier plans
backend/services/tierService.js - Crystal rewards → Subscriptions and tiers: gets tier bonus
backend/services/crystalService.js - Crystal rewards → PostgreSQL access: updates ledger and balance
backend/services/crystalService.js - HTTP API server → Community and account routes: mounts routes
backend/server.js - HTTP API server → User profiles: mounts users API
backend/server.js - Client and freelancer → Telegram bot: uses