Skip to content

kevinandersontech/subscription-billing-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Subscriptions and Billing API

A FastAPI service that provides subscription and billing functionality. It includes authentication, CRUD operations, background tasks, and a Postgres + Redis backend.

Features

  • JWT authentication for secure access
  • CRUD operations for users and subscriptions
  • Billing simulation with Celery workers
  • Postgres database with SQLAlchemy and Alembic migrations
  • Redis for task queue management
  • REST API with interactive docs at /docs
  • Unit tests with pytest

Quick Start

cp .env.example .env
docker compose up --build

Once running, open http://localhost:8000/docs to explore the API.

Configuration

Environment variables are defined in .env. Key settings include:

  • POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB
  • REDIS_URL
  • SECRET_KEY

Project Structure

  • app/ — FastAPI application code
  • migrations/ — Alembic migration files
  • tests/ — Unit tests
  • docker-compose.yml — Services for API, Postgres, Redis, and worker

Development

Run tests inside the container with:

docker compose run --rm api pytest

Notes

This project is intended as a portfolio example and starting point. It can be extended with real payment provider integration or additional features.

About

A REST API built with FastAPI + SQLAlchemy + PostgreSQL + Redis + background workers. It supports user authentication, subscription and billing CRUD operations, and includes database migrations and interactive API docs.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors