# Novodraft **Version:** 0.3.0 (end - January, 2023) **Original Development:** 0.0.1 (January, 2022) Novodraft: a web application that uses Artificial Intelligence (AI) to automate the drafting of legal discovery documents in civil litigation. Written in [JavaScript](https://262.ecma-international.org/6.0/) and [Python](https://www.python.org/) using [React](https://react.dev/) for the UI, with [Node.js](https://nodejs.org/) and [Express.js](https://expressjs.com/) on the backend. License: [GPL Version 3](https://opensource.org/license/gpl-3-0). Novodraft was intended for use by attorneys and legal professionals handling civil litigation, particularly those who draft discovery documents such as interrogatories, requests for production, and requests for admissions. The application automates discovery drafting, allowing attorneys to focus on tailoring substantive legal arguments as they see fit. ## Features Novodraft generates both outgoing discovery requests and responses to incoming requests. The application: - Accepts [PDF](https://en.wikipedia.org/wiki/PDF) uploads of incoming discovery requests - Parses and classifies document types (interrogatories, requests for production, requests for admissions, or combined formats) - Uses the [OpenAI](https://openai.com/) [Application Programming Interface (API)](https://en.wikipedia.org/wiki/API) to generate legally-sound objections and responses - Applies [Conclusion, Rule, Application, Conclusion (CRAC)](https://en.wikipedia.org/wiki/CRAC) structure where appropriate - Formats output documents according to state-specific court styles (New York, New Jersey, Florida, Michigan) - Exports completed documents as [.docx](https://en.wikipedia.org/wiki/Office_Open_XML) files ready for service on opposing counsel ## Architecture This is a client-server monorepo: ``` Novodraft/ ├── ax3Client/ # React frontend application └── ax3Services/ # Node.js/Python backend services (incl. LLM API) ``` ### Frontend (ax3Client) - A [React](https://react.dev/) 18 single-page application using: - [React Router](https://reactrouter.com/) for navigation - [React Bootstrap](https://react-bootstrap.github.io/) for [User Interface (UI)](https://en.wikipedia.org/wiki/User_interface) components - [Firebase](https://firebase.google.com/) Authentication for user management - [Stripe](https://stripe.com/) for subscription payments - [SCSS](https://sass-lang.com/) for styling ### Backend (ax3Services) A collection of [Node.js](https://nodejs.org/) and [Python](https://www.python.org/) services: - **docGenService**: Generates formatted [.docx](https://en.wikipedia.org/wiki/Office_Open_XML) documents using the [python-docx](https://python-docx.readthedocs.io/) library - **docParserService**: Parses and classifies uploaded discovery documents - **docConvertService**: Converts PDFs to processable formats - **tesseReaderService**: Performs [Optical Character Recognition (OCR)](https://en.wikipedia.org/wiki/Optical_character_recognition) using [Tesseract.js](https://tesseract.projectnaptha.com/) - **agentService**: Manages [OpenAI](https://openai.com/) API interactions and prompt templates - **paymentService**: Handles [Stripe](https://stripe.com/) payment processing - **storageService**: Manages document storage operations ## Getting Started ### Prerequisites Install the following on your system: **For Debian/Ubuntu:** ```bash sudo apt-get update sudo apt-get install -y nodejs npm python3 python3-pip ``` **For macOS (using [Homebrew](https://brew.sh/)):** ```bash brew install node python3 ``` Verify installations: ```bash node --version # Should be v18.x or higher npm --version # Should be v9.x or higher python3 --version # Should be v3.8 or higher ``` ### Installation 1. Clone the repository: ```bash git clone cd Novodraft ``` 1. Install frontend dependencies: ```bash cd ax3Client npm install ``` 1. Install backend dependencies: ```bash cd ../ax3Services npm install pip3 install python-docx ``` 1. Configure environment variables. Create `.env` files in both `ax3Client/` and `ax3Services/` directories with the following variables: **ax3Client/.env:** ``` REACT_APP_API_DEV=http://localhost:3001 REACT_APP_API_PROD= REACT_APP_FIREBASE_API_KEY= REACT_APP_FIREBASE_AUTH_DOMAIN= REACT_APP_FIREBASE_PROJECT_ID= ``` **ax3Services/.env:** ``` OPENAI_API_KEY= STRIPE_SECRET_KEY= ``` 1. Configure [Firebase](https://firebase.google.com/). Create a Firebase project and enable: - Authentication (Email/Password) - Cloud Firestore ### Running the Application Start the frontend development server: ```bash cd ax3Client npm start ``` The frontend will be available at `http://localhost:3000`. Start the backend services: ```bash cd ax3Services npm start ``` ### Building for Production ```bash cd ax3Client npm run build ``` The production build will be output to `ax3Client/build/`. ## Supported Document Types Novodraft handles the following discovery document types: | Type | Description | | ----------------------- | ------------------------------------------- | | Interrogatories | Written questions requiring sworn answers | | Requests for Production | Demands for documents and tangible evidence | | Requests for Admissions | Requests to admit or deny specific facts | | Combined/Numbered | Documents containing multiple request types | ## State-Specific Formatting The document generation service applies jurisdiction-specific caption headers and formatting for: - New York - New Jersey - Florida - Michigan ## Versioning This project uses [Semantic Versioning (SemVer)](https://semver.org/). Version numbers follow the format MAJOR.MINOR.PATCH: - MAJOR: Incompatible API changes - MINOR: Backwards-compatible functionality additions - PATCH: Backwards-compatible bug fixes ## Background This project began in 2021 as an early experiment with [Large Language Model (LLM)](https://en.wikipedia.org/wiki/Large_language_model) technology to automate the creation of discovery documents in civil litigation. The version in this repository represents work completed through January 2023. The codebase was migrated from [GitHub](https://github.com/) to a self-hosted [Gitea](https://about.gitea.com/) instance. ## Participation ### Contributing Contributions are welcome, but be aware this project has largely been abandoned since 2023. The project maintainers make no guarantee that submitted pull requests will be merged. To contribute: 1. Fork the repository 2. Create a feature branch 3. Make your changes 4. Submit a pull request Bug reports should be submitted via Git issues. No Contributor License Agreement (CLA) is required. ### Code of Conduct Contributors are expected to: - Contribute in a spirit that seeks to improve society and human well-being - Avoid harm - Be honest and trustworthy - Respect the work required to produce new ideas, inventions, creative works, and computing artifacts - Respect privacy - Be fair and do not discriminate - Create code that promotes these principles ### Privacy Novodraft does not transmit user activity data off of the device on which it is run beyond what is necessary for the core functionality (authentication, payment processing, and AI document generation). ## Authors - sj — [sj@sjdev.co](mailto:sj@sjdev.co) ## License This project is licensed under the [GNU General Public License Version 3](https://opensource.org/license/gpl-3-0). See the LICENSE file for details.