Skip to content

RuphakVarmaa/invoice-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Invoice API

A simple REST API for managing invoices, built with Python and FastAPI.

Tech Stack

  • Backend: FastAPI (Python)
  • Database: PostgreSQL
  • ORM: SQLAlchemy
  • Frontend: HTML, CSS, JavaScript

What I Learned

This project covers the core concepts of web development:

Concept What It Does
REST API GET, POST, PUT, DELETE operations
Database Store data permanently with PostgreSQL
ORM Talk to database using Python (SQLAlchemy)
Frontend Display data and handle user interactions

API Endpoints

Method Endpoint Description
GET /invoices List all invoices
GET /invoices/{id} Get one invoice
POST /invoices Create new invoice
PUT /invoices/{id} Update invoice
DELETE /invoices/{id} Delete invoice

Project Structure

invoice-api/
├── main.py       # API endpoints
├── database.py   # Database connection
├── models.py     # Database tables (SQLAlchemy)
├── schemas.py    # Request/Response shapes (Pydantic)
├── index.html    # Frontend UI
└── README.md

How to Run

  1. Install dependencies:
pip install fastapi uvicorn sqlalchemy psycopg2-binary
  1. Start PostgreSQL and create database:
createdb invoice_db
  1. Run the API:
uvicorn main:app --reload
  1. Open index.html in browser or visit http://localhost:8000/docs

Screenshots

API Docs: http://localhost:8000/docs

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors