0% found this document useful (0 votes)
8 views5 pages

Backend Engineer Assessment Guide

The document outlines an assessment task for a Backend Engineer position, focusing on building an e-commerce ordering and payment system. It details functional and non-functional requirements, including user and product management, order processing, and payment integration with Stripe and bKash. Additionally, it specifies deliverables such as documentation, code, payment integrations, testing, and deployment instructions.

Uploaded by

Mahir Abrar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views5 pages

Backend Engineer Assessment Guide

The document outlines an assessment task for a Backend Engineer position, focusing on building an e-commerce ordering and payment system. It details functional and non-functional requirements, including user and product management, order processing, and payment integration with Stripe and bKash. Additionally, it specifies deliverables such as documentation, code, payment integrations, testing, and deployment instructions.

Uploaded by

Mahir Abrar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Assessment for Backend Engineer

Thank you for your interest in joining our team. We appreciate the time and effort you’ve
taken to apply. To proceed with the evaluation, please choose one of the tasks listed and
complete it according to the instructions provided.

Our average review time is 5 days, and we kindly ask that you carefully follow all task
guidelines to ensure a smooth assessment process.

E-commerce Ordering & Payment


System
1. Project Overview
Build a backend system for managing users, products, orders, and payments with support
for multiple payment providers (Stripe, bKash). The system must expose APIs for user
registration, product management, order creation, checkout, and payment verification.

2. Requirements
2.1 Functional Requirements
2.1.1 User Management

●​ Users can register and log in.


●​ User data stored in the Users table.
●​ Email must be unique.
●​ Users can view their own orders and payments.​

2.1.2 Product Management

●​ Admin can create, update, delete products.


●​ Product fields:​
id (PK), name, sku (unique), description, price, stock, status (active/inactive),
timestamps​

●​ Users can view product lists and details.​


2.1.3 Order Management

●​ Orders belong to users.​

●​ Fields:​
id, user_id (FK → [Link]), total_amount, status (pending, paid, canceled),
timestamps​

●​ An order consists of multiple products.​

●​ Requires an OrderItems table:​


Id, order_id (FK), product_id (FK), quantity, price, subtotal​

2.1.4 Payment System

Payment handled via Stripe and bKash.

Stripe

●​ Create payment intent.​

●​ Confirm payment.​

●​ Webhook for payment updates.​

●​ Store:​

○​ provider = "stripe"​

○​ transaction_id = payment_intent_id​

○​ status = pending/success/failed​

bKash

●​ Checkout API integration.​

●​ Execute payment.​

●​ Query payment.​

●​ Store:​

○​ provider = "bkash"​
○​ transaction_id = bkash_payment_id​

○​ status = pending/success/failed​

2.1.5 Payment Table

Id, order_id (FK), provider (stripe/bkash), transaction_id (unique), status,


raw_response (JSON), timestamps​

2.1.6 Order Flow

1.​ User selects products → creates order.


2.​ User chooses the payment provider.
3.​ The system initiates payment.
4.​ Provider confirms or fails payment.
5.​ Order status updates accordingly.
6.​ Stock is reduced after successful payment.

2.2 Core Design & Algorithm Requirements​


2.2.1 OOP Requirement​
Use OOP classes (User, Product, Order, Payment) in User Management, Product
Management, Order Management, and Payment System to organize logic and support
future extensions.

2.2.2 Data Structure Requirement​


Use relational tables and indexed fields in Users, Products, Orders, OrderItems, Payments,
and Categories for efficient querying and hierarchical relationships.

2.2.3 Algorithm Requirement​


Implement deterministic algorithms in Order Management to calculate totals and subtotals,
and in Product Management to safely reduce stock after payment.

2.2.4 Design Pattern Requirement​


Implement strategy pattern in the Payment System to switch between Stripe, bKash, and
future providers without modifying core order logic.

2.2.5 DFS + Caching Requirement​


