Skip to content

ahvcxa/SaveLinks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SaveLinks Logo

πŸ”— SaveLinks

FastAPI PostgreSQL Redis Docker Python

SaveLinks is a highly scalable, performant link-saving platform. It is built using modern technologies following Hexagonal Architecture (Ports and Adapters) principles. It features an asynchronous API, automatic metadata extraction (titles, descriptions, etc.), and secure JWT-based authentication.


✨ Features

  • ⚑ Asynchronous API: High-RPS, non-blocking asynchronous endpoints powered by FastAPI.
  • πŸ›οΈ Hexagonal Architecture: Clean structure isolating business logic from databases, frameworks, and external services.
  • πŸ” JWT Authentication: Secure session management and authorization infrastructure.
  • πŸ—„οΈ PostgreSQL: Powerful, relational database managed via SQLAlchemy and asyncpg.
  • πŸš€ Redis: Fast in-memory data store for caching and background operations (like rate-limiting).
  • πŸ€– Automatic Metadata Extraction: Automatically fetches titles, descriptions, and images of saved links using beautifulsoup4 and httpx.
  • πŸ“¦ Docker Support: Easy, isolated setup for the database, Redis, and application via Docker Compose.

πŸ› οΈ Technology Stack

  • Language: Python 3.11+
  • Web Framework: FastAPI
  • Database (ORM): SQLAlchemy 2.0 (Async) + asyncpg
  • Database Migration: Alembic
  • Cache & Queue: Redis
  • Authentication: JWT (python-jose), bcrypt
  • Scraping / Data Fetching: httpx, beautifulsoup4
  • Configuration: Pydantic V2
  • Testing: pytest, pytest-asyncio

πŸš€ Setup & Installation

Follow these steps to set up and run the project in your own environment.

πŸ“‹ Prerequisites

  • Python 3.11 or higher
  • PostgreSQL
  • Redis
  • Docker & Docker Compose (Optional but recommended)

1️⃣ Clone the Repository

git clone https://github.com/ahvcxa/SaveLinks.git
cd SaveLinks

2️⃣ Configure Environment Variables

Copy the example .env file and update it according to your system:

cp .env.example .env

(Default values are generally set for local Docker or local development environments)

3️⃣ Running with Docker (Recommended)

If your project includes a docker-compose.yml, you can start the entire system with a single command:

docker-compose up -d --build

To view the logs:

docker-compose logs -f

4️⃣ Local Development Setup

If you prefer to use databases installed on your local system instead of Docker, ensure the database configurations (URLs) in your .env file are set correctly.

Create a virtual environment and install dependencies:

python -m venv .venv
source .venv/bin/activate  # For Windows: .venv\Scripts\activate
pip install -e ".[dev]"

Initialize database tables (Migration):

alembic upgrade head

Run the application (using Uvicorn):

uvicorn src.main:app --reload

πŸ“š API Documentation

Once the application is running, you can access the automatically generated interactive API documentation:


πŸ—‚οΈ Project Structure

Project files are organized according to Hexagonal Architecture (Clean Architecture) principles.

src/
β”œβ”€β”€ api/             # HTTP Routes, API Controllers (Adapters)
β”‚   └── v1/
β”œβ”€β”€ core/            # Core Business Logic and Domain Rules (Ports and Use Cases)
β”‚   β”œβ”€β”€ link/
β”‚   β”‚   β”œβ”€β”€ domain/
β”‚   β”‚   └── ...
β”‚   └── auth/
β”œβ”€β”€ infrastructure/  # External Dependencies (Database Repositories, Redis, etc.)
β”‚   └── database/
└── main.py          # Application Entry Point (FastAPI App)

🀝 Contributing

  1. Fork the repository.
  2. Create your feature branch (git checkout -b feature/NewFeature).
  3. Commit your changes (git commit -m 'feat: Add some NewFeature').
  4. Push to the branch (git push origin feature/NewFeature).
  5. Open a Pull Request.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors