This is a Node.js server that uses the OpenAI API and Accord Project libraries to generate smart legal contracts.
- Clone this repository.
- Run
npm install
to install the necessary packages. - Create a
.env
file in the root directory and add your OpenAI API key like so:OPENAI_API_KEY=your-api-key-here
. - Run
npm start
to start the server.
There are several routes you can use to generate different types of smart legal contracts. The body of the request should be a JSON object with the necessary parameters for each contract type.
If an error occurs during the processing of a request, the server will respond with a status code of 500 and a JSON object with an error
key and a string value describing the error.
The server uses the winston
library for logging. Logs are printed to the console and also saved to error.log
(for error-level logs) and combined.log
(for all logs).
The server uses the dotenv
library to load environment variables from a .env
file. Currently, the only environment variable is OPENAI_API_KEY
, which should be your OpenAI API key.
- Add validation to ensure that requests are in the correct format.
- Add automated tests to catch bugs before they become a problem.
This server is authored by Princeps Polycap.