https://github.com/davidjnevin/template-python-fastapi-docker-postgres
A hexagonal architecture template repository for Python, FastAPI, PostgreSQL with settings that suit my new project needs.
https://github.com/davidjnevin/template-python-fastapi-docker-postgres
docker fastapi flit hexagonal-architecture postgresql python
Last synced: 2 months ago
JSON representation
A hexagonal architecture template repository for Python, FastAPI, PostgreSQL with settings that suit my new project needs.
- Host: GitHub
- URL: https://github.com/davidjnevin/template-python-fastapi-docker-postgres
- Owner: davidjnevin
- License: mit
- Created: 2024-01-26T13:02:09.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-31T13:05:37.000Z (over 2 years ago)
- Last Synced: 2024-12-31T02:23:56.103Z (over 1 year ago)
- Topics: docker, fastapi, flit, hexagonal-architecture, postgresql, python
- Language: Makefile
- Homepage:
- Size: 39.1 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# A Hexagonal Quickstart Template
This is python, fastapi, postgres and docker quickstart template for Hexagonal Architecture projects.
This is an ongoing work in progress and is based on [Shako Rzayev's](https://github.com/ShahriyarR) hexagonal architecture repositories combined with [Python Alicante's](https://github.com/pythonalicante) meetup selector repository for docker setup.
## Setup
Pull down the files to your empty initialized repo.
Unzip the files and delete the repo.zip file.
Copy the files to the root of your repo.
Delete the downloaded repo.zip file and the unzipped subfolder.
```
curl -sL https://github.com/davidjnevin/template-python-fastapi-docker-postgres/archive/master.zip -o repo.zip
unzip repo.zip
cp -r template-python-fastapi-docker-postgres-main/ .
rm -rf template-python-fastapi-docker-postgres-main
```
### Update the App Name to a project name of your choice
Update the repo url in `pyproject.toml`.
Change 'appname' and description in `src/appname/__init__.py`
Change 'appname' folder to the project name.
Change 'appname' to the project name in:
1. `MakeFile` (migrations, migrate and run commands)
1. `pyproject.toml`
## Usage:
Install pre-commit
```bash
pre-commit install
```
Create and then edit the .env file
```bash
cp example.env .env
```
### Review the make comands avaialble
```bash
make help
```
For local development
```bash
make setup && make install-dev
```
Start Docker container - neccessary for testing
```
make build
```
Note: I am using a requirements.txt and requirements-dev.txt until I understand how to use `Flit` in a docker build. This may change soon, but for the moment neccessitates copying from pyproject to the requirement files.