|
| 1 | +--- |
| 2 | +title: "Database Modernizr Workflow" |
| 3 | +date: 2025-09-01T10:41:04-05:00 |
| 4 | +weight: 30 |
| 5 | +chapter: true |
| 6 | +--- |
| 7 | + |
| 8 | +## Application Analysis and Baseline Establishment |
| 9 | + |
| 10 | +Before beginning the modernization process, you must thoroughly understand the existing system architecture. This involves analyzing the current MySQL-based e-commerce application to identify all data access patterns, performance characteristics, and system dependencies. |
| 11 | + |
| 12 | +Begin by reviewing the application documentation in the `README.md` file, which provides an overview of the system architecture and functionality. |
| 13 | + |
| 14 | +::alert[You don't have to follow the `README.md` instructions as your environment is already pre-configured for you. ]{type="info"} |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | +## Starting the Application Services |
| 19 | + |
| 20 | +The e-commerce application follows a standard three-tier architecture: |
| 21 | +1. **Backend Service** - Express.js API server handling business logic and database interactions |
| 22 | +2. **Frontend Application** - React-based user interface for customer interactions |
| 23 | +3. **MySQL Database** - Relational database storing all application data |
| 24 | + |
| 25 | +While your application environment is already preconfigured, you'll still need to start both the backend and frontend services to establish a baseline for analysis. |
| 26 | + |
| 27 | +### Initializing the Backend Service |
| 28 | + |
| 29 | +The backend API server manages all client requests and database transactions. Navigate to the `/backend` directory and open an integrated terminal (right-click > "Open in Integrated Terminal"). Grant any requested permissions when prompted. |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | +Build and start the backend service using these commands: |
| 34 | + |
| 35 | +```shell |
| 36 | +npm run build |
| 37 | +npm run start |
| 38 | +``` |
| 39 | + |
| 40 | +Monitor the startup sequence output. A successful initialization will display output similar to: |
| 41 | + |
| 42 | +```console |
| 43 | +👤 DatabaseFactory.createUserRepository called |
| 44 | +🔧 DynamoDBClientManager.getClient() called |
| 45 | +👤 Creating UserDualWriteWrapper |
| 46 | +🔐 AuthService repositories created |
| 47 | +🛍️ ShoppingCartService constructor called |
| 48 | +🛍️ ShoppingCartService repositories created |
| 49 | +🛍️ ShoppingCartService constructor called |
| 50 | +🛍️ ShoppingCartService repositories created |
| 51 | +Starting server with enhanced error handling... |
| 52 | +✅ Environment variables validated successfully |
| 53 | +✅ Database abstraction layer initialized with mysql configuration |
| 54 | +Registering routes... |
| 55 | +All routes registered. |
| 56 | +Server setup complete with comprehensive error handling |
| 57 | +📝 Using MySQL-only mode (Phase 1) |
| 58 | +🚀 Server is running on port 8100 |
| 59 | +📊 Health check: http://localhost:8100/api/health |
| 60 | +🔧 Performance: http://localhost:8100/api/performance |
| 61 | +📈 Metrics: http://localhost:8100/api/metrics |
| 62 | +``` |
| 63 | + |
| 64 | +**Important:** Keep this terminal window open! If you close it, the backend service will stop working, and our application won't function properly. |
| 65 | + |
| 66 | +### Launching the Frontend Application |
| 67 | + |
| 68 | +Initialize the React frontend application by opening a terminal in the `/frontend` directory and executing: |
| 69 | + |
| 70 | +```shell |
| 71 | +npm run serve:prod |
| 72 | +``` |
| 73 | + |
| 74 | +Allow several minutes for the build process to complete. Dismiss any popup notifications that may appear during startup. |
| 75 | + |
| 76 | +## Application Verification and Analysis |
| 77 | + |
| 78 | +With both services running, you can now interact with the complete application stack to understand its current behavior and performance characteristics. |
| 79 | + |
| 80 | +### Backend Health Check |
| 81 | + |
| 82 | +Verify the API server is responding correctly by accessing the health endpoint: |
| 83 | + |
| 84 | +1. Copy your VS Code environment URL |
| 85 | +2. Open a new browser tab |
| 86 | +3. Navigate to `[your-url]/api/health` |
| 87 | + |
| 88 | +This endpoint should return status information confirming the backend is operational: |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | +Monitor your backend terminal for request logging, which demonstrates the API request flow. |
| 93 | + |
| 94 | +### Frontend Application Access |
| 95 | + |
| 96 | +Access the e-commerce frontend by navigating to `[your-url]/store/`: |
| 97 | + |
| 98 | + |
| 99 | + |
| 100 | +## System Interaction Analysis |
| 101 | + |
| 102 | +Explore the application functionality to understand the data access patterns that will need to be modernized: |
| 103 | + |
| 104 | +**User Registration:** Create a new user account to observe authentication workflows |
| 105 | + |
| 106 | +**Admin Access:** Use the administrative account (username: `admin`, password: `0137183966133de0ace3d7e65e025d12`) to access extended functionality |
| 107 | + |
| 108 | +**E-commerce Operations:** Navigate through product browsing, cart management, and checkout processes. We have two simulated payment methods, paypal and credit card, both will auto-approve any order! |
| 109 | + |
| 110 | +Pay close attention to the backend terminal output as you interact with the application. Each user action generates specific database queries that represent the access patterns you'll need to replicate in your DynamoDB implementation. |
| 111 | + |
| 112 | +## Baseline Understanding |
| 113 | + |
| 114 | +This exploration phase establishes your baseline understanding of the current system architecture. Each user interaction demonstrates how the Express.js backend translates HTTP requests into MySQL queries, processes the results, and returns formatted responses to the React frontend. |
| 115 | + |
| 116 | +This request-response cycle represents the core functionality that must be preserved during the database modernization process, ensuring zero functional regression while achieving improved performance and scalability through DynamoDB. |
0 commit comments