Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

<br>

This is a template repository aimed to kick start your project with a setup from a real-world application! This template utilizes the following tech-stack:
This is a template repository aimed to kick-start your project with a setup from a real-world application! This template utilizes the following tech stack:

* 🐳 [Dockerized](https://www.docker.com/)
* 🐘 [Asynchronous PostgreSQL](https://www.postgresql.org/docs/current/libpq-async.html)
Expand All @@ -51,24 +51,24 @@ Well, the easy answer is **Asynchronousity** and **Speed**!

## Other Technologies

The above listed technologies are just the main ones. There are other technologies utilized in this project template to ensure that your application is robust and provides the best-possible development environment for your team! These technologies are:
The above-listed technologies are just the main ones. There are other technologies utilized in this project template to ensure that your application is robust and provides the best possible development environment for your team! These technologies are:

* [TOML](https://toml.io/en/) $\rightarrow$ The one-for-all configuration file. This makes it simpler to setup our project.
* [Pyenv](https://github.com/pyenv/pyenv) $\rightarrow$ The simplest way to manage our Python versions.
* [Pyenv-VirtualEnv](https://github.com/pyenv/pyenv-virtualenv) $\rightarrow$ The plugin for `Pyenv` to manage the virtual environment for our packages.
* [Pre-Commit](https://pre-commit.com/) $\rightarrow$ Git hook scripts to identify issues and quality of your code before pushing it to GitHub. These hooks are implemented for the following linting pakcages:
* [Black (Python)](https://black.readthedocs.io/en/stable/) $\rightarrow$ Manage your code style with auto formatting and parallel continuous integration runner for Python.
* [Pre-Commit](https://pre-commit.com/) $\rightarrow$ Git hook scripts to identify issues and quality of your code before pushing it to GitHub. These hooks are implemented for the following linting packages:
* [Black (Python)](https://black.readthedocs.io/en/stable/) $\rightarrow$ Manage your code style with auto-formatting and parallel continuous integration runner for Python.
* [Isort (Python)](https://pycqa.github.io/isort/) $\rightarrow$ Sort your `import` for clarity. Also for Python.
* [MyPy (Python)](https://mypy.readthedocs.io/en/stable/) $\rightarrow$ A static type checker for Python that helps you write a cleaner code.
* [MyPy (Python)](https://mypy.readthedocs.io/en/stable/) $\rightarrow$ A static type checker for Python that helps you to write cleaner code.
* [Pre-Commit CI](https://pre-commit.ci/) $\rightarrow$ Continuous integration for our Pre-Commit hook that fixes and updates our hook versions.
* [CodeCov](https://about.codecov.io/) $\rightarrow$ A platform that analyze the result of your automated tests.
* [CodeCov](https://about.codecov.io/) $\rightarrow$ A platform that analyzes the result of your automated tests.
* [PyTest](https://docs.pytest.org/en/7.2.x/) $\rightarrow$ The testing framework for Python code.
* [DBDiagram](https://dbdiagram.io/home) $\rightarrow$ A platform that lets your design your database by writing SQL and converting it into ERD. This platform provides a complete symbol for entity relationships (not like many other platforms!).
* [GitHub Actions](https://github.com/features/actions) $\rightarrow$ The platform to setup our CI/CD by GitHub.
* [SQLAlchemy 2.0](https://docs.sqlalchemy.org/en/20/orm/extensions/asyncio.html) $\rightarrow$ The go-to database interface library for Python. The 2.0 is the most recent update where it provides asynchronous setup.
* [CODEOWNERS](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners) $\rightarrow$ A file for distributing the responsibilities in our project to each team/team mate.
* [SQLAlchemy 2.0](https://docs.sqlalchemy.org/en/20/orm/extensions/asyncio.html) $\rightarrow$ The go-to database interface library for Python. The 2.0 is the most recent update where it provides an asynchronous setup.
* [CODEOWNERS](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners) $\rightarrow$ A file for distributing the responsibilities in our project to each team/teammate.

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`.
My choice for a project development workflow is usually the [Trunk-Based Development](https://trunkbaseddevelopment.com/) because of the straightforward approach in the collaboration workflow, hence the name `trunk` for the main branch repository instead of `master` or `main`.

## What Code is included?

Expand All @@ -84,7 +84,7 @@ For the backend application:
* Database-related events e.g. database table registration by app startup in `backend/src/repository/events.py`.
* C. R. U. D. methods for `Account` object in `backend/src/repository/crud/account.py`.
* Table classes registration file in `backend/src/repository/base.py`.
* Alembic setup for auto generating asynchronous database migrations in `backend/src/repository/migration/**`.
* Alembic setup for auto-generating asynchronous database migrations in `backend/src/repository/migration/**`.
* Alembic main configuration file in `backend/alembic.ini`.
* Dependency injection for database session and repository in `backend/src/api/**`.
* API endpoints for `Account` signup and signin in `backend/src/api/routes/authentication.py`.
Expand All @@ -94,15 +94,15 @@ For the backend application:
* Helper functions, string messages, and error handling in `backend/src/utilities/**`.
* A comprehensive FastAPI application initialization in `backend/src/main.py`.

For testing I have prepared the following simple code to kick start your test-driven development:
For testing, I have prepared the following simple code to kick-start your test-driven development:
* A simple replication of the backend application for testing purposes and the asynchronous test client in `backend/tests/conftest.py`.
* 2 simple test functions to test the backend application initialization in `tests/unit_tests/test_src.py`.

For the DevOps:
* A simple `build` job to test the compilation of the source code for the backend application in `.github/workflows/ci-backend.yaml`.
* A simple linting job called `code-style` with black, isort, flake8, and mypy in `.github/workflows/ci-backend.yaml`.
* An automated testing with `PyTest` and an automated test reporting with `Codecov` in in `.github/workflows/ci-backend.yaml`.
* A source code responsibility distribution file in `.github/CODEOWNERS` (Please change the username into your own).
* A source code responsibility distribution file in `.github/CODEOWNERS` (Please change the username to your own).
* A `YAML` file for an automated semantic commit message in `.github/workflows/ci-backend.yaml`.
* An automated test report monitoring via `Codecov` in `codecov.yaml`
* A CI for automatically updating all linter version in the pre-commit `YAML` file in `.pre-commit-config.YAML`.
Expand All @@ -114,7 +114,7 @@ For containerization:

For the team development environment:
* A pre-commit hooks for `Black`, `Isort`, and `MyPy` to ensure the conventional commit message before pushing an updated code into the remote repository in `.pre-commit-config.YAML`.
* All secret variables are listed in `.env.example`. You need to copy these variables and set the values respectively to yoour need and save them in a new `.env` in the the root directory.
* All secret variables are listed in `.env.example`. You need to copy these variables and set the values respectively to your need and save them in a new `.env` in the root directory.

## Setup Guide

Expand Down Expand Up @@ -156,9 +156,9 @@ This backend application is setup with `Docker`. Nevertheless, you can see the f
```

5. Backend app credentials setup:
If you are not used to VIM or Linux CLI, then ignore the `echo` command and do it manually. All the secret variables for this template is located in `.env.example`.
If you are not used to VIM or Linux CLI, then ignore the `echo` command and do it manually. All the secret variables for this template are located in `.env.example`.

If you want to have another names for the secret variables, don't forget to change them also in:
If you want to have another name for the secret variables, don't forget to change them also in:

* `backend/src/config/base.py`
* `docker-compose.yaml`
Expand All @@ -171,7 +171,7 @@ This backend application is setup with `Docker`. Nevertheless, you can see the f
```

6. `CODEOWNERS` setup:
Go to `.github/` and open `CODEOWNERS` file. This file is to assign the code to specific team member so you can distribute the weights of the project clearly.
Go to `.github/` and open `CODEOWNERS` file. This file is to assign the code to a specific team member so you can distribute the weights of the project clearly.

7. Docker setup:
```shell
Expand Down Expand Up @@ -281,7 +281,7 @@ backend/
├── unit_tests/ # Unit tests
├── test_src.py # Testing the src directory's version
├── conftest.py # The fixture codes and other base test codes
├── Dockerfile # Docker cpnfiguration file for backend application
├── Dockerfile # Docker configuration file for backend application
├── README.md # Documentation for backend app
├── entrypoint.sh # A script to restart backend app container if postgres is not started
├── alembic.ini # Automatic database migration configuration
Expand Down