Music Streaming API

A RESTful API for a music streaming service built with FastAPI and SQLite.

Features

  • User authentication (register, login, JWT tokens)
  • Music management (songs, albums, artists)
  • Playlist creation and management
  • Music streaming
  • Search functionality
  • Basic recommendation system

Tech Stack

  • FastAPI: High-performance web framework for building APIs
  • SQLite: Lightweight relational database
  • SQLAlchemy: SQL toolkit and Object-Relational Mapper
  • Alembic: Database migration tool
  • Pydantic: Data validation and settings management
  • JWT: JSON Web Tokens for authentication
  • Uvicorn: ASGI server for hosting the application

Project Structure

/
├── alembic/                  # Database migration scripts
├── app/                      # Application source code
│   ├── api/                  # API endpoints
│   │   └── v1/               # API version 1
│   ├── core/                 # Core modules (config, security)
│   ├── db/                   # Database session and utilities
│   ├── models/               # SQLAlchemy models
│   ├── schemas/              # Pydantic models/schemas
│   ├── services/             # Business logic services
│   └── utils/                # Utility functions
├── storage/                  # Storage for files
│   ├── db/                   # Database files
│   └── media/                # Media files (audio, images)
├── main.py                   # Application entry point
├── alembic.ini               # Alembic configuration
└── requirements.txt          # Python dependencies

Setup and Installation

  1. Clone the repository
  2. Install dependencies:
    pip install -r requirements.txt
    
  3. Set up environment variables (create a .env file in the root directory):
    SECRET_KEY=your-secret-key
    
  4. Run database migrations:
    alembic upgrade head
    
  5. Start the server:
    uvicorn main:app --reload
    

API Documentation

Once the application is running, you can access the API documentation at:

Environment Variables

Variable Description Default
SECRET_KEY Secret key for JWT tokens Auto-generated
ACCESS_TOKEN_EXPIRE_MINUTES Minutes before JWT token expires 11520 (8 days)

License

This project is licensed under the MIT License.

Description
Project: Music Streaming API
Readme 72 KiB
Languages
Python 99.3%
Mako 0.7%