@type.gg/serverkit-type
v1.0.0
Published
ServerKit — Decentralized server infrastructure for the TYPE platform. Easy installation, updating, and running of hybrid/self-hosted servers.
Maintainers
Readme
ServerKit for TYPE
Decentralized server infrastructure for the TYPE platform.
ServerKit lets anyone spin up a TYPE-compatible community server — either hosted through TYPE's infrastructure (token mode) or fully self-hosted (custom mode).
Features
- Dual Mode — Token-based (TYPE-hosted) or Custom (self-hosted)
- StorageDB — Local SQLite database with optional encryption
- Channel System — Text, voice, announcement, category, stage, forum channels with JSON metadata + JS function layers
- Voice Engine — WebRTC signaling, mute/deafen/streaming state
- E2EE — End-to-end encryption with per-channel key derivation
- TypeModSDK — Plugin system with V8 sandboxing, voice buttons, slash commands
- Traffic Routing — Rate limiting, message relay, attachment handling
- Auth — JWT sessions + TYPE platform token validation
Quick Start
CLI
# Initialize a new project
npx serverkit-type init my-server
cd my-server
# Edit your config
# nano serverkit.config.js
# Start the server
npx serverkit-type startProgrammatic
const { ServerKit, Config } = require('serverkit-type');
const server = new ServerKit(new Config({
name: 'My Server',
mode: 'custom',
port: 3100,
}));
server.on('ready', () => console.log('Server is live!'));
server.start();Server Modes
Token Mode
Messages route through TYPE's main server. Easiest setup — just provide your server token.
const config = new Config({
mode: 'token',
mainServer: { token: 'your-token' },
});Custom Mode
All traffic stays on your server. TYPE's main server only handles authentication and server discovery.
const config = new Config({
mode: 'custom',
publicUrl: 'https://myserver.example.com',
mainServer: { token: 'your-token' },
});Plugins
Extend your server with TypeMod plugins:
// plugins/my-plugin/index.js
module.exports = function(api) {
api.registerCommand({
name: 'hello',
description: 'Say hello',
execute: ({ args }) => {
api.sendMessage(args.channelId, 'Hello from my plugin!');
},
});
api.registerVoiceButton({
id: 'cheer',
label: '🎉 Cheer',
onClick: ({ socket }) => {
api.playSoundboard(socket.voiceChannelId, {
name: 'Cheer', url: '/sounds/cheer.mp3', volume: 0.6,
});
},
});
return {
onLoad: () => api.log('Plugin loaded!'),
};
};Documentation
Architecture
┌─────────────────────────────────────────────────┐
│ ServerKit │
│ │
│ ┌──────────┐ ┌──────────┐ ┌───────────────┐ │
│ │ Config │ │ Logger │ │ StorageDB │ │
│ └──────────┘ └──────────┘ └───────────────┘ │
│ │
│ ┌──────────────────────────────────────────┐ │
│ │ Networking Layer │ │
│ │ HttpServer │ WebSocketServer │ Auth │ │
│ └──────────────────────────────────────────┘ │
│ │
│ ┌──────────────┐ ┌────────────────────────┐ │
│ │ Channels │ │ Traffic Handler │ │
│ │ JSON + Func │ │ Token / Custom mode │ │
│ └──────────────┘ └────────────────────────┘ │
│ │
│ ┌──────────────┐ ┌────────────────────────┐ │
│ │ VoiceEngine │ │ E2EE / KeyManager │ │
│ └──────────────┘ └────────────────────────┘ │
│ │
│ ┌──────────────────────────────────────────┐ │
│ │ TypeModSDK (Plugins) │ │
│ │ PluginLoader │ PluginSandbox │ PluginAPI │ │
│ └──────────────────────────────────────────┘ │
└─────────────────────────────────────────────────┘License
MIT © Lonidev
