Initialize local AI platform project
This commit is contained in:
commit
ed9259d35e
7 changed files with 1814 additions and 0 deletions
45
.gitignore
vendored
Normal file
45
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
|
||||
# Dependencies
|
||||
node_modules/
|
||||
|
||||
# Build output
|
||||
dist/
|
||||
build/
|
||||
coverage/
|
||||
*.tsbuildinfo
|
||||
|
||||
# Environment variables and secrets
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
!.env.test.example
|
||||
|
||||
# Logs
|
||||
logs/
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
# Test and tool caches
|
||||
.nyc_output/
|
||||
.eslintcache
|
||||
.cache/
|
||||
.parcel-cache/
|
||||
|
||||
# Local editor settings
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
*.swo
|
||||
.DS_Store
|
||||
|
||||
# Local databases and generated data
|
||||
data/
|
||||
*.sqlite
|
||||
*.sqlite3
|
||||
*.db
|
||||
|
||||
# Temporary files
|
||||
tmp/
|
||||
temp/
|
||||
21
LICENSE
Normal file
21
LICENSE
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2026 Brandon Wolfgang
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
115
README.md
Normal file
115
README.md
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
# Local AI Platform
|
||||
|
||||
A self-hosted AI application designed to demonstrate production-grade backend engineering, local LLM integration, retrieval-augmented generation (RAG), observability, security, and reliability.
|
||||
|
||||
The project emphasizes measurable behavior, reproducible deployments, automated testing, and documented architectural trade-offs.
|
||||
|
||||
## Project Goals
|
||||
|
||||
- Build and expose a well-defined API for local LLM inference.
|
||||
- Integrate retrieval-augmented generation with source-grounded responses.
|
||||
- Measure latency, throughput, errors, and retrieval quality.
|
||||
- Implement structured logging, metrics, and distributed tracing.
|
||||
- Apply authentication, authorization, input validation, and secure configuration.
|
||||
- Test failure handling, retries, idempotency, and recovery.
|
||||
- Automate testing and deployment.
|
||||
- Document architectural decisions and operational procedures.
|
||||
|
||||
## Technology Stack
|
||||
|
||||
Planned technologies:
|
||||
|
||||
- **Runtime:** Node.js
|
||||
- **Language:** TypeScript
|
||||
- **API framework:** Fastify
|
||||
- **Validation:** Zod
|
||||
- **Local inference:** Ollama
|
||||
- **Database and retrieval:** PostgreSQL with pgvector
|
||||
- **Containers:** Docker and Docker Compose
|
||||
- **Testing:** Automated unit, integration, and failure-injection tests
|
||||
- **Observability:** OpenTelemetry and compatible monitoring tools
|
||||
- **CI/CD:** Automated build, test, and deployment workflows
|
||||
|
||||
Technologies will be introduced incrementally as project requirements justify them.
|
||||
|
||||
## Current Status
|
||||
|
||||
**Status:** Initial development
|
||||
|
||||
The initial milestone is to establish a working API with health and readiness endpoints, then integrate local model inference and baseline performance measurements.
|
||||
|
||||
Features listed in the project goals are planned capabilities, not claims that they have already been implemented.
|
||||
|
||||
## Getting Started
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Node.js and npm
|
||||
- Git
|
||||
|
||||
Additional dependencies, including Ollama and PostgreSQL, will be introduced as the project evolves.
|
||||
|
||||
### Installation
|
||||
|
||||
Clone the repository:
|
||||
|
||||
```bash
|
||||
git clone <repository-url>
|
||||
cd local-ai-platform
|
||||
```
|
||||
|
||||
Install dependencies:
|
||||
|
||||
```bash
|
||||
npm ci
|
||||
```
|
||||
|
||||
### Development
|
||||
|
||||
The development server and available scripts will be documented here as they are implemented.
|
||||
|
||||
## Architecture
|
||||
|
||||
The initial architecture will consist of an HTTP API and a local model inference service.
|
||||
|
||||
Subsequent iterations will introduce retrieval, persistence, observability, security controls, and deployment automation.
|
||||
|
||||
Architecture diagrams and significant design decisions will be maintained alongside the code.
|
||||
|
||||
## Testing and Quality
|
||||
|
||||
The project will progressively introduce:
|
||||
|
||||
- Automated unit and integration tests
|
||||
- API contract validation
|
||||
- Performance benchmarks
|
||||
- Retrieval and answer-quality evaluations
|
||||
- Security regression tests
|
||||
- Failure-recovery tests
|
||||
|
||||
Performance and quality claims will be backed by reproducible measurements.
|
||||
|
||||
## Security
|
||||
|
||||
- Never commit credentials, access tokens, private keys, or production data.
|
||||
- Keep local configuration and secrets outside version control.
|
||||
- Validate untrusted input and enforce authorization at the API boundary.
|
||||
- Treat retrieved documents and model-generated output as untrusted.
|
||||
- Do not expose the API publicly without appropriate authentication and security controls.
|
||||
|
||||
Report suspected vulnerabilities privately to the repository owner.
|
||||
|
||||
## Documentation
|
||||
|
||||
As the project develops, documentation will cover:
|
||||
|
||||
- Local setup and deployment
|
||||
- Architecture decision records
|
||||
- Performance and evaluation results
|
||||
- Threat models and security controls
|
||||
- Operational runbooks and recovery procedures
|
||||
- Known limitations and future improvements
|
||||
|
||||
## License
|
||||
|
||||
[MIT License](LICENSE)
|
||||
1565
package-lock.json
generated
Normal file
1565
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
25
package.json
Normal file
25
package.json
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"name": "local-ai-platform",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"dev": "tsx watch src/server.ts",
|
||||
"build": "tsc -p tsconfig.json",
|
||||
"start": "node dist/server.js"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"fastify": "^5.12.7",
|
||||
"zod": "^4.6.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^26.6.5",
|
||||
"tsx": "^4.23.15",
|
||||
"typescript": "^7.0.2"
|
||||
}
|
||||
}
|
||||
30
src/server.ts
Normal file
30
src/server.ts
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import Fastify from 'fastify';
|
||||
|
||||
const app = Fastify({
|
||||
logger: true,
|
||||
});
|
||||
|
||||
app.get('/health', async () => ({
|
||||
status: 'ok',
|
||||
}));
|
||||
|
||||
app.get('/ready', async () => ({
|
||||
status: 'ready',
|
||||
dependencies: {
|
||||
ollama: 'not-integrated',
|
||||
},
|
||||
}));
|
||||
|
||||
const start = async () => {
|
||||
try {
|
||||
await app.listen({
|
||||
host: '127.0.0.1',
|
||||
port: 3000,
|
||||
});
|
||||
} catch (error) {
|
||||
app.log.error(error);
|
||||
process.exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
void start();
|
||||
13
tsconfig.json
Normal file
13
tsconfig.json
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"rootDir": "src",
|
||||
"outDir": "dist",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue