Skip to content

Commit a51941e

Browse files
Update README.md
1 parent 9c17780 commit a51941e

File tree

1 file changed

+135
-0
lines changed

1 file changed

+135
-0
lines changed

README.md

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,48 @@ The above listed technologies are just the main ones. There are other technologi
4343

4444
My choice for a project development worklow is usually the [Trunk-Based Development](https://trunkbaseddevelopment.com/) because of the straight forward approach in the collaboration workflow, hence the name `trunk` for the main branch repository instead of `master` or `main`.
4545

46+
## What Code is included?
47+
48+
For the backend application:
49+
* The project, linter, and test configurations in `backend/pyproject.toml`.
50+
* 3 settings classes (development, staging, production) with the super class in `backend/src/config/settings/base.py`.
51+
* Event logger in `backend/src/config/events.py`.
52+
* The `Account` object table model in `backend/src/models/tables/account.py`.
53+
* The `Account` object schema model in `backend/src/models/schemas/account.py`.
54+
* PostgreSQL database via asynchronous SQLAlchemy 2.0 in `backend/src/repository/database`.
55+
* Database-related events e.g. databse table registration by app startup in `backend/src/repository/events.py`.
56+
* C. R. U. D. methods for `Account` object in `backend/src/repository/crud/account.py`.
57+
* Table classes registration file in `backend/src/repository/base.py`.
58+
* Alembic setup for auto generating asynchronous database migrations in `backend/src/repository/migration/**`.
59+
* Alembic main configuration file in `backend/alembic.ini`.
60+
* Dependency injection for database session and repository in `backend/src/api/**`.
61+
* API endpoints for `Account` signup and signin in `backend/src/api/routes/authentication.py`.
62+
* API endpoints for `Account` get all, get 1, update, and delete in `backend/src/api/routes/account.py`.
63+
* API endpoints registration file in `backend/src/api/endpoints`.
64+
* Password hashing, JWT for authorization, and simple verification functions in `backend/src/securities/**`.
65+
* Helper functions, string messages, and error handling in `backend/src/utilities/**`.
66+
* A comprehensive FastAPI application initialization in `backend/src/main.py`.
67+
68+
For testing I have prepared the following simple code to kick start your test-driven development:
69+
* A simple replication of the backend application for testing purposes and the asynchronous test client in `backend/tests/conftest.py`.
70+
* 2 simple test functions to test the backend application initialization in `tests/unit_tests/test_src.py`.
71+
72+
For the DevOps:
73+
* A simple `build` job to test the compilation of the source code for the backend application in `.github/workflows/ci-backend.yaml`.
74+
* A simple linting job called `code-style` with black, isort, flake8, and mypy in `.github/workflows/ci-backend.yaml`.
75+
* An automated testing with `PyTest` and an automated test reporting with `Codecov` in in `.github/workflows/ci-backend.yaml`.
76+
* A source code responsibility distribution file in `.github/CODEOWNERS` (Please change the username into your own).
77+
* A `YAML` file for an automated semantic commit message.
78+
79+
For containerization:
80+
* A `Docker` configuration that utilizes the latest Python image in `backend/Dockerfile`.
81+
* A script that ensure the backend application will restart when postgres image hasn't started yet in `backend/entrypoint.sh`.
82+
* Setting up `Postgres` image for our database server, `Adminer` for our database editor, and `backend_app` for our backend application's container in `docker-compose.yaml`.
83+
84+
For the team development environment:
85+
* A pre-commit hooks for `Black`, `Isort`, and `MyPy` to ensure the conventional commit message before pushing an updated code into the remote repository.
86+
* All secret variables are listed in `.env.example`.
87+
4688
## Setup Guide
4789

4890
This backend application is setup with `Docker`. Nevertheless, you can see the full local setup without `Docker` in [backend/README.md](https://github.com/Aeternalis-Ingenium/FastAPI-Backend-Template/blob/trunk/backend/README.md).
@@ -130,6 +172,99 @@ This backend application is setup with `Docker`. Nevertheless, you can see the f
130172
**IMPORTANT**: Without the secrets registered in Codecov and GitHub, your `CI` will fail and life will be horrible 🤮🤬
131173
**IMPORTANT**: Remember to always run the container update every once in a while. Without the arguments `-d --build`, your `Docker` dashboard will be full of junk containers!
132174
175+
## Project Structure
176+
177+
```shell
178+
.github/
179+
├── workflows/
180+
├── ci-backend.yaml # A CI file for the backend app that consits of `build`, `code-style`, and `test`
181+
├── CODEOWNERS # A configuration file to distribute code responsibility
182+
├── semantic.yaml # A configuration file for ensuring an automated semantic commit message
183+
184+
backend/
185+
├── coverage/
186+
├── src/
187+
├── api/
188+
├── dependencies/ # Dependency injections
189+
├── session.py
190+
├──repository.py
191+
├── routes/ # Endpoints
192+
├── account.py # Account routes
193+
├── authentication.py # Signup and Signin routes
194+
├── endpoints.py # Endpoint registration
195+
├── config/
196+
├── settings/
197+
├── base.py # Base settings / settings parent class
198+
├── development.py # Development settings
199+
├── environments.py # Enum with PROD, DEV, STAGE environment
200+
├── production.py # Production settings
201+
├── staging.py # Test settings
202+
├── events.py # Registration of global events
203+
├── manager.py # Manage get settings
204+
├── models/
205+
├── domains/
206+
├── account.py # Account class for database entity
207+
├── schemas/
208+
├── account.py # Account classes for data validation objects
209+
├── base.py # Base class for data validation objects
210+
├── repository/
211+
├── crud/
212+
├── account.py # C. R. U. D. operations for Account entity
213+
├── base.py # Base class for C. R. U. D. operations
214+
├── migrations/
215+
├── versions/
216+
├── env.py # Generated via alembic for automigration
217+
├── script.py.mako # Generated via alembic
218+
├── base.py # Entry point for alembic automigration
219+
├── database.py # Database class with engine and session
220+
├── events.py # Registration of database events
221+
├── table.py # Custom SQLAlchemy Base class
222+
├── security/
223+
├── hashing/
224+
├── hash.py # Hash functions with passlib
225+
├── password.py # Password generator with hash functions
226+
├── authorizations/
227+
├── jwt.py # Generate JWT tokens with python-jose
228+
├── verifications/
229+
├── credentials.py # Check for attributes' availability
230+
├── utilities/
231+
├── exceptions/
232+
├── http/
233+
├── http_exc_400.py # Custom 400 error handling functions
234+
├── http_exc_401.py # Custom 401 error handling functions
235+
├── http_exc_403.py # Custom 403 error handling functions
236+
├── http_exc_404.py # Custom 404 error handling functions
237+
├── database.py # Custom `Exception` class
238+
├── password.py # Custom `Exception` class
239+
├── formatters/
240+
├── datetime_formatter.py # Reformat datetime into the ISO form
241+
├── field_formatter.py # Reformat snake_case to camelCase
242+
├── messages/
243+
├── http/
244+
├── http_exc_details.py # Custom message for HTTP exceptions
245+
├── main.py # Our main backend server app
246+
├── tests/
247+
├── end_to_end_tests/ # End-to-end tests
248+
├── integration_tests/ # Integration tests
249+
├── security_tests/ # Security-related tests
250+
├── unit_tests/ # Unit tests
251+
├── test_src.py # Testing the src directory's version
252+
├── conftest.py # The fixture codes and other base test codes
253+
├── Dockerfile # Docker cpnfiguration file for backend application
254+
├── README.md # Documentaiton for backend app
255+
├── entrypoint.sh # A script to restart backend app container if postgres is not started
256+
├── alembic.ini # Automatic databse migration configuration
257+
├── pyproject.toml # Linter and test main configuration file
258+
├── requirements.txt # Packages installed for backend app
259+
.dockerignore # A file that list files to be excluded in Docker container
260+
.gitignore # A file that list files to be excluded in GitHub repository
261+
.pre-commit-config.yaml # A file with Python linter hooks to ensure conventional commit when committing
262+
LICENSE.md # A license to use this template repository (delete this file after using this repository)
263+
README.md # The main documnetation file for this template repository
264+
codecov.yaml # The configuration file for automated testing CI with codecov.io
265+
docker-compose.yaml # The main configuration file for setting up a multi-container Docker
266+
```
267+
133268
## Final Step
134269
135270
You can delete these 3 files (or change its content based on your need):

0 commit comments

Comments
 (0)