A modern web application that demonstrates the integration of machine learning models with FastAPI backend and Vue frontend. The project includes multiple ML models for different purposes including comment analysis, rain prediction, and Titanic survival prediction.
- FastAPI backend with multiple ML model endpoints
- Modern Vue.js frontend with TypeScript
- Docker containerization for easy deployment
- UV for Python dependency management
- PNPM for frontend package management
- SQLite database for data persistence
.
├── app/ # Backend FastAPI application
│ ├── api/ # API endpoints
│ ├── comment_analyser/ # Comment analysis ML model
│ ├── rain_predictor/ # Rain prediction ML model
│ ├── titanic_predictor/ # Titanic survival prediction model
│ ├── main.py # FastAPI application entry point
│ ├── db.py # Database configuration
│ └── config.py # Application configuration
├── client/ # Frontend Vue.js application
│ ├── src/ # Source code
│ ├── dist/ # Production build output
│ └── public/ # Static assets
└── docker-compose.yml # Docker compose configuration
- Python 3.8+
- Node.js 16+
- Docker and Docker Compose
- UV (Python package manager)
- PNPM (Node.js package manager)
-
Install UV:
curl -LsSf https://astral.sh/uv/install.sh | sh -
Install backend dependencies:
uv sync
-
Start the backend development server:
fastapi dev app/main.py
For production:
uv run fastapi run app/main.py
-
In a new terminal, set up the frontend:
cd client pnpm install pnpm dev
The application will now be running with:
- Backend API at: http://localhost:8000
- Frontend at: http://localhost:5173
-
Build the frontend:
cd client pnpm install pnpm buildThis will create a production build in the
client/distdirectory. -
Set the environment variable:
export ENVIRONMENT=production -
Start the production server:
fastapi run app/main.py
In production mode, the FastAPI server will serve the static frontend content from the built dist directory, making the application available at:
- Build and run with Docker Compose:
docker-compose up --build
Once the server is running, you can access:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
Create a .env file in the root directory with the following variables:
DATABASE_URL=sqlite:///./database.db
ENVIRONMENT=development # or 'production' to serve static frontend
- Fork the repository
- Create a new branch
- Make your changes
- Submit a pull request
This project is licensed under the MIT License.