Files
Database-FastAPI-Python-Bac…/README.md
2026-02-23 16:42:35 +01:00

74 lines
1.8 KiB
Markdown

# Project Name
Short one-line description of what this project does.
## Tech Stack
- **[FastAPI](https://fastapi.tiangolo.com/)** — Python REST API framework
- **[PostgreSQL](https://www.postgresql.org/)** — Relational database
- **[SQLAlchemy](https://www.sqlalchemy.org/)** — Async database connection layer
- **[Docker](https://www.docker.com/) / Docker Compose** — Containerized development environment
## Project Structure
```
project/
├──Create.sql — Database schema and seed data
├──docker-compose.yml
├──Dockerfile
├──requirements.txt
├──.env — Local environment variables (not committed)
└──app/
├── main.py — App entry point, router registration
├── config.py — Environment variable configuration
├── database.py — Database connection and session
└── routers/
├── init.py
└── example.py — Route definitions
```
## Getting Started
### Prerequisites
- [Docker](https://docs.docker.com/get-docker/) installed
- [Docker Compose](https://docs.docker.com/compose/) installed
### Setup
Create a .env file in the root directory:
```text
postgres_user=exampleUser
postgres_password=examplePasswd
postgres_db=exampleDB
db_port=5432
api_port=8000
```
Start the stack:
```bash
docker compose up --build
```
The API will be available at http://localhost:8000.
Interactive API docs are at http://localhost:8000/docs.
Resetting the Database
If you need to reinitialize the database (e.g. after changing Create.sql):
```bash
docker compose down
rm -rf ./postgresData
docker compose up --build
```
⚠️ This will delete all data.
Do not run in production.
```Notes
The database schema is managed via Create.sql — no ORM migrations
The .env file is excluded from version control via .gitignore
```