Skip to content

Commit

Permalink
Swapped CI to NX Cloud
Browse files Browse the repository at this point in the history
Linted the entire project
Added CLI application (WIP)
Added protocols package (WIP)
Added pnpm support
Forcing Node v20 via .nvmrc
Added routing hints (WIP) to the server package
Fixing server implementations
  • Loading branch information
rennokki committed Jan 29, 2024
1 parent cae340f commit 0968689
Show file tree
Hide file tree
Showing 68 changed files with 14,649 additions and 654 deletions.
65 changes: 22 additions & 43 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,31 @@
name: CI
name: CI - integration test pnpm

on:
push:
branches:
- main
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true

jobs:
main:
runs-on: ubuntu-latest

name: Testing (Node ${{ matrix.node-version }})

strategy:
fail-fast: false
matrix:
node-version:
- 18.x
- 20.x

steps:
- uses: actions/checkout@v4
name: Checkout
with:
fetch-depth: 0

- uses: actions/setup-node@v3
name: Setup Node.js ${{ matrix.node-version }}
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Cache NPM dependencies
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci

# This is needed for nx affected to work when CI is running on a PR
- uses: nrwl/nx-set-shas@v3
name: Set NX's SHAs

- name: Run tests
run: |
npx nx format:check
npx nx affected -t lint,test,build --parallel=3 --configuration=ci
name: NX
uses: nrwl/ci/.github/workflows/[email protected]
with:
node-version: 20.x
parallel-commands: |
npx nx format:check
parallel-commands-on-agents: |
npx nx affected --target=lint --parallel=3
npx nx affected --target=test --parallel=3 --ci --code-coverage
npx nx affected --target=build --parallel=3
agents:
name: NX Cloud Agent
uses: nrwl/ci/.github/workflows/[email protected]
with:
node-version: 20.x
number-of-agents: 3
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
4 changes: 3 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{
"singleQuote": true
"singleQuote": true,
"semi": true,
"trailingComma": "all"
}
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"recommendations": [
"nrwl.angular-console",
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint"
"dbaeumer.vscode-eslint",
"firsttris.vscode-jest-runner"
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}
81 changes: 74 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,39 @@

