# Insurance System API A comprehensive API for managing insurance policies, customers, and claims built with FastAPI and SQLite. ## Features - User authentication and authorization with JWT tokens - CRUD operations for customers, policies, and claims - Comprehensive database models with relationships - API documentation with Swagger UI and ReDoc - SQLite database with Alembic migrations ## Requirements - Python 3.8+ - SQLite ## Environment Variables The application uses the following environment variables: - `SECRET_KEY`: JWT secret key (default: "supersecretkey") - `ACCESS_TOKEN_EXPIRE_MINUTES`: JWT token expiration time in minutes (default: 30) ## Installation 1. Clone the repository: ```bash git clone cd insurance-system-api ``` 2. Create a virtual environment: ```bash python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate ``` 3. Install dependencies: ```bash pip install -r requirements.txt ``` 4. Run database migrations: ```bash alembic upgrade head ``` ## Running the Application Start the application with: ```bash uvicorn main:app --reload ``` The API will be available at http://localhost:8000. - API documentation: http://localhost:8000/docs - Alternative API documentation: http://localhost:8000/redoc - OpenAPI schema: http://localhost:8000/openapi.json ## API Endpoints ### Authentication - `POST /api/v1/auth/register`: Register a new user - `POST /api/v1/auth/token`: Login and get access token - `GET /api/v1/auth/me`: Get current user information ### Customers - `GET /api/v1/customers`: Get all customers - `POST /api/v1/customers`: Create a new customer - `GET /api/v1/customers/{customer_id}`: Get a specific customer - `PUT /api/v1/customers/{customer_id}`: Update a customer - `DELETE /api/v1/customers/{customer_id}`: Delete a customer ### Policies - `GET /api/v1/policies`: Get all policies - `POST /api/v1/policies`: Create a new policy - `GET /api/v1/policies/{policy_id}`: Get a specific policy - `PUT /api/v1/policies/{policy_id}`: Update a policy - `DELETE /api/v1/policies/{policy_id}`: Delete a policy ### Claims - `GET /api/v1/claims`: Get all claims - `POST /api/v1/claims`: Create a new claim - `GET /api/v1/claims/{claim_id}`: Get a specific claim - `PUT /api/v1/claims/{claim_id}`: Update a claim - `DELETE /api/v1/claims/{claim_id}`: Delete a claim ## Database Schema The application uses the following database models: - `User`: Authentication and system users - `Customer`: Insurance customers - `Policy`: Insurance policies - `Claim`: Insurance claims ## License This project is licensed under the MIT License - see the LICENSE file for details.