Skip to content

Commit 86fe917

Browse files
authored
Update README.md (#2)
1 parent d05bcb5 commit 86fe917

File tree

1 file changed

+46
-31
lines changed

1 file changed

+46
-31
lines changed

README.md

Lines changed: 46 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,80 @@
11
# AWS API Example
22

3-
Welcome to my `aws_api_example` repository! This is where I showcase my approach to API creation, focusing on robustness, thoroughness, and adherence to industry standards. I've designed it to serve as a practical demonstration of my coding philosophy, prioritizing scalability, cost-effectiveness, and a high degree of professionalism.
3+
Welcome to the `aws_api_example` repository! This repository serves as a showcase for my approach to API creation, with a keen focus on robustness, thoroughness, and adherence to industry standards. It stands as a practical demonstration of my coding philosophy, where scalability, cost-effectiveness, and superior code quality take center stage.
44

55
## My Approach
66

7-
1. **Comprehensive Documentation**: I stick to OpenAPI 3.0 standards to ensure that my API documentation is thorough and up-to-date. Furthermore, I integrate Swagger UI to provide a user-friendly, interactive documentation interface, enhancing understandability and ease-of-use of the API.
7+
1. **Scalable and Cost-Effective Server Infrastructure**: I employ Infrastructure-as-Code (IaC) principles when designing the server infrastructure, striking a balance between scalability and cost-effectiveness. The resulting server setup is repeatable, scalable, and resource-efficient.
88

9-
2. **Modular, Production-Ready Code**: I design my code to be both modular and production-ready, making it robust, reusable, and simple to maintain. This allows for easy updates and readiness for production deployment.
9+
2. **Microservices Architecture**: I ensure each module in the codebase remains independent and easy to update, test, and deploy separately. This is achieved by the thoughtful segregation of features and infrastructure into separate AWS SAM templates. These templates are nested together for efficient, seamless deployment.
1010

11-
3. **In-Depth Testing**: I employ a comprehensive suite of both unit and integration tests to ensure the reliability of my codebase. My testing protocols ensure that individual components function as expected, and that their interactions are well coordinated.
11+
3. **Comprehensive Testing**: My codebase is fortified by a comprehensive suite of both unit and integration (local and smoke) tests. This approach confirms that individual components function as expected, and their interactions are well-coordinated.
1212

13-
4. **Scalable and Cost-Effective Server Infrastructure**: I utilize Infrastructure-as-Code (IaC) principles in designing my server infrastructure, balancing scalability with cost-effectiveness. The result is a server set-up that is repeatable, scalable, and efficient in terms of resource utilization.
14-
15-
5. **Microservices Architecture**: I make use of a microservices architecture to ensure that each module in my codebase is independent, easy to update, and deployable separately. This provides my code with the flexibility and scalability necessary for modern application development.
13+
4. **Comprehensive Documentation**: I adhere to OpenAPI 3.0 standards for thorough and up-to-date API documentation. Additionally, I integrate Swagger Hosted UI to provide a user-friendly, interactive documentation interface, enhancing API understandability and usability.
1614

1715
## How to Get Started
1816

1917
Before diving in, you might want to familiarize yourself with the general structure of the project. I've arranged the repository for easy navigation, whether you're looking to explore the code, consult the documentation, or run tests.
2018

21-
I welcome any feedback or contributions you might have. If you spot something that could be improved or have any questions, feel free to submit an issue or a pull request. I'm always looking to improve and learn. Enjoy exploring my code!
19+
## AWS Infrastructure
2220

23-
## Code Quality
21+
This example project breaks down the infrastructure into two microservices:
2422

25-
### Setting Up Pre-commit Hooks
23+
1. **API** (supporting different versions for a future-proof project structure). The API follows OpenAPI 3.0.1 standards.
24+
2. **Docs** - An S3-hosted static website serving API documentation. It employs Swagger Hosted UI to automate documentation generation.
2625

27-
To ensure code quality, run tests, and check for issues before each commit, I use pre-commit to manage pre-commit hooks.
26+
The infrastructure is orchestrated using nested AWS SAM templates, defining the infrastructure in its entirety. This infrastructure-as-code approach streamlines the creation (and eventual destruction) of the required AWS infrastructure with two straightforward commands: `sam build` and `sam deploy`. It's notably designed for a pipeline that accommodates multiple environments, adhering to AWS SAM best practices.
2827

29-
Here's how to install and set up the pre-commit hooks:
28+
## CI/CD (using GitHub Actions)
3029

31-
### Install pre-commit
30+
- **Upload API docs** (`upload_docs`): This action updates the API documentation hosted in the `docs` subdomain.
31+
- **Local integration tests** (`local_integration_tests`): This action initiates `sam local start-api` and tests all endpoints, ensuring the code functions correctly before deployment.
3232

33-
You can install pre-commit with pip:
33+
## Code Quality: Setting Up Pre-commit Hooks
3434

35-
```bash
36-
pip install pre-commit
37-
```
35+
This project uses `pre-commit` to ensure high code quality. This framework manages pre-commit hooks that run tests and check for issues before each commit, catching potential issues early.
3836

39-
Pre-commit hooks are configured in the `.pre-commit-config.yaml` file in the root of the repository. The following hooks are included:
37+
### Installation and Setup
4038

41-
1. Black: A code formatter for Python.
42-
2. Flake8: A Python tool that glues together pep8, PyFlakes, and Ned Batchelder’s McCabe script.
43-
3. isort: A Python utility to sort imports.
44-
4. mypy: An optional static type checker for Python.
45-
5. Pytest: Runs tests using pytest.
39+
1. **Install pre-commit**: This can be achieved using pip, as shown below:
4640

47-
### Install the git hook scripts
41+
```bash
42+
pip install pre-commit
43+
```
4844

49-
Run this command to install the git hook scripts:
45+
2. **Configure pre-commit hooks**: The configuration for pre-commit hooks is stored in the `.pre-commit-config.yaml` file, located in the root of the repository. The hooks included in this project are:
5046

51-
```bash
52-
pre-commit install
53-
```
47+
- **Black**: A Python code formatter.
48+
- **Flake8**: A Python tool that bundles pep8, PyFlakes, and Ned Batchelder’s McCabe script for code linting.
49+
- **isort**: A utility to sort Python imports.
50+
- **mypy**: An optional static type checker for Python.
51+
- **Pytest**: Runs tests using the pytest framework.
52+
53+
3. **Install git hook scripts**: The following command installs the git hook scripts:
5454

55-
Now, when new changes are committed, the pre-commit hooks will automatically format the code and check for issues.
55+
```bash
56+
pre-commit install
57+
```
58+
59+
Upon successful installation, these pre-commit hooks will automatically format the code and check for issues each time a new commit is made, ensuring code quality and consistency throughout the development process.
5660

5761
## Testing
5862

59-
Make sure to run this command to add project root into PYTHONPATH to simplify module import.
63+
This project implements a two-fold testing approach: unit testing and integration testing, all facilitated by `pytest`.
64+
65+
- **Unit Testing**: These tests are responsible for verifying the correctness of individual code units, such as functions or methods.
66+
- **Integration Testing**: This project conducts two types of integration tests:
67+
1. **Local Integration Tests**: Performed on the locally hosted API, these tests aim to catch and rectify any issues before code deployment.
68+
2. **Deployment Integration Tests**: Run post-deployment, these tests ensure the deployed code operates as expected in the production environment.
69+
70+
Before running the tests, it's crucial to add the project's root directory to the `PYTHONPATH`. This simplifies the module import process. You can do this with the following command:
6071

6172
```bash
6273
export PYTHONPATH="$PYTHONPATH:$(pwd)"
6374
```
6475

65-
When writing tests I focus on normal cases, error cases, and edge cases to create a well-rounded set of tests for the lambda functions.
76+
Test cases are carefully designed to cover normal, error, and edge cases. This thorough approach ensures a well-rounded test suite for the lambda functions.
77+
78+
## Contributions and Feedback
79+
80+
Your feedback and contributions are always appreciated. If you notice areas for improvement, have any queries, or wish to contribute, feel free to submit an issue or a pull request. Continuous learning and improvement are core to this project. Enjoy exploring the code!

0 commit comments

Comments
 (0)