feat: add README and LICENSE

This commit is contained in:
2025-07-23 03:19:43 +00:00
parent d2d045a89d
commit 3c161bca51
2 changed files with 153 additions and 0 deletions

23
LICENSE Normal file
View File

@@ -0,0 +1,23 @@
FUTO Source Available License 1.0
Copyright (c) [2025] Giovani Rodriguez
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to use, copy, modify, and run the Software for any non-commercial purpose, subject to the following conditions:
1. **Source Availability**: The Software is provided with its source code.
2. **Non-Commercial Use Only**: You may use, copy, modify, and run this Software for personal, educational, research, or internal business operations. Use of the Software, in whole or in part, for any commercial purpose is not permitted under this license. Commercial use includes, but is not limited to:
- Selling or offering to sell the Software or derivative works
- Using the Software to provide paid services to third parties
- Including the Software in any product or service that is sold or offered for sale
3. **Derivative Works**: You may create derivative works of the Software and distribute them under this same license, with proper attribution to the original authors.
4. **No Trademark Rights**: This license does not grant you rights to use the names, logos, or trademarks of the copyright holder or contributors.
5. **Disclaimer of Warranty**: THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
6. **Limitation of Liability**: IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
For commercial licensing, please contact the copyright holder.

130
README.md Normal file
View File

@@ -0,0 +1,130 @@
# minxa.lol URL Shortener
minxa.lol is a lightweight and efficient URL shortening service built with **FastAPI**, **SQLAlchemy**, and **Hashids**. It converts long URLs into short, shareable codes and provides redirection to the original URLs.
---
## Features
* 🔗 Shorten URLs into unique shortcodes
* 🚀 Redirect to original URLs using the shortcode
* ✅ Validates shortcode format
* 🛠 Built with modern async Python stack
* 🧂 Configurable encoding via `hashids`
---
## Tech Stack
* FastAPI
* SQLAlchemy (async + sync)
* PostgreSQL
* Hashids
* Alembic (for migrations)
* Pydantic / Pydantic Settings
* Uvicorn (ASGI server)
---
## Getting Started
### 1. Clone the repository
```bash
git clone https://github.com/yourusername/minxa.git
cd minxa
```
### 2. Create and configure your environment file
Copy the example file and update it with your local settings:
```bash
cp .env.example .env
```
Required variables in `.env`:
```env
DATABASE_URL=postgresql+asyncpg://user:password@localhost:5432/minxa
ENVIRONMENT=dev
HASHIDS_SALT=your-secret-salt
ENCODER_ALPHABET=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890
```
### 3. Install dependencies
```bash
pip install -r requirements.txt
```
### 4. Run the application
```bash
uvicorn app.main:app --reload
```
---
## API Endpoints
### `POST /`
Create a new shortened URL.
**Request Body:**
```json
{
"url": "https://example.com"
}
```
**Response:**
```json
{
"shortcode": "abc123",
"url": "https://example.com"
}
```
---
### `GET /{shortcode}`
Redirects to the original URL associated with the given shortcode.
**Example:**
```bash
curl -v http://localhost:8000/abc123
```
Returns a `302` redirect to the original URL.
---
## Project Structure
```
app/
├── main.py # FastAPI entry point
├── config.py # Environment and settings
├── database.py # Database setup
├── models/ # SQLAlchemy models
├── routes/ # API endpoints
├── services/ # URL logic
├── schemas/ # Pydantic schemas
├── utils/ # Encoder logic using hashids
├── exceptions.py # Custom exceptions
```
---
## Development Notes
* Database tables auto-create in development mode
* Encoder uses Hashids for deterministic, unique shortcodes
* Uses `pydantic` for validation and FastAPI's dependency injection
* Alembic is available for database migrations