Symmetra Script

Moving a Node.js app to Symmetra

Symmetra runs TypeScript on the GPU with the same shape as a Node.js server: you write import, app.get(...), ctx.json(...), and start it with one command. This guide shows the steps, and it is honest about what does not run yet.

1. Check the project first

The port check reads your source and reports every API that does not run on Symmetra, with the file, the line and a workaround. It changes nothing.

node port-check.mjs ./my-app          # human-readable report
node port-check.mjs ./my-app --json   # for scripts and CI

Findings are grouped as:

StatusMeaning
NOT SUPPORTEDDoes not run today. The report gives a workaround.
PLANNEDOn the roadmap (for example WebSocket).
REPLACEWorks, but use the Symmetra package named in the report (for example @symmetra/db instead of pg).
REVIEWThe check cannot decide. Read the line.

If the report has no NOT SUPPORTED or PLANNED entries, the routes can be converted directly.

2. Run the same code with sym

A Symmetra file is run the way you would run a Node script:

symmetra app.ts          # Linux, or the Docker image
sym.exe app.ts           # Windows runtime

The port comes from serve(app, { port }) in the file. Nothing else is needed: no build step, no bundler, no node_modules for the runtime itself.

3. Convert the routes

Express

import express from 'express';
const app = express();
app.get('/ping', (req, res) => {
  res.json({ message: 'pong' });
});
app.listen(3000);

Symmetra

import { serve, Router } from '@symmetra/http';
const app = new Router();
app.get('/ping', (ctx) => {
  ctx.json({ message: 'pong' });
});
serve(app, { port: 3000 });

Body, parameters and headers map the same way:

// Express: app.post('/users', (req, res) => { const { name } = req.body; ... })
app.post('/users', async (ctx) => {
  const { name, email } = await ctx.json<{ name: string; email: string }>();
  ctx.status(201).json({ name, email });
});

// Express: app.get('/users/:id', (req, res) => res.json({ id: req.params.id }))
app.get('/users/:id', (ctx) => {
  ctx.json({ id: ctx.params.id });
});

No express.json() is needed: body parsing is built in.

4. Replace the packages

Node packageSymmetra
express, fastify@symmetra/http (Router, serve)
pg, postgrespostgres(config) from @symmetra/db
better-sqlite3, sqlite3sqlite(options) from @symmetra/db
ioredis, redisredis(config) from @symmetra/db, or ctx.kv for values that live on the GPU
mongodb, mongoose@symmetra/mongo
axios, node-fetchctx.fetch(url) inside a handler, or @symmetra/net
Node core modules@symmetra/* or the compat-* packages where they exist

5. Check that the responses match

Run the old server and the new one on different ports, send the same requests to both, and compare the bodies and status codes. Do this for every route before you switch traffic over. A route that answers differently is a bug, and a silent one is the worst kind, so compare the responses rather than assuming they match.

What does not run yet

Node / Express / Fastify featureStatusWhat to do instead
app.use() global middlewarenot supportedWrite small helper functions and call them in each handler
Router.route(path) chainingnot supportedRegister each method: app.get(...), app.post(...)
res.redirect()not supportedctx.header('Location', url).status(302).text('')
res.sendFile(), res.download(), express.static()not supportedreadFile() then ctx.text(content, mimeType)
View engines (res.render)not supportedBuild the HTML string in the handler
fastify.register() plugins, addHook()not supportedInline the plugin's routes; call shared logic directly
child_process, cluster, worker_threadsnot supportedNot needed or not available on the GPU; move work into a separate service
WebSocket (ws, @fastify/websocket)plannedUse polling or server-sent responses for now
Streaming responsessupportedGpuReadable, GpuWritable, pipeline

Limits to plan around

native add-ons does not move over unchanged.