What Is the Primary Programming Language Used in lfnovo/open-notebook?
The lfnovo/open-notebook repository employs a dual-language stack, using Python 3.11+ for the backend AI services and TypeScript for the React/Next.js frontend.
The open-notebook project is a full-stack AI application that combines server-side intelligence with a modern web interface. While the repository contains substantial code in both Python and TypeScript, the architecture clearly delineates responsibilities: Python handles data-intensive AI workflows via FastAPI, while TypeScript delivers reactive user experiences through Next.js 16.
Python Backend Architecture
The server-side logic relies entirely on Python 3.11 or higher, leveraging FastAPI for API endpoints and LangGraph for orchestrating complex AI workflows. This backend stack manages database interactions, AI provider integrations, and all data processing operations according to the lfnovo/open-notebook source code.
FastAPI Entry Point
The application bootstrap resides in api/main.py, where the FastAPI instance initializes and registers route handlers. This file serves as the primary entry point for the uvicorn server.
# api/main.py
import uvicorn
from fastapi import FastAPI
app = FastAPI()
# register routers …
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=5055)
LangGraph Workflow Definitions
AI agent workflows and graph-based processing logic are implemented in the open_notebook/graphs/*.py modules. These files define the orchestration patterns that coordinate between language models, tools, and memory systems using Python’s async capabilities.
Database Layer
Data persistence is handled through Python adapters located in open_notebook/database/*.py. These modules provide abstraction layers for storing notebooks, notes, and conversation history, ensuring consistent data access patterns across the application.
TypeScript Frontend Implementation
The user-facing interface lives under the frontend/ directory and is built with Next.js 16, utilizing TypeScript for type-safe component development. This stack handles client-side state management, API communication, and reactive UI updates as implemented in lfnovo/open-notebook.
Next.js Application Shell
The root page component in frontend/src/app/page.tsx demonstrates the TypeScript implementation patterns used throughout the client application. All components, hooks, and utilities are written in TypeScript to ensure compile-time safety and enhanced IDE support.
State Management with Zustand
Client-side state is managed using Zustand stores defined in frontend/src/lib/stores/*.ts. These TypeScript files create type-safe state containers that handle notebook selection, UI preferences, and temporary editing states.
API Client Utilities
Communication with the Python backend is facilitated through TypeScript utilities in frontend/src/lib/api/*.ts. These modules provide typed axios instances and data fetching functions that consume the FastAPI endpoints.
// frontend/src/lib/api/notebooks.ts
import axios from "axios";
export async function listNotebooks() {
const resp = await axios.get("/api/notebooks");
return resp.data; // array of Notebook objects
}
Summary
- Python 3.11+ powers the backend, handling AI workflows through FastAPI and LangGraph in modules like
api/main.pyandopen_notebook/graphs/*.py. - TypeScript drives the Next.js 16 frontend, providing type-safe components in
frontend/src/app/page.tsxand state management via Zustand stores infrontend/src/lib/stores/*.ts. - The repository follows a clean separation of concerns: Python manages data-intensive AI operations while TypeScript handles browser-based interactivity.
Frequently Asked Questions
Is Python the only language used in lfnovo/open-notebook?
No, the project uses both Python and TypeScript. While Python handles the backend AI services and API layer, TypeScript is used exclusively for the React/Next.js frontend implementation.
What version of Python does open-notebook require?
The project requires Python 3.11 or higher, as specified in the backend configuration and dependency files. This version ensures compatibility with modern async features and type hints used throughout the FastAPI application.
Why does open-notebook use TypeScript instead of JavaScript for the frontend?
The frontend uses TypeScript to provide compile-time type checking and enhanced developer experience when interacting with complex state management libraries like Zustand and API clients. This choice aligns with Next.js 16 best practices and ensures type safety across the client-server boundary.
Where is the backend entry point located in the open-notebook repository?
The backend entry point is located at api/main.py in the repository root. This file initializes the FastAPI application and starts the uvicorn server on port 5055, serving as the primary launch point for the Python server stack.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →