A simple phonebook application with a FastAPI backend serving an API and a static site. The static site is written in TypeScript 5.3.2 without libraries, using Less.js for styling, and HTML5. The FastAPI API connects to a PostgreSQL database.
-
FastAPI Backend:
- Implements a RESTful API for managing contacts in a phonebook.
- Utilizes FastAPI for efficient and fast development.
-
PostgreSQL Database:
- Stores contact information in a PostgreSQL database for data persistence.
-
Static Site:
- Written in TypeScript 5.3.2 without external libraries.
- Uses Less.js for styling.
- Provides a user-friendly interface for interacting with the phonebook.
- Python 3.x
- PostgreSQL
- Node.js (for TypeScript compilation)
- NPM
- Create form
- Edit phone
- Local host support
-
Clone the repository:
git clone https://github.com/quangle23/postgreSQL-python.git cd postgreSQL-python -
Set up the virtual environment:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install dependencies:
pip install -r requirements.txt
-
Set up the PostgreSQL database:
- Set the credentials on the
.envfile.
- Set the credentials on the
-
Run the FastAPI server:
uvicorn main:app --env-file .\.env -
Compile TypeScript and Less.js for the static site:
cd client npm run build -
Open the static site:
- Open
http://127.0.0.1:8000/in a web browser.
- Open
This project is licensed under the MIT License.