Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/seandearnaley/code-diagram-generator
Tool to scan a python based repo and outline a text based report used for LLMs
https://github.com/seandearnaley/code-diagram-generator
chatgpt fastapi gpt llm nextjs python typescript
Last synced: 4 months ago
JSON representation
Tool to scan a python based repo and outline a text based report used for LLMs
- Host: GitHub
- URL: https://github.com/seandearnaley/code-diagram-generator
- Owner: seandearnaley
- License: mit
- Created: 2023-06-08T07:26:18.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-19T23:15:05.000Z (12 months ago)
- Last Synced: 2024-02-20T00:27:19.307Z (12 months ago)
- Topics: chatgpt, fastapi, gpt, llm, nextjs, python, typescript
- Language: Python
- Homepage:
- Size: 1.36 MB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Code Diagram Generator
This monorepo contains a code diagram generator application built using FastAPI on the backend and Next.js 13/Tailwind CSS on the frontend.
![Code Diagram Generator](fullcapture.png?raw=true)
## Table of Contents
- [Folder Structure](#folder-structure)
- [Installation](#installation)
- [Running the Application](#running-the-application)
- [Backend (FastAPI)](#backend-fastapi)
- [Routes](#routes)
- [Services](#services)
- [Frontend (Next.js)](#frontend-nextjs)
- [Components](#components)
- [Hooks](#hooks)
- [Styles](#styles)
- [Docker Compose](#docker-compose)
- [License](#license)## Folder Structure
The folder structure of this monorepo is organized as follows:
```
code-diagram-generator/
|-- fastapi/
| |-- ...
|-- nextjs/
| |-- ...
|-- docker-compose.yml
|-- LICENSE
|-- README.md
```- `fastapi/`: Contains the FastAPI backend application code.
- `nextjs/`: Contains the Next.js frontend application code.
- `docker-compose.yml`: Configuration for running the FastAPI and Next.js services together using Docker Compose.
- `LICENSE`: License information for the application.
- `README.md`: This readme file.## Installation
I recommend running `docker-compose up` to run the application. Make sure you set your repo path in the root .env (rename .env.example) If you want to run the application locally, follow these steps:
1. Clone this repository to your local machine.
2. Navigate to the `fastapi/` directory and set up the FastAPI backend. (change your env.example)
3. Navigate to the `nextjs/` directory and set up the Next.js frontend. (install etc.)
4. Configure Docker Compose if you want to run the services using Docker containers.configure diagrams here:
fastapi/app/config/diagram_config.json
modify the directive template (it doesn't need all the examples):
fastapi/app/templates/generate_diagram_instructions_08112023.txt
## Running the Application
To run the application locally, follow these steps:
1. Start the FastAPI backend:
- Navigate to the `fastapi/` directory.
- Install the Python dependencies using `poetry install`.
- Run the FastAPI server using `uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload`.2. Start the Next.js frontend:
- Navigate to the `nextjs/` directory.
- Install the Node.js dependencies using `pnpm install`.
- Run the Next.js development server using `pnpm run dev`.3. Access the application:
- The FastAPI backend will be running at `http://localhost:8000`.
- The Next.js frontend will be accessible at `http://localhost:3000`.## Backend (FastAPI)
### Routes
The FastAPI backend includes the following route modules:
- `diagram_generation_routes.py`: Routes for generating code diagrams.
- `diagram_routes.py`: Routes related to diagram configurations.
- `directory_analysis_routes.py`: Routes for analyzing source code directories.
- `llm_routes.py`: Routes for interacting with language models.
- `mermaid_routes.py`: Routes for generating Mermaid diagrams.### Services
The backend services are organized as follows:
- `diagram_service.py`: Services for handling diagrams and categories.
- `directory_analysis_service.py`: Services for analyzing source code directories.
- `llm_service.py`: Services for interacting with language models.
- `mermaid_service.py`: Services for generating Mermaid diagrams.
- `utils/`: Utility functions used across services.## Frontend (Next.js)
The Next.js frontend includes the following:
### Components
The frontend is built using various React components, including:
- `components/`: Reusable UI components used in the application.
- `config/`: Configuration data for forms and components.
- `hooks/`: Custom hooks used to manage state and functionality.
- `lib/`: Utility functions and helper scripts.
- `styles/`: Global styles and CSS configuration.
- `types/`: TypeScript type definitions used throughout the frontend.### Hooks
Custom hooks are used to manage state and functionality. Some notable hooks include:
- `useDesignDirectives.ts`: Hook for managing design directives.
- `useGitIgnore.ts`: Hook for managing Gitignore patterns.
- `useLocalStorage.ts`: Hook for managing local storage data.### Styles
The global styles are defined in `styles/globals.css`. Tailwind CSS is used for styling components.
## Docker Compose
The `docker-compose.yml` file defines services for both the FastAPI backend and the Next.js frontend. It allows you to run both services together using Docker containers.
To run the application using Docker Compose:
1. Make sure you have Docker installed.
2. Open a terminal and navigate to the root of the project directory.
3. Run the command `docker-compose up` to start both services.
4. Access the application:
- The FastAPI backend will be accessible at `http://localhost:8000`.
- The Next.js frontend will be accessible at `http://localhost:3000`.## License
This application is open-source and distributed under the [LICENSE](LICENSE) file included in this repository.
---
This README provides an overview of the folder structure, installation, running the application, backend and frontend components, and Docker Compose setup. For more detailed information, refer to the respective code files and documentation in each directory.