Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .aitkignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
tsconfig.json
docker-compose.yml
generateScripts.sh
.github
README.md
package.json
.aitkignore
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
dist
downloads
27 changes: 27 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Run Test Suite
on:
push:
branches: [main]
pull_request:

jobs:
run-tests-docker:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 22

- name: Install docker-compose
run: |
sudo apt install docker-compose

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm run test
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
certs
data
dist
coverage
46 changes: 46 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Build stage
FROM node:22-alpine AS builder

EXPOSE 3000

# Set the working directory in the container
WORKDIR /app

# Copy package.json and package-lock.json (if available)
COPY package*.json ./

# Install OS dependencies
RUN apk update && apk add curl

# Install dependencies
RUN npm ci

# Copy the rest of your app's source code
COPY . .

# Install tsx globally
RUN npm install -g tsx

# Run npm build commands
RUN npm run build
RUN npm run build:ui

# Move the dist folder to the workdir
RUN mv dist/* /app/dist/

# Production stage
FROM node:22-alpine

WORKDIR /app

# Copy package.json and package-lock.json
COPY package*.json ./

# Install only production dependencies
RUN npm ci --only=production

# Copy dist from builder stage
COPY --from=builder /app/dist ./dist

# Set the command to run the startup script
CMD ["npm", "run", "start"]
651 changes: 651 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

19 changes: 4 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# CanhazDB
<img align="left" width="130px" src="./canhazdbLogo.svg">

CanhazDB is a lightweight, event-sourced database built on top of NATS JetStream. It provides a simple HTTP API for CRUD operations and uses an in-memory database with event sourcing for persistence.
# canhazdb-server
A lightweight, event-sourced database built on top of NATS JetStream. It provides a simple HTTP API for CRUD operations and uses an in-memory database with event sourcing for persistence.

## Features

Expand All @@ -19,7 +20,7 @@ CanhazDB is a lightweight, event-sourced database built on top of NATS JetStream

1. Clone the repository:
```
git clone https://github.com/canhazdb/server.git
git clone https://github.com/canhazdb/server.git canhazdb
cd canhazdb
```

Expand Down Expand Up @@ -66,18 +67,6 @@ Run the tests using:
npm test
```

## Project Structure

- `src/`: Source code
- `config/`: Configuration files
- `createServer.ts`: Main server creation logic
- `index.ts`: Entry point
- `tests/`: Test files

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## License

[AGPL v3](LICENSE)
195 changes: 195 additions & 0 deletions canhazdbLogo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";

export default [
{
ignores: ["**/*.min.js", "dist/**"],
},
{
files: ["**/*.{js,mjs,cjs,ts}"],
languageOptions: { globals: globals.browser },
},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
{
files: ["**/*.ts"],
rules: {
"@typescript-eslint/no-explicit-any": "off"
}
}
];
16 changes: 16 additions & 0 deletions exampleConfig.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
tls:
// Path to the certificate file
certPath: ./cert.pem
// Path to the key file
keyPath: ./key.pem
// Generate a self signed certificate if no certificates exists at the certPath and keyPath
autoGenerate: true

// Port number for the server
port: 8600

// A uuid to identify the cluster
clusterId: example-cluster

// A uuid to identify the node
nodeId: example-cluster-1
Loading