81 lines
2.2 KiB
Markdown
81 lines
2.2 KiB
Markdown
# Profile Linker API
|
|
|
|
This is a FastAPI backend for the Profile Linker application. It provides API endpoints for managing a list of people's profiles.
|
|
|
|
## Project Structure
|
|
|
|
The project follows a modular structure:
|
|
|
|
```
|
|
backend/
|
|
├── app/
|
|
│ ├── api/ # API endpoints
|
|
│ │ ├── endpoints/ # API endpoint modules
|
|
│ │ └── api.py # API router
|
|
│ ├── core/ # Core application components
|
|
│ │ └── config.py # Application settings
|
|
│ ├── crud/ # CRUD operations
|
|
│ │ └── person.py # Person CRUD operations
|
|
│ ├── db/ # Database components
|
|
│ │ ├── base.py # Database base
|
|
│ │ ├── base_class.py # Base class for database models
|
|
│ │ └── session.py # Database session
|
|
│ ├── models/ # Database models
|
|
│ │ └── person.py # Person model
|
|
│ ├── schemas/ # Pydantic schemas
|
|
│ │ └── person.py # Person schemas
|
|
│ └── main.py # FastAPI application
|
|
├── main.py # Entry point
|
|
└── requirements.txt # Python dependencies
|
|
```
|
|
|
|
## API Endpoints
|
|
|
|
The API provides the following endpoints:
|
|
|
|
- `GET /api/people`: Get all people
|
|
- `POST /api/people`: Create a new person
|
|
|
|
## Development
|
|
|
|
### Prerequisites
|
|
|
|
- Python 3.11+
|
|
- Docker and Docker Compose
|
|
|
|
### Running the Application
|
|
|
|
#### Using Docker Compose
|
|
|
|
1. Build and start the containers:
|
|
|
|
```bash
|
|
docker-compose up --build
|
|
```
|
|
|
|
2. Access the API at http://localhost:8080/api
|
|
3. Access the API documentation at http://localhost:8080/docs
|
|
|
|
#### Running Locally
|
|
|
|
1. Install dependencies:
|
|
|
|
```bash
|
|
cd backend
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
2. Run the application:
|
|
|
|
```bash
|
|
cd backend
|
|
python main.py
|
|
```
|
|
|
|
3. Access the API at http://localhost:8080/api
|
|
4. Access the API documentation at http://localhost:8080/docs
|
|
|
|
## Frontend Integration
|
|
|
|
The backend serves the frontend as static assets. The frontend should be built and placed in the `dist` directory. The Docker setup handles this automatically.
|