FastAPI-based contact manager API with PostgreSQL, featuring CRUD operation and encrypted data handling.
- CRUD API
- Create Contact: Adds a new contact
POST /contacts
- Get a single contact: Retrieves the contact number of a single contact by name
GET /contacts/{name}
- Get all contacts data: Retrieves all the encrypted contact numbers from the Database, decrypts them all, and returns them
GET /contacts
- Update contact entry: Updates an existing contact in the database, updates the encryption key
PUT /contacts/
- Delete contact entry: Deletes an existing contact in the database, cleans the encryption key
DELETE /contacts/
- Create Contact: Adds a new contact
- π Encryption
- Contact numbers are encrypted using Fernet (symmetric encryption)
- Key securely stored in .env file
- Keys are generated, updated, and deleted as per the operation
- βοΈ Architecture
- Database layer
- Business logic layer
- API layer
- π API Documentation
- Documented using Bruno (local-first API client)
- πΏ Git Workflow
- Feature-based branching
- Separate branches for debugging and enhancements
- Programming Language: Python
- Web Framework: FastAPI
- Database: PostgreSQL and SQLite for development/testing
- ORM: SQLAlchemy
- Encryption: Fernet (cryptography)
- Validation: Pydantic
- Version Control: Git
- API Testing: Bruno
.
βββ app
β βββ database
β β βββ database.py
β β βββ db_operations.py
β β βββ models.py
β βββ exceptions.py
β βββ __init__.py
β βββ main.py
β βββ routes.py
β βββ schemas.py
β βββ services
β βββ encryption.py
β βββ file_operations.py
β βββ operations.py
βββ dev.db
βββ docs
β βββ contact_manager_api(1).png
β βββ Contact Manager API testing
β β βββ Create Contact.yml
β β βββ Delete contact entry.yml
β β βββ Get all contacts stored in the database.yml
β β βββ Get a single contact entry by name.yml
β β βββ opencollection.yml
β β βββ Update contact entry.yml
β βββ contact_manager_design.drawio
β βββ README.md
β βββ requirements.txt
βββ modules
βββ tests
βββ test_api.py
βββ test_encryption.py
- Clone the repository:
git clone https://github.com/aarya095/Contact-Manager.gitcd Contact-Manager
- Create a virtual environment:
python -m venv venvsource venv/bin/activate# Linux/macOSvenv\Scripts\activate# Windows
- Install dependencies:
pip install -r docs/requirements.txt
- Create
.env.devfile:
- add
DATABASE_URL = 'sqlite:///dev.db'
- Run the server:
uvicorn app.main:app --reload
- Open in browser:
This project originally started as a CLI-based Contact Manager application.
You can find the CLI version in the cli branch:
https://github.com/aarya095/Contact-Manager/tree/menu-driven-cli
Author: Aarya Sarfare