How samrolken/nokode works
Project type and purpose
• This is a single‐service, AI‐driven backend web server (“nokode”) that implements a CRUD contact manager entirely by deferring every request to a large language model (LLM). There is no traditional application logic—every HTTP request is handled by asking the LLM “what should I do?” and letting it orchestrate three tools (database, webResponse, updateMemory).
File structure
• Top‐level:
• package.json / package-lock.json – Node.js dependencies and scripts
• .env.example – LLM_PROVIDER, API key, model settings
• src/
– config/index.js – central configuration loader
– server.js – starts HTTP server
– middleware/llm-handler.js – core Express‐style middleware that captures incoming requests and invokes the LLM
– tools/
· database.js – runs SQL against SQLite
· webResponse.js – builds HTTP responses (HTML, JSON)
· memory.js – reads/writes feedback to disk
– utils/
· logger.js – logs requests, errors
· prompt-loader.js / memory-loader.js – load prompt templates and memory records
• No frontend code—HTML/JS is generated at runtime by the LLM via webResponse.
Key insights from README
• The LLM is the “app logic.” Three tools define the system boundary.
• The database schema and UI are invented by the model on the fly.
• Every request is ~30–60 s (LLM inference + tool I/O).
• Persistent memory is stored as Markdown for “updateMemory.”
Main components and their relationships
a. External client (Browser or API consumer)
b. HTTP Server (Node.js / Express‐like)
c. LLM Handler middleware
d. LLM Provider (Anthropic Claude API)
e. Tool Interfaces inside Node.js:
– Database tool → SQLite engine on disk
– webResponse tool → HTML/JSON builder
– updateMemory tool → feedback store (Markdown files)
f. Utilities (logger, prompt/memory loaders)
g. Configuration module (env, model, API keys)
Architectural pattern and design principles
• Monolithic, single‐process service
• Plugin pattern for tools: each tool exposes a simple API that the LLM can call
• Middleware pipeline: HTTP request → LLM handler → generateText → tool calls → response
• Separation of concerns: config, middleware, tools, utils all isolated
[ Client ] → [ HTTP Server ] → [ LLM Handler ] → [ LLM Provider ]
↓ ↓
[ Tool Interfaces ] ←――――――
/ | \
[Database] [webResponse] [updateMemory]
↓ ↑
[SQLite DB] [Markdown files]
• Tool calls from the LLM to each tool interface
• Data flow from database back into the response
Detail level
• Every module group: config, middleware, tools, utils.
• Prompt-loader and memory-loader feeding into the LLM handler.
• Environment variables flowing into config.