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:
| Status | Meaning |
|---|---|
| NOT SUPPORTED | Does not run today. The report gives a workaround. |
| PLANNED | On the roadmap (for example WebSocket). |
| REPLACE | Works, but use the Symmetra package named in the report (for example @symmetra/db instead of pg). |
| REVIEW | The 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 package | Symmetra |
|---|---|
express, fastify | @symmetra/http (Router, serve) |
pg, postgres | postgres(config) from @symmetra/db |
better-sqlite3, sqlite3 | sqlite(options) from @symmetra/db |
ioredis, redis | redis(config) from @symmetra/db, or ctx.kv for values that live on the GPU |
mongodb, mongoose | @symmetra/mongo |
axios, node-fetch | ctx.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 feature | Status | What to do instead |
|---|---|---|
app.use() global middleware | not supported | Write small helper functions and call them in each handler |
Router.route(path) chaining | not supported | Register each method: app.get(...), app.post(...) |
res.redirect() | not supported | ctx.header('Location', url).status(302).text('') |
res.sendFile(), res.download(), express.static() | not supported | readFile() then ctx.text(content, mimeType) |
View engines (res.render) | not supported | Build the HTML string in the handler |
fastify.register() plugins, addHook() | not supported | Inline the plugin's routes; call shared logic directly |
child_process, cluster, worker_threads | not supported | Not needed or not available on the GPU; move work into a separate service |
WebSocket (ws, @fastify/websocket) | planned | Use polling or server-sent responses for now |
| Streaming responses | supported | GpuReadable, GpuWritable, pipeline |
Limits to plan around
- A handler runs on the GPU. Code that depends on Node's event loop, process model or
native add-ons does not move over unchanged.
- The runtime measures what it runs: see the engine pages for the numbers on each core.
- Symmetra is in public beta. Behaviour can change between releases.