Skip to content

aarya095/Contact-Manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

201 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ—‚οΈ Contact Manager API

FastAPI-based contact manager API with PostgreSQL, featuring CRUD operation and encrypted data handling.

🚧 Project Status: In Progress

πŸ“Œ Navigate

Features

  • 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/
  • πŸ” 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

Tech Stack

  • 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

Project Structure

.
β”œβ”€β”€ 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

Setup Instructions

  1. Clone the repository:
  • git clone https://github.com/aarya095/Contact-Manager.git
  • cd Contact-Manager
  1. Create a virtual environment:
  • python -m venv venv
  • source venv/bin/activate # Linux/macOS
  • venv\Scripts\activate # Windows
  1. Install dependencies:
  • pip install -r docs/requirements.txt
  1. Create .env.dev file:
  • add DATABASE_URL = 'sqlite:///dev.db'
  1. Run the server:
  • uvicorn app.main:app --reload
  1. Open in browser:

Project Evolution

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

About

FastAPI-based contact manager API with PostgreSQL, featuring CRUD operation and encrypted data handling.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages