System Design Lecture Notes
System Design Lecture Notes
-Project Overview
- System Architecture
SYSTEM DIAGRAM
1. Frontend:
2. Backend: RESTful API server for business logic and data processing.
3. Database: Relational database for structured data and a NoSQL database for
unstructured data like reviews.
4. AI Engine: Recommender system using machine learning algorithms.
5. Third-Party Integrations: APIs for location services and reviews (e.g., Google
Maps, Yelp).
COMPONENTS
Frontend
B ACKEND
5. Performans ve Güvenlik:
o Framework'ler genellikle optimize edilmiş kod ve güvenlik özellikleri sunar.
o Örneğin, Django CSRF ve XSS koruması gibi güvenlik özelliklerini
otomatik sağlar.
6. Topluluk Desteği:
o Popüler framework'lerin büyük bir topluluğu vardır ve birçok kaynak
(döküman, eğitim, forum) mevcuttur.
o Örneğin, React Native veya Django için Stack Overflow'da binlerce soru-
cevap bulabilirsiniz.
Back-End Frameworks
1. Django (Recommended):
o Why:
Python-based, aligning well with AI integration for
recommendations.
High scalability and compatibility with JavaScript-based frontends.
Security features like authentication, CSRF, and XSS protection.
Supported by a wide range of libraries for rapid development.
o Best For:
Handling AI recommendation logic and connecting to third-party
APIs (e.g., Google Maps, Yelp).
Rapid development and maintainability.
2. Ruby on Rails:
o Why:
Excellent for rapid prototyping.
Secure and scalable.
o Challenges:
Lesser integration libraries for AI/ML compared to Django.
Smaller talent pool compared to Django.
3. Spring Boot:
o Why:
Java-based with enterprise-level scalability.
Ideal for performance-intensive applications.
o Challenges:
Might be overkill for a project that doesn’t require enterprise-level
complexity.
Responsibilities:
o Process user queries and preferences.
o Communicate with the database and AI engine.
o Expose APIs for the frontend to consume.
D ATABASE
Structure:
o Relational Database (PostgreSQL): User data, business details,
preferences.
o NoSQL Database (MongoDB): Unstructured data such as reviews.
Responsibilities:
o Store and retrieve structured and unstructured data.
o Support complex queries for recommendations.
AI E NGINE
A UTHENTICATION S ERVICE
DATA FLOW
1. User Interaction:
o User opens the app and inputs preferences or performs a search.
o The frontend sends the request to the backend via RESTful APIs.
2. Backend Processing:
o Backend receives the request and validates the input data.
o It queries the database for relevant businesses matching the criteria.
o If recommendations are requested, the backend interacts with the AI
Engine.
3. AI Engine:
o Processes user preferences and historical data.
o Applies machine learning algorithms to generate personalized
recommendations.
4. Database Interaction:
o Backend retrieves business and review data from PostgreSQL and
MongoDB.
o Updates user preferences or reviews if applicable.
5. Response Generation:
o Backend combines AI recommendations and database results.
o Formats the response in JSON and sends it back to the frontend.
6. Frontend Display:
o The mobile app displays results, recommendations, and additional
business details to the user.
3. FUNCTIONAL REQUIREMENTS
FEATURES
1. User Registration and Login: Allow users to create accounts and log in securely.
2. Search and Filtering: Provide search options with filters for distance, cuisine,
ratings, etc.
3. Personalized Recommendations: AI-powered recommendations based on user
history and preferences.
4. Business Listings: Display detailed information about restaurants and cafes.
5. User Reviews: Allow users to read and write reviews.
USE CASES
USER ROLES
4. NON-FUNCTIONAL REQUIREMENTS
PERFORMANCE
SCALABILITY
SECURITY
RELIABILITY
99.9% uptime.
Regular backups of the database.
5. DATABASE DESIGN
ER DIAGRAM
Entities include:
SCHEMAS
6. API DESIGN
ENDPOINTS
1. User Management:
o POST /register: Register a new user.
o POST /login: Authenticate user.
2. Search and Recommendations:
o GET /search: Search for businesses.
o GET /recommendations: Get personalized recommendations.
3. Reviews:
o POST /reviews: Submit a review.
o GET /reviews/{businessID}: Get reviews for a business.