Skip to content

Quick start

📦 Sandbox

The fastest way to try out Chord is to open the sandbox, no installation required.

📲 Init project

If you are planning to use SvelteKit, just clone a ready to run template

Terminal window
git clone https://github.com/chord-ts/sveltekit-example

🦾 Manual install

Chord can be used with any backend library. Install it freely from npm via your favorite package manager

Terminal window
npm install @chord-ts/rpc
# or
pnpm install @chord-ts/rpc

Chord uses decorators and reflection under the hood, to construct server and client. So you need to configure your tsconfig.json first

./tsconfig.json

{
compilerOptions: {
// Other stuff...
target: 'ESNext',
experimentalDecorators: true,
emitDecoratorMetadata: true
}
}

Thus, you have to use additional plugins for Vite. I personally recommend to try out SWC. It fixes this issue and doesn’t impact on rebuilding performance

Then add SWC plugin to Vite:

./vite.config.ts

import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vitest/config';
import swc from 'unplugin-swc';
export default defineConfig({
plugins: [sveltekit(), swc.vite()],
test: {
include: ['src/**/*.{test,spec}.{js,ts}']
}
});