This project was migrated from Flask to FastAPI to improve performance and provide automatic API documentation.
- Framework: Migrated from Flask to FastAPI
- Main file:
main.py
(previouslyapp.py
) - Documentation: Automatic Swagger UI available at
/docs
- Validation: Pydantic models for data validation
- Performance: Improved performance with FastAPI
- Home page with API documentation
- Sends text message via WhatsApp
- Parameters:
phone
(string, max 22 chars),text
(string, max 800 chars)
- Sends text message via WhatsApp (GET method)
- Parameters:
phone
(string, max 22 chars),text
(string, max 800 chars)
- Sends message with URL via WhatsApp
- Parameters:
phone
(string, max 22 chars),text
(string, max 800 chars)
- Sends message with URL via WhatsApp (GET method)
- Parameters:
phone
(string, max 22 chars),text
(string, max 800 chars)
Access the interactive API documentation (Swagger UI) at /docs
:
Access /docs
to view the interactive API documentation (Swagger UI).
docker compose up --build
pip install -r IaC/flask/requirements.txt
uvicorn main:app --host 0.0.0.0 --port 8000
├── main.py # Main FastAPI application
├── datasource/ # Data modules
├── static/ # Static files
├── templates/ # HTML Templates
├── IaC/flask/ # Docker configurations
│ ├── Dockerfile
│ ├── requirements.txt
│ └── entry_point.sh
└── docker-compose.yml
Configure the following variables in the .env
file:
MONGO_USER
: MongoDB usernameMONGO_PASSWORD
: MongoDB passwordMONGO_DB
: Database nameFASTAPI_PORT
: Application port (default: 8000)FASTAPI_NAME
: Container name (default: fastapi-app)
- Copy the example file:
cp env.example .env
- Edit the
.env
file with your settings:
nano .env
- Run the project:
docker compose up --build
Developed by Victor Luis Santos
LinkedIn