Skip to content

dehyabi/money-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’° Money Manager API

A simple FastAPI backend for managing personal finance data (transactions, categories, balances). Built with FastAPI, PostgreSQL, and Docker.

This repository is intended to be used as a backend API, for example consumed by a Next.js frontend (separate repo).


✨ Features

  • FastAPI (async, fast, modern)
  • PostgreSQL database
  • SQLAlchemy ORM
  • Alembic-ready (migrations)
  • Docker & docker-compose
  • Environment-based configuration
  • Ready for cloud deployment (AWS / Fly.io / Railway)

🧱 Tech Stack

  • Backend: FastAPI
  • Database: PostgreSQL
  • ORM: SQLAlchemy
  • Server: Uvicorn
  • Containerization: Docker, Docker Compose

πŸ“ Project Structure

.
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ main.py          # FastAPI entry point
β”‚   β”œβ”€β”€ database.py      # DB connection & session
β”‚   β”œβ”€β”€ models/          # SQLAlchemy models
β”‚   β”œβ”€β”€ routers/         # API routes
β”‚   └── schemas/         # Pydantic schemas
β”‚
β”œβ”€β”€ docker-compose.yml
β”œβ”€β”€ Dockerfile
β”œβ”€β”€ .env.example
β”œβ”€β”€ .gitignore
└── README.md

βš™οΈ Environment Variables

Create a .env file based on .env.example:

DATABASE_URL=postgresql+psycopg2://postgres:postgres@db:5432/money_manager

⚠️ .env is not committed to GitHub


🐳 Run with Docker (Recommended)

1️⃣ Build & start containers

docker compose up --build

2️⃣ API will be available at

http://localhost:8000

3️⃣ API docs


🐘 Access PostgreSQL

From host:

psql -h localhost -p 5432 -U postgres -d money_manager

From Docker:

docker exec -it money_manager_db psql -U postgres -d money_manager

πŸ”— Frontend Integration (Next.js)

This API is designed to be consumed by a separate Next.js repository.

Example environment variable in Next.js:

NEXT_PUBLIC_API_URL=https://api.yourdomain.com

Example request:

fetch(`${process.env.NEXT_PUBLIC_API_URL}/transactions`)

πŸ”’ CORS Configuration

Make sure CORS is enabled in main.py:

from fastapi.middleware.cors import CORSMiddleware

app.add_middleware(
    CORSMiddleware,
    allow_origins=["*"] ,
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)

Restrict origins in production.


πŸš€ Deployment Options

  • Cheapest: AWS EC2 + Docker
  • Managed: Fly.io / Railway / Render
  • Frontend: Vercel (Next.js)

πŸ“Œ Roadmap

  • Authentication (JWT)
  • User accounts
  • Categories & budgets
  • Monthly reports
  • Alembic migrations

πŸ“„ License

MIT License


πŸ‘€ Author

Dehya Qalbi


If you have questions or want to extend this project, feel free to open an issue or PR πŸš€

About

FastAPI + PostgreSQL backend API for a personal money manager app

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors