62 lines
1.8 KiB
Markdown
62 lines
1.8 KiB
Markdown
# Omukk FastAPI Template
|
|
|
|
Template repository for all FastAPI backend projects developed by Omukk.
|
|
|
|
## Components
|
|
- Basic FastAPI dependencies
|
|
- MongoDB with Beanie ODM for database operations
|
|
- Docker and Docker Compose for easier testing
|
|
- Initial codebase to start from
|
|
|
|
## Using this template
|
|
|
|
1. **Create a new repository from this template**:
|
|
- In Omukk Repos, navigate to [this repository](https://git.omukk.dev/pptx704/fastapi-template)
|
|
- Click the "Use this template" button at the top of the page
|
|
- Choose "Create a new repository"
|
|
- Fill in your new repository details and click "Create Repository"
|
|
|
|
2. **Clone your new repository**:
|
|
```bash
|
|
git clone git@git.omukk.dev/<username>/<repo>.git
|
|
cd <repo>
|
|
```
|
|
|
|
## Development and Testing
|
|
|
|
1. **Install dependencies**:
|
|
```
|
|
poetry install
|
|
poetry run pre-commit install
|
|
```
|
|
|
|
2. **Set up environment variables**:
|
|
Create a `.env` file using the `.env.example` file as a reference.
|
|
|
|
3. **Run database server**:
|
|
```bash
|
|
docker compose up db -d
|
|
```
|
|
|
|
4. **Run Dev Server**:
|
|
```bash
|
|
docker compose up backend --build
|
|
```
|
|
|
|
5. **Stop Database Server**:
|
|
```bash
|
|
docker compose down db
|
|
```
|
|
|
|
## Development Rules
|
|
- Create a separate branch from `dev` and create a PR to `dev` after making changes
|
|
- Branch names must be meaningful. Check [docs](https://docs.omukk.dev/doc/repos-bvFEDvytPz) for more details
|
|
- Always run `black` and `isort` to maintain code consistency (this is done automatically using pre-commit hooks)-
|
|
```bash
|
|
poetry run isort app main.py
|
|
poetry run black app main.py
|
|
# Make sure to run isort first
|
|
```
|
|
|
|
- Use static type checking using `mypy` if you feel like it (It is recommended but not mandatory). Static type checking might help you to identify critical bugs.
|