2.4 Database
Goal: Ensure reliable, transactional data storage for user accounts, trades, social interactions, and logs.
SUM+1 relies on PostgreSQL for relational data storage—capturing user accounts, social posts, trades, and more. Redis is used to cache hot data (e.g., real-time price feeds, presence info) and reduce the load on the relational database. This dual-database approach optimizes both data integrity and application performance.
1. PostgreSQL
• Schema Design:
• Users table with fields for profile data, wallet addresses, roles.
• Trades table to log user trades or copy-trade events.
• Posts/Comments for social feed content.
• Channels for chat rooms, storing ownership + membership.
• ORM: Sequelize or Prisma for structured data access.
• Transactions:
• Critical for ensuring data integrity in group trades or fund pooling (syndicates).
• Indexing & Query Optimization:
• Commonly queried fields (e.g., user ID, channel ID) need indexes.
2. Redis
• Caching:
• Frequently accessed data (real-time prices, trending topics).
• Sessions (if using session-based auth, though JWT is typically stateless).
• Pub/Sub (optional) for real-time event broadcasting across multiple Node instances.
Last updated