soketipfs is a framework for building distributed applications using Websockets. It is built on top of [uWebSockets.js](https://github.com/uNetworking/uWebSockets.js) and uses the IPFS networking protocol via [Helia](https://github.com/ipfs/helia).

## 🔀 Roadmap

```text
🧑‍💻 = currently in development
👉 = upcoming for development
⏳ = planned, but not yet scheduled
👀 = not sure, maybe in the future
```

- [ ] Deployment
- [ ] 🧑‍💻 New Soketi CLI
- [ ] 🧑‍💻 Docker
- [ ] 👉 Kubernetes
- [ ] 👉 Railway
- [ ] Protocols
- [ ] 👉 Pusher Protocol
- [ ] 👉 Ably Protocol
- [ ] ⏳ MQTT Protocol
- [ ] ⏳ PubNub Protocol
- [ ] ⏳ SockJS Protocol
- [ ] ⏳ Socket.IO / Engine.IO Protocol
- [ ] 👀 AMQP Protocol
- [ ] 👀 Centrifugo Protocol
- [ ] 👀 STOMP Protocol
- [ ] Discovery Mechanisms
- [ ] 🧑‍💻 IPFS
- [ ] ⏳ Redis Pubsub
- [ ] ⏳ NATS
- [ ] Databases
- [ ] 👉 Redis Stack
- [ ] 👉 SQL via Knex
- [ ] 👀 MongoDB

## 🤝 Supporting

soketipfs is meant to be open source, forever and ever. It solves issues that many developers face - the one of wanting to be limitless while testing locally or performing benchmarks. More than that, itt is also suited for production usage, either it is public for your frontend applications or internal to your team.
Expand Down Expand Up @@ -36,9 +69,40 @@ soketipfs is capable to hold thousands of active connections with high traffic o

soketipfs implements the [Pusher Protocol v7](https://pusher.com/docs/channels/library\_auth\_reference/pusher-websockets-protocol#version-7-2017-11). Your existing projects that connect to Pusher requires minimal code change to make it work with soketipfs - you just add the host and port and swap the credentials.

## 🚀 Getting Started

Get started by using the new `soketi` CLI to start the server:

```bash
npx @soketi/cli ipfs start --port=7001
```

The CLI replaces the [soketi](https://github.com/soketi/soketi) project that has the built-in CLI for starting a server. To add backwards compatibility, you can use the `legacy` subcommand in `@soketi/cli`:

```bash
npx @soketi/cli legacy start --port=6001
```

If you wish to install the command as global, make sure to uninstall the old `soketi` package before installing the new one:

```bash
npm uninstall -g @soketi/soketi
npm install -g @soketi/cli
```

```bash
# Now you can use the IPFS server
soketi ipfs start --port=7001

# ...or the legacy server
soketi legacy start --port=6001
```

For legacy server, see the [soketi/soketi](https://github.com/soketi/soketi) repository.

## ⁉ Ideas or Discussions?

Have any ideas that can make into the project? Perhaps you have questions? [Jump into the discussions board](https://github.com/soketi/soketipfs/discussions) or [join the Discord channel](https://discord.gg/VgfKCQydjb)
Have any ideas that can make into the project? Perhaps you have questions? [Jump into the discussions board](https://github.com/soketi/monorepo/discussions) or [join the Discord channel](https://discord.gg/VgfKCQydjb)

## 🔒 Security

Expand Down Expand Up @@ -71,11 +135,14 @@ npm install

soketipfs is a monorepo, and it's composed of the following packages:

- [brain](./packages/brain/README.md): Used to cache data in memory
- [connections](./packages/connections/README.md): Base implementation for Websocket connections handling
- [gossiper](./packages/gossiper/README.md): Integration for the Gossip protocol, used to broadcast messages to all nodes in the network
- [routing](./packages/routing/README.md): Unified implementation for HTTP routing or handling custom events in the network
- [server](./packages/server/README.md): Ready-to-go & customizable server implemenations for soketipfs
- [utils](./packages/utils/README.md): Utility functions used across the packages
- [brain](./packages/brain): Used to cache data in memory
- [cli](./packages/cli): the CLI took for soketi that supports both legacy and IPFS, plus possibly many more integratins
- [connections](./packages/connections): Base implementation for Websocket connections handling
- [gossiper](./packages/gossiper): Integration for the Gossip protocol, used to broadcast messages to all nodes in the network
- [p2p](./packages/p2p): libp2p networking implementation using Helia
- [protocols](./packages/protocols): implementation of various protocols, such as Pusher, Ably or MQTT
- [routing](./packages/routing): Unified implementation for HTTP routing or handling custom events in the network
- [server](./packages/server): Ready-to-go & customizable server implemenations for soketipfs
- [utils](./packages/utils): Utility functions used across the packages

Each abstraction has its own place in the soketipfs ecosystem, and they can be used independently or together.
5 changes: 5 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { getJestProjects } from '@nx/jest';

export default {
projects: getJestProjects(),
};
3 changes: 3 additions & 0 deletions jest.preset.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const nxPreset = require('@nx/jest/preset').default;

module.exports = { ...nxPreset };
45 changes: 38 additions & 7 deletions nx.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
{
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"extends": "nx/presets/npm.json",
"pluginsConfig": {
"@nx/js": {
"analyzeSourceFiles": true
}
},
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"extends": "nx/presets/npm.json",
"targetDefaults": {
"build": {
"cache": true,
"dependsOn": ["^build"],
"inputs": ["production", "^production"]
"dependsOn": [
"^build"
],
"inputs": [
"production",
"^production"
]
},
"lint": {
"cache": true,
Expand All @@ -23,17 +28,43 @@
},
"@nx/vite:test": {
"cache": true,
"inputs": ["default", "^production"]
"inputs": [
"default",
"^production"
]
},
"@nx/jest:jest": {
"cache": true,
"inputs": [
"default",
"^production",
"{workspaceRoot}/jest.preset.js"
],
"options": {
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
}
}
},
"namedInputs": {
"default": ["{projectRoot}/**/*", "sharedGlobals"],
"default": [
"{projectRoot}/**/*",
"sharedGlobals"
],
"production": [
"default",
"!{projectRoot}/.eslintrc.json",
"!{projectRoot}/eslint.config.js",
"!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
"!{projectRoot}/tsconfig.spec.json"
"!{projectRoot}/tsconfig.spec.json",
"!{projectRoot}/jest.config.[jt]s",
"!{projectRoot}/src/test-setup.[jt]s",
"!{projectRoot}/test-setup.[jt]s"
],
"sharedGlobals": [
"{workspaceRoot}/.github/workflows/ci.yml",
Expand Down
Loading

0 comments on commit 0968689

Please sign in to comment.