2.8b Back-End Development
← 2.8a Front-End | Home | Next: 2.8c Architecture →
- API design: RESTful principles, GraphQL, gRPC. Focus on versioning strategy, error code semantics, idempotency design.
- Message brokers: An intermediary computer program module that translates a message from the formal messaging protocol of the sender to the formal messaging protocol of the receiver. The primary purpose is to take incoming messages and perform actions on them—decoupling end-points, meeting non-functional requirements, and facilitating reuse of intermediary functions.
Two fundamental architectures: - Hub-and-spoke: A central server acts as an integration mechanism. - Message bus: A communication backbone or distributed service.
Core capabilities: queue management, guaranteed message delivery, message persistence, message transformation, publish–subscribe, transaction management. Notable products: RabbitMQ, Apache Kafka, Apache ActiveMQ, Redis Pub/Sub, NATS, AWS SQS/Kinesis. - Relational databases: How they work, basic concepts, ACID (Atomicity, Consistency, Isolation, Durability), transactions, indexing, normalization. - Non-relational databases (NoSQL): Document stores (MongoDB), key-value stores (Redis), column-family stores (Cassandra), graph databases (Neo4j). - Database design: ER diagrams, normalization and denormalization, index strategy. - ORM: Object-Relational Mapping bridges the gap between object-oriented code and relational database tables, eliminating boilerplate SQL (e.g., Entity Framework, Hibernate, SQLAlchemy). - Batch processes / Cron jobs: Scheduled task execution, message queue delayed processing, distributed scheduling. - Session handling: Maintaining user identity in stateless HTTP—Cookie-based, Token-based (JWT), server-side session stores. - Error Handling, Auditing, and Logging
Error Handling ensures applications respond gracefully to unexpected conditions without exposing sensitive information: - Fail securely: Error responses must not reveal unnecessary information (server versions, stack traces, library details) that could be exploited. - Centralized exception management: Use global handlers to capture and log exceptions consistently. - Stack traces and context: Capture stack traces and contextual information (user ID, session ID, request ID) to aid debugging while avoiding exposure of sensitive data. - Testing and validation: Implement unit, integration, and end-to-end tests to catch errors early.
Logging provides a record of system events and errors: - Structured logging: Use consistent formats (JSON, key-value pairs) to facilitate automated analysis. - Log levels: Utilize DEBUG, INFO, WARN, ERROR, and FATAL to control granularity and relevance. - Centralized log aggregation: Tools like ELK Stack or Splunk allow logs from multiple components to be collected, searched, and visualized efficiently. - Sensitive data management: Avoid logging sensitive information such as passwords, payment details, or personally identifiable information (PII). If sensitive data must be logged, encrypt it and enforce retention policies. - Retention and lifecycle: Define log lifetimes to prevent indefinite storage and reduce risk exposure.
Auditing involves tracking critical actions and system events: - High-quality logs: Focus on meaningful events rather than generating excessive noise. - Alerting and notifications: Implement real-time alerts for critical errors or suspicious activities to enable rapid response. - Compliance and privacy: Ensure logs comply with local data protection laws and organizational policies. - Proactive monitoring: Use anomaly detection and performance metrics to identify potential issues before they escalate.
Best practices summary: Define clear logging objectives → Implement structured and leveled logging → Encrypt sensitive information and enforce retention → Centralize and aggregate logs → Integrate error handling with alerting → Regularly review and audit logs.
Sources
- Wikipedia — Message broker: https://en.wikipedia.org/wiki/Message_broker
← 2.8a Front-End | Home | Next: 2.8c Architecture →