Sign inSign up

procoder588/mlcore

By procoder588

โ€ขUpdated 5 months ago

A self-hosted machine learning platform. Github: ` https://github.com/Amanbig/MLCore`

Image
Languages & frameworks
Developer tools
Data science
1

1.3K

procoder588/mlcore repository overview

โ ML Core

A self-hosted machine learning platform โ€” upload datasets, wrangle data, train models, run predictions, download trained models, and monitor everything from a Grafana-style dashboard.

One Docker image. One port. No extra services.

License: MIT Python 3.10+ Node.js 18+ Docker Pulls


โ Preview

Light ModeDark Mode
Light ModeDark Mode

โ Features

  • ๐Ÿ“ Dataset management โ€” upload CSV / Excel files, version datasets, explore stats, wrangle (normalise, encode, drop nulls)
  • ๐Ÿ“Š Rich statistics โ€” per-column descriptive stats (count, mean, std, quartiles) + Pearson correlation heatmap
  • ๐Ÿค– Model training โ€” train scikit-learn models (classifiers & regressors) with configurable hyperparameters loaded live from the library
  • ๐Ÿ” Retraining & versioning โ€” retrain any model to create a new version with full lineage tracking
  • ๐Ÿงช In-browser testing โ€” run single-row predictions directly from the UI (Sheet sidebar, not a blocking dialog)
  • โฌ‡๏ธ Model download โ€” download trained .joblib files for use outside the platform
  • ๐Ÿ“ˆ Dashboard โ€” live stats: model count, dataset count, accuracy distribution, storage usage
  • ๐ŸŒ™ Dark / Light / System theme
  • ๐Ÿ” JWT authentication โ€” cookie-based, HTTPOnly
  • ๐Ÿ›ก๏ธ Deployment controls โ€” disable public signup + seed a default admin via environment variables

โ Quick Start โ€” Docker

# Docker Hub
docker run -d \
  -p 8000:8000 \
  -v mlcore-db:/data \
  -v mlcore-uploads:/app/server/uploads \
  --name mlcore \
  procoder588/mlcore:latest

# GitHub Container Registry
docker run -d \
  -p 8000:8000 \
  -v mlcore-db:/data \
  -v mlcore-uploads:/app/server/uploads \
  --name mlcore \
  ghcr.io/Amanbig/mlcore:latest

Open http://localhost:8000โ  โ€” UI and API both served from the same port.

โ Environment Variables

All variables are optional โ€” the defaults work immediately. Pass them with -e to docker run or in a docker-compose.yml.

VariableDefaultDescription
JWT_SECRETdevelopmentSet this to a secret value in production
DISABLE_SIGNUPFalseTrue to hide the Sign Up tab and block the endpoint
DEFAULT_ADMIN_EMAIL(none)Auto-create an admin on first boot
DEFAULT_ADMIN_PASSWORD(none)Password for the auto-created admin

Example with a locked-down admin-only instance:

docker run -d \
  -p 8000:8000 \
  -v mlcore-db:/data \
  -v mlcore-uploads:/app/server/uploads \
  -e JWT_SECRET=my-super-secret \
  -e DISABLE_SIGNUP=True \
  -e [email protected] \
  -e DEFAULT_ADMIN_PASSWORD=StrongP@ssw0rd! \
  --name mlcore \
  procoder588/mlcore:latest
โ Volumes
VolumePath in containerPurpose
mlcore-db/dataSQLite database โ€” isolated from server code
mlcore-uploads/app/server/uploadsDatasets + model files

โ Development Setup

โ Prerequisites
ToolVersionInstall
Pythonโ‰ฅ 3.10python.orgโ 
uvlatestsee below
Node.jsโ‰ฅ 18nodejs.orgโ 
โ Install uv (Python package manager)
# Windows (PowerShell)
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

# macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

โ 1 โ€” Server
cd server

# Install dependencies into an auto-managed .venv
uv sync

# Start with hot-reload
uv run dev        # โ†’ http://localhost:8000

Interactive API docs: http://localhost:8000/docsโ 


โ 2 โ€” Client
cd client

# Install dependencies
npm install

# Start dev server (proxies /api/* โ†’ :8000 automatically)
npm run dev       # โ†’ http://localhost:5173

โ Running both together

Open two terminals:

terminal 1 โ†’ cd server && uv run dev
terminal 2 โ†’ cd client && npm run dev

The Vite proxy handles CORS โ€” no extra config needed.


โ Building a Docker Image Locally

# From the repo root
docker build -t mlcore:local .
docker run -d -p 8000:8000 --name mlcore mlcore:local

