A comprehensive full-stack application for managing customers and their associated addresses. This project includes a responsive, modern frontend interface and a RESTful API backend.
The frontend is built with HTML5, CSS3, Bootstrap 5, and JavaScript to provide a modern4,000,000, responsive, and user-friendly interface.
-
Home Page:
- The home page displays a list of all customers in a card layout.
- Click the "Add Customer" button to open the form for adding a new customer.
- Fill in the required details (e.g., name, email, phone number) and click "Save Customer".
- The newly added customer will appear in the customer list dynamically without refreshing the page.
-
Add a New Customer:
- Click the "Add Customer" button to open the form.
- Fill in the details and click "Save Customer."
- The new customer will appear in the customer list.
-
View Customer Details:
- Click the "View" button on a customer card to see their details and associated addresses.
- The modal displays customer information and a list of addresses.
-
Edit a Customer:
- Click the "Edit" button on a customer card to update their details.
- The form will pre-fill with the customer's current information.
-
Manage Addresses:
- Add, edit, or delete addresses directly from the customer details modal.
- Click "Add Address" to open the address form.
-
Delete a Customer:
- Click the "Delete" button on a customer card to remove the customer and their associated addresses.
-
Delete a specific address of a customer:
- Click the "Delete" button on a customer card to remove the customer and their associated addresses.
- The application is fully responsive and works seamlessly on desktops, tablets, and mobile devices.
The backend is a RESTful API built with Python 3.11 and Flask, providing robust functionality for managing customers and their addresses.
- Customer Management: Create, read, update, and delete customer records.
- Address Management: Associate multiple addresses with each customer.
- Image Support: Upload and retrieve customer profile images.
- Data Validation: Prevent duplicate emails and enforce required fields.
- RESTful Design: Following REST principles with appropriate HTTP verbs and status codes.
- Comprehensive Test Suite: Automated tests for all API endpoints.
- HTML5: Markup language for the frontend.
- CSS3: Styling with custom animations and responsive design.
- Bootstrap 5: Framework for responsive and modern UI components.
- JavaScript: Dynamic interactions and API integration.
- Python 3.11: Core programming language.
- Flask: Lightweight web framework for API development.
- MySQL 8: Relational database for data storage.
- Docker: Containerization for consistent development and deployment.
- Docker Compose: Multi-container Docker applications.
- Pytest: Testing framework for automated tests.
- Docker and Docker Compose
- Git
-
Clone the repository:
git clone https://github.com/agungferdi/python-full-stack-crud-customers.git cd python-full-stack-crud-customers -
Start the Docker containers:
docker-compose up -d
-
Access the application:
- Frontend: Open http://localhost:8000 in your browser.
-
Run the test suite:
docker exec -it customer_api-web-1 pytest -v -
Run integration tests:
docker exec -it customer_api-web-1 pytest tests/integration_tests.py -v
customer_api/
├── app.py # Main application entry point
├── docker-compose.yml # Docker Compose configuration
├── Dockerfile # Docker build instructions
├── models/ # Data models
│ ├── customer.py
│ └── address.py
├── routes/ # API route handlers
│ ├── customer_routes.py
│ └── address_routes.py
├── static/ # Frontend static files
│ ├── css/
│ │ └── style.css # Custom styles
│ └── js/
│ └── main.js # Frontend logic
├── templates/ # HTML templates
│ └── index.html # Main frontend page
├── tests/ # Testing
│ ├── test_customers.py
│ ├── test_addresses.py
│ └── integration_tests.py # Integration tests
├── utils/ # Utility functions
│ └── database.py
└── migrations/ # Database schema migrations
└── init_db.sql
Integration tests ensure that the frontend and backend work together seamlessly. Run the integration tests using:
docker exec -it customer_api-web-1 pytest tests/integration_tests.py -vThese tests verify:
- Creating a customer
- Fetching all customers
- Viewing customer details (with associated addresses)
- Adding, editing, and deleting addresses
This project is created by Agung for a technical test - Backend Engineer. All rights reserved.
- Frontend First: The frontend features are now highlighted at the beginning of the README.
- Screenshots: Added placeholders for screenshots of the frontend features.
- Responsive Design: Emphasized the responsive nature of the frontend.
- Integration Testing: Retained the integration testing section for verifying frontend-backend interactions.
Make sure to replace the placeholder image paths (e.g., images/frontend_add_customer.png) with actual screenshots of your application. Let me know if you need further adjustments!









