Comprehensive Application Breakdown & Documentation
Cylence is a next-generation secure messenger designed for end-to-end encrypted communication. Unlike standard messaging apps, Cylence utilizes a unique "Vault" system where users manage their own cryptographic keys locally, ensuring that even if the server is compromised, message contents remain private.
Built with TypeScript for type safety. Uses Vite for blazing fast development and building.
A robust API layer built with Express and TypeScript.
Relational database used for storing users, conversations, and encrypted message metadata.
The application is designed to be containerized and easily deployed using Docker.
Note: While the codebase currently utilizes PostgreSQL syntax (e.g., gen_random_uuid()), it can be adapted for MariaDB by updating the SQL migrations and the database driver.
backend/src/server.ts: Entry point for the API.backend/src/db.ts: Database connection pooling.backend/src/auth/: Authentication routes and JWT logic.backend/sql/schema.sql: Core database structure.backend/migrations/: Incremental database updates.desktop/src/App.tsx: Main application logic and state management.desktop/src/crypto/engine.ts: The E2EE encryption/decryption core.desktop/src/crypto/vaultStorage.ts: Local storage management for secrets.desktop/src/components/: All UI components (Sidebar, ChatWindow, etc.).Cylence leverages several external services to enhance the user experience:
stun:stun.l.google.com:19302 is used to facilitate WebRTC calls.cd backend
npm install
npm run dev
cd desktop
npm install
npm run dev
The application will be available at http://localhost:5173.
Navigate to desktop/src/components/. Most UI elements are split into specific components. Styles are primarily handled via inline React styles or App.css. The main layout is managed in App.tsx using a mobile-first responsive design.
backend/src/ (e.g., orders/).orderRoutes.ts.backend/src/server.ts using app.use('/orders', orderRoutes).Add a new .sql file to backend/migrations/. The backend automatically runs these migrations on startup via runMigrations() in server.ts.
All sensitive configuration is handled via .env files. Never commit these files to version control.
PORT=4000
DATABASE_URL=postgresql://user:pass@localhost:5432/db_name
JWT_SECRET=your-secure-secret-here
CORS_ORIGINS=http://localhost:5173
VITE_API_BASE_URL=http://localhost:4000
VITE_GIPHY_API_KEY=your_giphy_key_here
To change keys, update the value in the respective .env file and restart the service.