Local · Private · Fast

Generate code
on your own machine

LocalCodeGen turns your database schema into production-ready CRUD layers, BDO structures, and form definitions — powered by a locally running LLM. No API keys. No data leaves your machine.

Ollama · llama3.1 · 8B
localcodegen — bash
❯
Why LocalCodeGen

Everything runs on your hardware

🔒

Zero Data Egress

Your schema, your code, your models. No cloud connection required. Nothing leaves localhost — ever.

air-gapped ready
⚡

Instant Generation

Generate a full CRUD layer from a PostgreSQL table in under 3 seconds. No round-trips, no rate limits.

avg ~1.8s on M2
🧠

Model Agnostic

Works with any Ollama model — llama3.1, codellama, mistral, phi-3. Swap models per generation type.

ollama compatible
🗃️

Schema-Aware

Reads live PostgreSQL schemas to produce accurate column names, types, nullable constraints, and PKs.

pg · sqlite · mysql
🧩

Pluggable Templates

BDO, CRUD, form fields, route handlers — each is a configurable template you can override or extend.

handlebars · ejs
🔁

Transactional Safety

All batch operations are wrapped in a single transaction. Any failure rolls back the entire generation run.

all-or-nothing
How it works

Three commands from schema to code

STEP 01

Point at your schema

Supply a database connection and table name. LCG inspects column types, constraints, and relationships.

lcg init --db postgres://... --table edu_student
STEP 02

Choose what to generate

Pick from built-in targets: CRUD helpers, BDO config, Express routes, or a full-stack form definition.

lcg generate --ops crud,bdo,routes
STEP 03

Review & integrate

Generated files land in your /src/gen output folder. Review the diff, then import.

lcg apply --dry-run --out ./src/gen
Architecture

How the pieces connect

INPUT

Schema Inspector

Reads live table metadata from your database, then builds a structured schema object for the prompt context.

→
ENGINE

LCG Core

Prompt builder + Ollama adapter. Sends a schema-grounded prompt to your local model and streams the response.

→
OUTPUT

Code Writer

Parses the model response, validates it against the template contract, and writes clean files to your project.

100%
Runs locally
<3s
Avg generation time
6+
Output targets
0
External API calls
Get Started

Your code, your machine, your model

Install LocalCodeGen in under a minute. Requires Node.js 18+ and Ollama with at least one model pulled.

npm install -g @localcodegen/cli
Read the docs View on GitHub