Skip to content

gitwitorg/gitwit-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitWit Codegen Server

This is an ExpressJS server with an API endpoint to make changes to code files while streaming the results. It also handles detecting dependencies, and finding the matching versions for the LLM's knowledge cut-off.

Overview

Prerequisites

Before running the server, ensure you have the following prerequisites installed on your system:

  • Node.js 18.16.1 or compatible version
  • Yarn for managing dependencies

Environment Variables

Before running the server, you need to set the following environment variables:

  • OPENAI_API_KEY: (Required) Your OpenAI API key
  • HELICONE_API_KEY: (Optional) Your Helicone API key
  • CLERK_API_KEY: (Required) Your Clerk API key

Usage as a server

To use, first install dependencies:

yarn install

To run in production mode:

yarn start

To run in development mode:

yarn dev

Testing the API

To run the server without authentication:

TESTING=true yarn dev

Below is an example API call without authentication:

curl 'http://localhost:3001/generate' \
  -H 'content-type: application/json' \
  --data-raw $'{"command":"Add a footer","code":"import React from \'react\'\\n\\nexport default function App() {\\n  return (\\n    <div className=\\"flex justify-center items-center h-screen\\">\\n        <h1 className=\\"font-semibold\\">\\n          Welcome to my app\u0021\\n        </h1>\\n    </div>\\n  )\\n}"}' \
  --compressed

Docker

To run with Docker:

docker build -t gitwit-server .

docker run -d -p 3001:3001 --env-file .env gitwit-server

Usage as a library

First, install gitwit-server in your project using yarn link.

Then, usage is as follows:

import { generateCode } from "gitwit-server";
const { code: newAppDotJS, dependencies } = await generateCode(
  appDotJS,
  prompt
);

This is mainly useful for running evaluations.

About

ExpressJS server for the GitWit React IDE.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published