Use DFS in Product Recommendation / Category Hierarchy to traverse the category tree for
recommending related products efficiently, and cache the category tree in
Redis/memcached to minimize database calls and speed up repeated traversals.
3. Non-Functional Requirements
●​ Clean REST API design.
●​ Use migrations for DB.
●​ Proper data validation.
●​ Secure storage of API keys.
●​ Logging & error handling.
●​ Scalable schema for adding more payment providers later.

4. Deliverables
4.1 Documentation
●​ System architecture diagram.
●​ ERD (Users, Products, Orders, OrderItems, Payments).
●​ API documentation (Postman/Swagger).
●​ Payment flow diagrams (Stripe & bKash).​

4.2 Code Deliverables


●​ Backend project ([Link] / [Link]/ Django/ FastApi — depends on your choice).
●​ Seeders for admin user and sample products.​

4.3 Payment Integrations


●​ Stripe integration (test + live mode).​

●​ bKash integration (sandbox + live).​

●​ Webhook handlers for each.​

4.4 Testing
●​ Unit tests for models.
●​ API tests for authentication, orders, and payments.
●​ Webhook test cases.​

4.5 Deployment
●​ Environment configuration guide.
●​ Frontend on Vercel
●​ Backend running locally via ngrok
●​ Docker deployment (for backend + DB)

Common questions

Powered by AI

DFS is utilized to efficiently traverse the category tree, identifying related products through hierarchical navigation. Caching this category tree in Redis or Memcached reduces the number of database calls required, thus speeding up repeated traversals. This approach minimizes response times and server load, enhancing user experience by delivering quick and relevant product recommendations .

Logging provides insights into system operations and user behavior, aiding in troubleshooting and performance monitoring. Effective error handling ensures that unexpected issues are gracefully managed and logged, which helps developers quickly identify, diagnose, and resolve problems. Collectively, they enhance system resilience and facilitate proactive maintenance practices .

Using database migrations allows changes to the database schema to be version-controlled and applied in a structured manner, reducing the risk of data inconsistency and schema mismatches. Migrations facilitate seamless updates and rollbacks, supporting agile development cycles and collaborative team environments by ensuring all changes are documented and replicable across environments .

The strategy pattern in the payment system allows the backend to switch between different payment providers like Stripe and bKash without modifying the core order logic. This design promotes versatility and robustness by enabling easy integration of additional payment methods in the future, thus ensuring that the system remains maintainable and adaptable to changes or expansions in payment options .

Secure storage of API keys is vital to prevent unauthorized access and potential data breaches, as these keys are critical for transactions and communicating with payment providers. Methods such as environment variable storage, encryption of keys, access control policies, and regular audits can help ensure that these keys are protected against unauthorized access and misuse .

Webhook handlers enable real-time updates on payment status directly from the payment providers, which ensures that the backend accurately reflects the current transaction state (e.g., pending, successful, failed). This real-time processing reduces latency in order status updates, maintains synchronization between the payment system and backend records, and enhances overall system reliability .

Potential challenges include ensuring the system's ability to handle different API requirements from new payment providers, maintaining a consistent transaction handling process, and securing data interchange with multiple external services. Additionally, updates to data structures or algorithms may be needed to accommodate diverse transaction states and error handling logic, which could complicate the overall architecture and maintenance .

Clean REST API design promotes intuitive and efficient interaction between frontend and backend systems by adhering to principles like statelessness, clearly defined endpoints, and using standard HTTP methods. This ensures that data exchange is seamless and consistent, facilitating the development, debugging, and scaling of client applications .

By organizing system components into OOP classes (such as User, Product, Order, and Payment), the backend gains clarity, modularity, and reusability of code. This structure facilitates easier updates and expansions, such as adding attributes or methods, without affecting other parts of the system, thereby enhancing maintainability and supporting systematic evolution .

Deterministic algorithms in order management ensure that calculations of totals and subtotals are consistent and predictable, thereby maintaining the integrity of order data. This accuracy is crucial in financial operations for user trust and system reliability. Algorithms that efficiently manage stock reductions post-payment also improve inventory management and prevent logical errors or stock misalignments .

You might also like