The Dockerfile is multi-stage:

  1. node:22-alpine โ€” builds the Vite client (npm run build)
  2. python:3.13-slim โ€” installs the server with uv, copies the client build into server/static/

โ CI / CD

Two workflow files in .github/workflows/:

push to main
    โ”‚
    โ”œโ”€โ–บ lint.yml      โ€” ruff (Python) + biome + tsc (TypeScript)
    โ”‚                   runs on every push and PR
    โ”‚
    โ””โ”€โ–บ release.yml   โ€” full pipeline:
            โ”‚
            โ”œโ”€ lint-server  (ruff)      โ”€โ”
            โ”œโ”€ lint-client  (biome)      โ”œโ”€ parallel
            โ”œโ”€ typecheck    (tsc)       โ”€โ”˜
            โ”‚
            โ”œโ”€ version  โ†’ reads version from pyproject.toml
            โ”‚             creates git tag v<X.Y.Z> if new
            โ”‚
            โ”œโ”€ build-and-push โ†’ builds Docker image
            โ”‚                   pushes to DockerHub + GHCR
            โ”‚
            โ””โ”€ github-release โ†’ creates GitHub Release page
                                 with auto-generated changelog
                                 + Docker pull instructions
โ Releasing a New Version
  1. Bump version in server/pyproject.toml:
    [project]
    version = "0.2.0"
    
  2. Commit and push to main:
    git add server/pyproject.toml
    git commit -m "chore: bump version to 0.2.0"
    git push origin main
    
  3. The workflow automatically:
    • Creates git tag v0.2.0
    • Builds and pushes the Docker image
    • Creates a GitHub Release with changelog
โ Required Secrets

Add these in GitHub โ†’ Settings โ†’ Secrets and variables โ†’ Actions:

SecretDescription
DOCKERHUB_USERNAMEYour Docker Hub username
DOCKERHUB_TOKENDocker Hub โ†’ Account Settings โ†’ Security โ†’ New Access Token (Read & Write)

GITHUB_TOKEN is injected automatically โ€” no setup needed.


โ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                 Docker container                โ”‚
โ”‚                                                 โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚  โ”‚   FastAPI        โ”‚   โ”‚   Vite build        โ”‚ โ”‚
โ”‚  โ”‚   /api/*         โ”‚   โ”‚   served as static  โ”‚ โ”‚
โ”‚  โ”‚                  โ”‚   โ”‚   SPA (index.html   โ”‚ โ”‚
โ”‚  โ”‚  auth, datasets, โ”‚   โ”‚   fallback)         โ”‚ โ”‚
โ”‚  โ”‚  models, stats   โ”‚   โ”‚                     โ”‚ โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚              uvicorn :8000                      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
ConcernDetail
API/api/* โ€” all backend routes
UIEverything else โ†’ SPA fallback to index.html
Datasetsserver/uploads/datasets/
Modelsserver/uploads/models/
DatabaseSQLite โ€” server/mlcore_db.db (mount a volume to persist)
Client (prod)server/static/ โ€” Vite build copied in at Docker build time

โ Repository Structure

MLCore/
โ”œโ”€โ”€ Dockerfile              Multi-stage build (Node โ†’ Python)
โ”œโ”€โ”€ .dockerignore
โ”œโ”€โ”€ Readme.md               โ† you are here
โ”œโ”€โ”€ client/                 Vite + React frontend
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ biome.json          Linter / formatter config
โ”‚   โ”œโ”€โ”€ package.json
โ”‚   โ”œโ”€โ”€ vite.config.ts
โ”‚   โ””โ”€โ”€ README.md
โ””โ”€โ”€ server/                 FastAPI backend
    โ”œโ”€โ”€ src/
    โ”‚   โ”œโ”€โ”€ main.py
    โ”‚   โ””โ”€โ”€ modules/        auth, dataset, file, ml_model, stats, user
    โ”œโ”€โ”€ migrations/         Alembic migrations
    โ”œโ”€โ”€ scripts/            CLI entry points
    โ”œโ”€โ”€ pyproject.toml      Dependencies + ruff config
    โ”œโ”€โ”€ uv.lock
    โ””โ”€โ”€ README.md

โ Further Reading


โ Contributing

Contributions are welcome! Please see the CONTRIBUTING.mdโ  file for guidelines on how to set up the project locally, run tests, and submit pull requests.


โ License

This project is licensed under the MIT Licenseโ .

Tag summary

Content type

Image

Digest

sha256:eb9c6880dโ€ฆ

Size

185.7 MB

Last updated

5 months ago

docker pull procoder588/mlcore