Jump to content

From Jupyter Notebook to SaaS Dashboard: My Workflow

From JOHNWICK

Learn how to transform Jupyter notebooks into a real SaaS dashboard using Python, FastAPI, and modern frontend tools. A practical developer workflow explained.


Why This Workflow Matters We’ve all been there:

  • Start with a Jupyter notebook.
  • Load some data.
  • Build a chart.
  • Someone says: “Can you put this into a dashboard so the team can use it?”

Suddenly, your quick notebook needs to become a production SaaS dashboard. I’ve had to do this many times, and I’ve developed a repeatable workflow that moves from prototype → backend → dashboard without rewriting everything.


1. Start in Jupyter (Exploration Phase) I begin with exploratory analysis in Jupyter using Pandas/Polars and Plotly/Matplotlib. Example:

import pandas as pd
import plotly.express as px

# Load data
df = pd.read_csv("users.csv")
# Quick exploration
summary = df.groupby("country")["user_id"].count().reset_index()
# Chart
fig = px.bar(summary, x="country", y="user_id", title="Users by Country")
fig.show()

👉 The goal here isn’t production code — it’s finding insights.


2. Clean Up into Reusable Functions Once I know what analysis is valuable, I refactor the notebook into functions.

# analysis.py
import pandas as pd

def load_data(path="users.csv"):
    return pd.read_csv(path)
def summarize_users_by_country(df: pd.DataFrame):
    return df.groupby("country")["user_id"].count().reset_index()

👉 This step makes it portable beyond Jupyter.


3. Expose the Analysis with FastAPI Next, I wrap my functions with a FastAPI backend.

# app.py
from fastapi import FastAPI
from analysis import load_data, summarize_users_by_country

app = FastAPI()
@app.get("/summary")
def get_summary():
    df = load_data()
    summary = summarize_users_by_country(df)
    return summary.to_dict(orient="records")

Run it:

uvicorn app:app --reload

👉 Now my notebook logic is accessible via an API endpoint.


4. Build the Dashboard Frontend I prefer Quasar (Vue) or React + Tailwind for dashboards. Example (React + Chart.js):

import { useEffect, useState } from "react";
import { Bar } from "react-chartjs-2";

export default function Dashboard() {
  const [data, setData] = useState([]);
  useEffect(() => {
    fetch("/summary")
      .then(res => res.json())
      .then(setData);
  }, []);
  const chartData = {
    labels: data.map(d => d.country),
    datasets: [
      {
        label: "Users",
        data: data.map(d => d.user_id),
        backgroundColor: "rgba(54, 162, 235, 0.6)",
      }
    ]
  };
  return <Bar data={chartData} />;
}

👉 This pulls live API data into a frontend chart.


5. Deploy as a SaaS For deployment, I use:

  • Backend → FastAPI + Docker → fly.io / AWS / Render
  • Frontend → React/Quasar → Vercel/Netlify
  • Database → Postgres or DuckDB (depending on size)

Pipeline looks like this: [Jupyter] → [Python Functions] → [FastAPI Backend] → [React Dashboard] → [Cloud Deployment]


6. Authentication & Multi-Tenancy To make it “SaaS,” add:

  • Auth → JWT / Supabase Auth
  • DB per tenant → Postgres schemas or row-level security
  • Background jobs → BullMQ / Celery

FastAPI auth snippet:

from fastapi import Depends, HTTPException

def get_current_user(token: str):
    if token != "secret123":
        raise HTTPException(status_code=401, detail="Invalid token")
    return {"user_id": 1}


7. Lessons Learned

  • Don’t over-engineer early: Start with notebooks, move fast.
  • Refactor into functions: Bridges the gap between research and production.
  • APIs > copy-paste: Expose results via an API instead of hardcoding in frontend.
  • Keep the stack lightweight: Pandas/Polars + FastAPI + React/Quasar covers 90% of SaaS dashboards.


Conclusion Moving from Jupyter → SaaS dashboard doesn’t have to be painful. The key is to gradually evolve your work:

  • Notebook for exploration
  • Functions for reusability
  • API for integration
  • Frontend for visualization
  • Deployment for SaaS

This workflow has saved me from rewriting the same analysis three times, and it scales from side projects to production SaaS apps. 👉 If you’re stuck with notebooks that need to become real apps, try this workflow — you’ll ship faster.

Read the full article here: https://medium.com/@kaushalsinh73/from-jupyter-notebook-to-saas-dashboard-my-workflow-73711a0cd631